Commit b2dac953 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

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

Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: I2a7a8c8447d2835205f7a506f04efe4d1801b934
Reviewed-on: https://chromium-review.googlesource.com/1224316Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55903}
parent 0a53977d
......@@ -275,14 +275,15 @@ class RegisterThreadedTest {
// A LocalContext holds a reference to a v8::Context.
class LocalContext {
public:
LocalContext(v8::Isolate* isolate, v8::ExtensionConfiguration* extensions = 0,
LocalContext(v8::Isolate* isolate,
v8::ExtensionConfiguration* extensions = nullptr,
v8::Local<v8::ObjectTemplate> global_template =
v8::Local<v8::ObjectTemplate>(),
v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) {
Initialize(isolate, extensions, global_template, global_object);
}
LocalContext(v8::ExtensionConfiguration* extensions = 0,
LocalContext(v8::ExtensionConfiguration* extensions = nullptr,
v8::Local<v8::ObjectTemplate> global_template =
v8::Local<v8::ObjectTemplate>(),
v8::Local<v8::Value> global_object = v8::Local<v8::Value>()) {
......
......@@ -898,14 +898,14 @@ static const char* not_so_random_string_table[] = {
"volatile",
"while",
"with",
0
nullptr
};
static void CheckInternalizedStrings(const char** strings) {
Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory();
for (const char* string = *strings; *strings != 0; string = *strings++) {
for (const char* string = *strings; *strings != nullptr;
string = *strings++) {
HandleScope scope(isolate);
Handle<String> a =
isolate->factory()->InternalizeUtf8String(CStrVector(string));
......
......@@ -27,7 +27,7 @@ class InvokeIntrinsicHelper {
template <class... A>
Handle<Object> Invoke(A... args) {
CHECK(IntrinsicsHelper::IsSupported(function_id_));
BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, 0);
BytecodeArrayBuilder builder(zone_, sizeof...(args), 0, nullptr);
RegisterList reg_list = InterpreterTester::NewRegisterList(
builder.Receiver().index(), sizeof...(args));
builder.CallRuntime(function_id_, reg_list).Return();
......
......@@ -181,7 +181,7 @@ THREADED_TEST(GlobalVariableAccess) {
templ->InstanceTemplate()->SetAccessor(
v8_str("baz"), GetIntValue, SetIntValue,
v8::External::New(isolate, &baz));
LocalContext env(0, templ->InstanceTemplate());
LocalContext env(nullptr, templ->InstanceTemplate());
v8_compile("foo = (++bar) + baz")->Run(env.local()).ToLocalChecked();
CHECK_EQ(-3, bar);
CHECK_EQ(7, foo);
......
......@@ -285,7 +285,7 @@ TEST(AccessorSetHasNoSideEffect) {
obj->SetAccessor(context, v8_str("foo"), Getter).ToChecked();
CHECK(v8::debug::EvaluateGlobal(isolate, v8_str("obj.foo"), true).IsEmpty());
obj->SetAccessor(context, v8_str("foo"), Getter, 0,
obj->SetAccessor(context, v8_str("foo"), Getter, nullptr,
v8::MaybeLocal<v8::Value>(), v8::AccessControl::DEFAULT,
v8::PropertyAttribute::None,
v8::SideEffectType::kHasNoSideEffect)
......@@ -429,10 +429,10 @@ TEST(ObjectTemplateSetAccessorHasNoSideEffect) {
v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
templ->SetAccessor(v8_str("foo"), StringGetter);
templ->SetAccessor(v8_str("foo2"), StringGetter, 0, v8::Local<v8::Value>(),
v8::AccessControl::DEFAULT, v8::PropertyAttribute::None,
v8::Local<v8::AccessorSignature>(),
v8::SideEffectType::kHasNoSideEffect);
templ->SetAccessor(
v8_str("foo2"), StringGetter, nullptr, v8::Local<v8::Value>(),
v8::AccessControl::DEFAULT, v8::PropertyAttribute::None,
v8::Local<v8::AccessorSignature>(), v8::SideEffectType::kHasNoSideEffect);
v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked();
CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust());
......@@ -458,7 +458,7 @@ TEST(ObjectTemplateSetNativePropertyHasNoSideEffect) {
v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
templ->SetNativeDataProperty(v8_str("foo"), Getter);
templ->SetNativeDataProperty(
v8_str("foo2"), Getter, 0, v8::Local<v8::Value>(),
v8_str("foo2"), Getter, nullptr, v8::Local<v8::Value>(),
v8::PropertyAttribute::None, v8::Local<v8::AccessorSignature>(),
v8::AccessControl::DEFAULT, v8::SideEffectType::kHasNoSideEffect);
v8::Local<v8::Object> obj = templ->NewInstance(env.local()).ToLocalChecked();
......
This diff is collapsed.
This diff is collapsed.
......@@ -123,11 +123,9 @@ void DeclarationContext::InitializeIfNeeded() {
Local<FunctionTemplate> function = FunctionTemplate::New(isolate);
Local<Value> data = External::New(CcTest::isolate(), this);
GetHolder(function)->SetHandler(v8::NamedPropertyHandlerConfiguration(
&HandleGet, &HandleSet, &HandleQuery, 0, 0, data));
Local<Context> context = Context::New(isolate,
0,
function->InstanceTemplate(),
Local<Value>());
&HandleGet, &HandleSet, &HandleQuery, nullptr, nullptr, data));
Local<Context> context = Context::New(
isolate, nullptr, function->InstanceTemplate(), Local<Value>());
context_.Reset(isolate, context);
context->Enter();
is_initialized_ = true;
......
......@@ -2600,7 +2600,7 @@ TEST(OptionalCatchBinding) {
{"try {", "} catch ({e}) { }"},
{"try {} catch ({e}) {", "}"},
{"function f() {", "}"},
{ NULL, NULL }
{ nullptr, nullptr }
};
const char* statement_data[] = {
......@@ -2608,7 +2608,7 @@ TEST(OptionalCatchBinding) {
"try { } catch { } finally { }",
"try { let e; } catch { let e; }",
"try { let e; } catch { let e; } finally { let e; }",
NULL
nullptr
};
// clang-format on
......@@ -2621,7 +2621,7 @@ TEST(OptionalCatchBindingInDoExpression) {
// clang-format off
const char* context_data[][2] = {
{"((x = (eval(''), do {", "}))=>{})()"},
{ NULL, NULL }
{ nullptr, nullptr }
};
const char* statement_data[] = {
......@@ -2629,12 +2629,12 @@ TEST(OptionalCatchBindingInDoExpression) {
"try { } catch { } finally { }",
"try { let e; } catch { let e; }",
"try { let e; } catch { let e; } finally { let e; }",
NULL
nullptr
};
// clang-format on
static const ParserFlag do_and_catch_flags[] = {kAllowHarmonyDoExpressions};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0,
do_and_catch_flags, arraysize(do_and_catch_flags));
}
......
......@@ -157,7 +157,8 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_WasmError) {
int unreachable_pos = 1 << (8 * pos_shift);
TestSignatures sigs;
// Create a WasmRunner with stack checks and traps enabled.
WasmRunner<int> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
WasmRunner<int> r(execution_tier, nullptr, "main",
kRuntimeExceptionSupport);
std::vector<byte> code(unreachable_pos + 1, kExprNop);
code[unreachable_pos] = kExprUnreachable;
......
......@@ -69,7 +69,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc,
// Trigger a trap for executing unreachable.
WASM_EXEC_TEST(Unreachable) {
// Create a WasmRunner with stack checks and traps enabled.
WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
WasmRunner<void> r(execution_tier, nullptr, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
BUILD(r, WASM_UNREACHABLE);
......@@ -103,7 +103,7 @@ WASM_EXEC_TEST(Unreachable) {
// Trigger a trap for loading from out-of-bounds.
WASM_EXEC_TEST(IllegalLoad) {
WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
WasmRunner<void> r(execution_tier, nullptr, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
r.builder().AddMemory(0L);
......
......@@ -52,17 +52,17 @@ class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
static void DumpMaps(i::PagedSpace* space) {
i::HeapObjectIterator it(space);
i::ReadOnlyRoots roots(space->heap());
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
for (i::Object* o = it.Next(); o != nullptr; o = it.Next()) {
if (!o->IsMap()) continue;
i::Map* m = i::Map::cast(o);
const char* n = NULL;
const char* n = nullptr;
intptr_t p = reinterpret_cast<intptr_t>(m) & 0x7FFFF;
int t = m->instance_type();
STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE)
MUTABLE_ROOT_LIST(ROOT_LIST_CASE)
STRUCT_LIST(STRUCT_LIST_CASE)
ALLOCATION_SITE_LIST(ALLOCATION_SITE_LIST_CASE)
if (n == NULL) continue;
if (n == nullptr) continue;
const char* sname = space->name();
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): (%d, \"%s\"),\n", sname, p, t,
n);
......@@ -115,21 +115,21 @@ static int DumpHeapConstants(const char* argv0) {
}
i::PagedSpaces spit(heap, i::PagedSpaces::SpacesSpecifier::kAllPagedSpaces);
i::PrintF("KNOWN_OBJECTS = {\n");
for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) {
for (i::PagedSpace* s = spit.next(); s != nullptr; s = spit.next()) {
i::HeapObjectIterator it(s);
// Code objects are generally platform-dependent.
if (s->identity() == i::CODE_SPACE || s->identity() == i::MAP_SPACE)
continue;
const char* sname = s->name();
for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
for (i::Object* o = it.Next(); o != nullptr; o = it.Next()) {
// Skip maps in RO_SPACE since they will be reported elsewhere.
if (o->IsMap()) continue;
const char* n = NULL;
const char* n = nullptr;
i::Heap::RootListIndex i = i::Heap::kStrongRootListLength;
intptr_t p = reinterpret_cast<intptr_t>(o) & 0x7FFFF;
STRONG_READ_ONLY_ROOT_LIST(RO_ROOT_LIST_CASE)
MUTABLE_ROOT_LIST(ROOT_LIST_CASE)
if (n == NULL) continue;
if (n == nullptr) continue;
if (!i::Heap::RootIsImmortalImmovable(i)) continue;
i::PrintF(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n);
}
......
......@@ -113,8 +113,8 @@ class ThreadWithSharedMutexAndConditionVariable final : public Thread {
: Thread(Options("ThreadWithSharedMutexAndConditionVariable")),
running_(false),
finished_(false),
cv_(NULL),
mutex_(NULL) {}
cv_(nullptr),
mutex_(nullptr) {}
void Run() override {
LockGuard<Mutex> lock_guard(mutex_);
......
......@@ -16,11 +16,11 @@ typedef TestWithIsolate SpacesTest;
TEST_F(SpacesTest, CompactionSpaceMerge) {
Heap* heap = i_isolate()->heap();
OldSpace* old_space = heap->old_space();
EXPECT_TRUE(old_space != NULL);
EXPECT_TRUE(old_space != nullptr);
CompactionSpace* compaction_space =
new CompactionSpace(heap, OLD_SPACE, NOT_EXECUTABLE);
EXPECT_TRUE(compaction_space != NULL);
EXPECT_TRUE(compaction_space != nullptr);
for (Page* p : *old_space) {
// Unlink free lists from the main space to avoid reusing the memory for
......
......@@ -16,13 +16,13 @@ class DefaultPlatformEnvironment final : public ::testing::Environment {
void SetUp() override {
platform_ = v8::platform::NewDefaultPlatform(
0, v8::platform::IdleTaskSupport::kEnabled);
ASSERT_TRUE(platform_.get() != NULL);
ASSERT_TRUE(platform_.get() != nullptr);
v8::V8::InitializePlatform(platform_.get());
ASSERT_TRUE(v8::V8::Initialize());
}
void TearDown() override {
ASSERT_TRUE(platform_.get() != NULL);
ASSERT_TRUE(platform_.get() != nullptr);
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
}
......
......@@ -31,25 +31,25 @@ TestWithIsolate::~TestWithIsolate() {}
// static
void TestWithIsolate::SetUpTestCase() {
Test::SetUpTestCase();
EXPECT_EQ(NULL, isolate_);
EXPECT_EQ(nullptr, isolate_);
// Make BigInt64Array / BigUint64Array available for testing.
i::FLAG_harmony_bigint = true;
v8::Isolate::CreateParams create_params;
array_buffer_allocator_ = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
create_params.array_buffer_allocator = array_buffer_allocator_;
isolate_ = v8::Isolate::New(create_params);
EXPECT_TRUE(isolate_ != NULL);
EXPECT_TRUE(isolate_ != nullptr);
}
// static
void TestWithIsolate::TearDownTestCase() {
ASSERT_TRUE(isolate_ != NULL);
ASSERT_TRUE(isolate_ != nullptr);
v8::Platform* platform = internal::V8::GetCurrentPlatform();
ASSERT_TRUE(platform != NULL);
ASSERT_TRUE(platform != nullptr);
while (platform::PumpMessageLoop(platform, isolate_)) continue;
isolate_->Dispose();
isolate_ = NULL;
isolate_ = nullptr;
delete array_buffer_allocator_;
Test::TearDownTestCase();
}
......
......@@ -674,7 +674,7 @@ TEST_F(DecoderTest, ReadI64v_extra_bits_positive) {
}
TEST_F(DecoderTest, FailOnNullData) {
decoder.Reset(nullptr, 0);
decoder.Reset(nullptr, nullptr);
decoder.checkAvailable(1);
EXPECT_FALSE(decoder.ok());
EXPECT_FALSE(decoder.toResult(nullptr).ok());
......
......@@ -207,7 +207,7 @@ TEST_F(WasmModuleVerifyTest, WrongVersion) {
}
TEST_F(WasmModuleVerifyTest, DecodeEmpty) {
ModuleResult result = DecodeModule(nullptr, 0);
ModuleResult result = DecodeModule(nullptr, nullptr);
EXPECT_TRUE(result.ok());
}
......
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