Commit 7f27bf26 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[cleanup] Replace 0 and NULL with nullptr for src/ files.

Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I5404f0b94c7badce2c59d8eac2c32810f4fa2c3c
Reviewed-on: https://chromium-review.googlesource.com/1224317Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55914}
parent 017b0df7
......@@ -876,7 +876,7 @@ void RegisteredExtension::UnregisterAll() {
namespace {
class ExtensionResource : public String::ExternalOneByteStringResource {
public:
ExtensionResource() : data_(0), length_(0) {}
ExtensionResource() : data_(nullptr), length_(0) {}
ExtensionResource(const char* data, size_t length)
: data_(data), length_(length) {}
const char* data() const { return data_; }
......@@ -1391,7 +1391,7 @@ static Local<FunctionTemplate> FunctionTemplateNew(
next_serial_number = isolate->heap()->GetNextTemplateSerialNumber();
}
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
if (callback != 0) {
if (callback != nullptr) {
Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type);
}
obj->set_length(length);
......@@ -5955,12 +5955,12 @@ HeapStatistics::HeapStatistics()
number_of_native_contexts_(0),
number_of_detached_contexts_(0) {}
HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
space_size_(0),
space_used_size_(0),
space_available_size_(0),
physical_space_size_(0) { }
HeapSpaceStatistics::HeapSpaceStatistics()
: space_name_(nullptr),
space_size_(0),
space_used_size_(0),
space_available_size_(0),
physical_space_size_(0) {}
HeapObjectStatistics::HeapObjectStatistics()
: object_type_(nullptr),
......
......@@ -104,7 +104,7 @@ void DemangleSymbols(std::string* text) {
// Try to demangle the mangled symbol candidate.
int status = 0;
std::unique_ptr<char, FreeDeleter> demangled_symbol(
abi::__cxa_demangle(mangled_symbol.c_str(), nullptr, 0, &status));
abi::__cxa_demangle(mangled_symbol.c_str(), nullptr, nullptr, &status));
if (status == 0) { // Demangling is successful.
// Remove the mangled symbol.
text->erase(mangled_start, mangled_end - mangled_start);
......
......@@ -204,7 +204,7 @@ class ExecArgs {
return;
}
delete [] exec_args_[i];
exec_args_[i] = 0;
exec_args_[i] = nullptr;
}
}
static const unsigned kMaxArgs = 1000;
......
......@@ -27,7 +27,7 @@ static const char kDaysInMonths[] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
DateCache::DateCache()
: stamp_(0),
: stamp_(nullptr),
tz_cache_(
#ifdef V8_INTL_SUPPORT
FLAG_icu_timezone_data ? new ICUTimezoneCache()
......
......@@ -1838,7 +1838,7 @@ extern "C" {
// GDB will inspect contents of this descriptor.
// Static initialization is necessary to prevent GDB from seeing
// uninitialized descriptor.
JITDescriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
JITDescriptor __jit_debug_descriptor = {1, 0, nullptr, nullptr};
#ifdef OBJECT_PRINT
void __gdb_print_v8_object(Object* object) {
......
......@@ -547,7 +547,7 @@ String16 String16::fromUTF8(const char* stringStart, size_t length) {
UChar* bufferCurrent = bufferStart;
const char* stringCurrent = stringStart;
if (convertUTF8ToUTF16(&stringCurrent, stringStart + length, &bufferCurrent,
bufferCurrent + buffer.size(), 0,
bufferCurrent + buffer.size(), nullptr,
true) != conversionOK)
return String16();
......
......@@ -20,7 +20,8 @@ class V8Regex {
public:
V8Regex(V8InspectorImpl*, const String16&, bool caseSensitive,
bool multiline = false);
int match(const String16&, int startFrom = 0, int* matchLength = 0) const;
int match(const String16&, int startFrom = 0,
int* matchLength = nullptr) const;
bool isValid() const { return !m_regex.IsEmpty(); }
const String16& errorMessage() const { return m_errorMessage; }
......
......@@ -423,7 +423,7 @@ class SignalHandler {
static void Restore() {
if (signal_handler_installed_) {
sigaction(SIGPROF, &old_signal_handler_, 0);
sigaction(SIGPROF, &old_signal_handler_, nullptr);
signal_handler_installed_ = false;
}
}
......
......@@ -581,7 +581,8 @@ static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars,
elements->set(i, value, mode);
}
if (i < length) {
static_assert(Smi::kZero == 0, "Can use memset since Smi::kZero is 0");
static_assert(Smi::kZero == nullptr,
"Can use memset since Smi::kZero is 0");
memset(elements->data_start() + i, 0, kPointerSize * (length - i));
}
#ifdef DEBUG
......
......@@ -1006,7 +1006,7 @@ RUNTIME_FUNCTION(Runtime_WasmNumInterpretedCalls) {
DCHECK_EQ(1, args.length());
HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
if (!instance->has_debug_info()) return 0;
if (!instance->has_debug_info()) return nullptr;
uint64_t num = instance->debug_info()->NumInterpretedCalls();
return *isolate->factory()->NewNumberFromSize(static_cast<size_t>(num));
}
......
......@@ -350,7 +350,7 @@ bool RunExtraCode(v8::Isolate* isolate, v8::Local<v8::Context> context,
}
v8::StartupData CreateSnapshotDataBlob(v8::SnapshotCreator* snapshot_creator,
const char* script_source = NULL) {
const char* script_source = nullptr) {
// Create a new isolate and a new context from scratch, optionally run
// a script to embed, and serialize to create a snapshot blob.
v8::StartupData result = {nullptr, 0};
......
......@@ -42,7 +42,7 @@ class ZoneAllocator {
T* address(T& x) const { return &x; }
const T* address(const T& x) const { return &x; }
T* allocate(size_t n, const void* hint = 0) {
T* allocate(size_t n, const void* hint = nullptr) {
return static_cast<T*>(zone_->NewArray<T>(static_cast<int>(n)));
}
void deallocate(T* p, size_t) { /* noop for Zones */
......@@ -103,7 +103,7 @@ class RecyclingZoneAllocator : public ZoneAllocator<T> {
template <typename U>
friend class RecyclingZoneAllocator;
T* allocate(size_t n, const void* hint = 0) {
T* allocate(size_t n, const void* hint = nullptr) {
// Only check top block in free list, since this will be equal to or larger
// than the other blocks in the free list.
if (free_list_ && free_list_->size >= n) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment