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

[cleanup] Replace 0 and NULL with nullptr for external includes.

Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I4f9eb0fedbe1d35a571f3d5b111705a820edfb5b
Reviewed-on: https://chromium-review.googlesource.com/1224377
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55905}
parent 592eb38f
......@@ -800,8 +800,8 @@ class V8_EXPORT HeapProfiler {
* Takes a heap snapshot and returns it.
*/
const HeapSnapshot* TakeHeapSnapshot(
ActivityControl* control = NULL,
ObjectNameResolver* global_object_name_resolver = NULL);
ActivityControl* control = nullptr,
ObjectNameResolver* global_object_name_resolver = nullptr);
/**
* Starts tracking of heap objects population statistics. After calling
......@@ -828,7 +828,7 @@ class V8_EXPORT HeapProfiler {
* method.
*/
SnapshotObjectId GetHeapStats(OutputStream* stream,
int64_t* timestamp_us = NULL);
int64_t* timestamp_us = nullptr);
/**
* Stops tracking of heap objects population statistics, cleans up all
......
......@@ -94,11 +94,11 @@ class DefaultPersistentValueMapTraits : public StdMapTraits<K, V> {
static WeakCallbackDataType* WeakCallbackParameter(
MapType* map, const K& key, Local<V> value) {
return NULL;
return nullptr;
}
static MapType* MapFromWeakCallbackInfo(
const WeakCallbackInfo<WeakCallbackDataType>& data) {
return NULL;
return nullptr;
}
static K KeyFromWeakCallbackInfo(
const WeakCallbackInfo<WeakCallbackDataType>& data) {
......@@ -302,7 +302,7 @@ class PersistentValueMapBase {
static PersistentContainerValue ClearAndLeak(Global<V>* persistent) {
V* v = persistent->val_;
persistent->val_ = 0;
persistent->val_ = nullptr;
return reinterpret_cast<PersistentContainerValue>(v);
}
......@@ -633,7 +633,7 @@ class PersistentValueVector {
private:
static PersistentContainerValue ClearAndLeak(Global<V>* persistent) {
V* v = persistent->val_;
persistent->val_ = 0;
persistent->val_ = nullptr;
return reinterpret_cast<PersistentContainerValue>(v);
}
......
......@@ -178,7 +178,7 @@ class ConsoleCallArguments;
template <class T>
class Local {
public:
V8_INLINE Local() : val_(0) {}
V8_INLINE Local() : val_(nullptr) {}
template <class S>
V8_INLINE Local(Local<S> that)
: val_(reinterpret_cast<T*>(*that)) {
......@@ -193,12 +193,12 @@ class Local {
/**
* Returns true if the handle is empty.
*/
V8_INLINE bool IsEmpty() const { return val_ == 0; }
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
/**
* Sets the handle to be empty. IsEmpty() will then return true.
*/
V8_INLINE void Clear() { val_ = 0; }
V8_INLINE void Clear() { val_ = nullptr; }
V8_INLINE T* operator->() const { return val_; }
......@@ -214,8 +214,8 @@ class Local {
V8_INLINE bool operator==(const Local<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
if (a == 0) return b == 0;
if (b == 0) return false;
if (a == nullptr) return b == nullptr;
if (b == nullptr) return false;
return *a == *b;
}
......@@ -223,8 +223,8 @@ class Local {
const PersistentBase<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
if (a == 0) return b == 0;
if (b == 0) return false;
if (a == nullptr) return b == nullptr;
if (b == nullptr) return false;
return *a == *b;
}
......@@ -468,7 +468,7 @@ template <class T> class PersistentBase {
template <class S>
V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other);
V8_INLINE bool IsEmpty() const { return val_ == NULL; }
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
V8_INLINE void Empty() { val_ = 0; }
V8_INLINE Local<T> Get(Isolate* isolate) const {
......@@ -479,8 +479,8 @@ template <class T> class PersistentBase {
V8_INLINE bool operator==(const PersistentBase<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
if (a == NULL) return b == NULL;
if (b == NULL) return false;
if (a == nullptr) return b == nullptr;
if (b == nullptr) return false;
return *a == *b;
}
......@@ -488,8 +488,8 @@ template <class T> class PersistentBase {
V8_INLINE bool operator==(const Local<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(this->val_);
internal::Object** b = reinterpret_cast<internal::Object**>(that.val_);
if (a == NULL) return b == NULL;
if (b == NULL) return false;
if (a == nullptr) return b == nullptr;
if (b == nullptr) return false;
return *a == *b;
}
......@@ -662,7 +662,7 @@ template <class T, class M> class Persistent : public PersistentBase<T> {
/**
* A Persistent with no storage cell.
*/
V8_INLINE Persistent() : PersistentBase<T>(0) { }
V8_INLINE Persistent() : PersistentBase<T>(nullptr) {}
/**
* Construct a Persistent from a Local.
* When the Local is non-empty, a new storage cell is created
......@@ -689,7 +689,7 @@ template <class T, class M> class Persistent : public PersistentBase<T> {
* traits class is called, allowing the setting of flags based on the
* copied Persistent.
*/
V8_INLINE Persistent(const Persistent& that) : PersistentBase<T>(0) {
V8_INLINE Persistent(const Persistent& that) : PersistentBase<T>(nullptr) {
Copy(that);
}
template <class S, class M2>
......@@ -1265,7 +1265,7 @@ class V8_EXPORT ScriptCompiler {
};
CachedData()
: data(NULL),
: data(nullptr),
length(0),
rejected(false),
buffer_policy(BufferNotOwned) {}
......@@ -1296,9 +1296,9 @@ class V8_EXPORT ScriptCompiler {
public:
// Source takes ownership of CachedData.
V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
CachedData* cached_data = NULL);
CachedData* cached_data = nullptr);
V8_INLINE Source(Local<String> source_string,
CachedData* cached_data = NULL);
CachedData* cached_data = nullptr);
V8_INLINE ~Source();
// Ownership of the CachedData or its buffers is *not* transferred to the
......@@ -2601,7 +2601,7 @@ class V8_EXPORT String : public Name {
int length = -1, int options = NO_OPTIONS) const;
// UTF-8 encoded characters.
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
int* nchars_ref = NULL, int options = NO_OPTIONS) const;
int* nchars_ref = nullptr, int options = NO_OPTIONS) const;
/**
* A zero length string.
......@@ -3341,7 +3341,8 @@ class V8_EXPORT Object : public Value {
*/
V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
Local<Context> context, Local<Name> name,
AccessorNameGetterCallback getter, AccessorNameSetterCallback setter = 0,
AccessorNameGetterCallback getter,
AccessorNameSetterCallback setter = nullptr,
MaybeLocal<Value> data = MaybeLocal<Value>(),
AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
......@@ -5283,7 +5284,7 @@ class V8_EXPORT Template : public Data {
*/
void SetNativeDataProperty(
Local<String> name, AccessorGetterCallback getter,
AccessorSetterCallback setter = 0,
AccessorSetterCallback setter = nullptr,
// TODO(dcarney): gcc can't handle Local below
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
Local<AccessorSignature> signature = Local<AccessorSignature>(),
......@@ -5292,7 +5293,7 @@ class V8_EXPORT Template : public Data {
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
void SetNativeDataProperty(
Local<Name> name, AccessorNameGetterCallback getter,
AccessorNameSetterCallback setter = 0,
AccessorNameSetterCallback setter = nullptr,
// TODO(dcarney): gcc can't handle Local below
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
Local<AccessorSignature> signature = Local<AccessorSignature>(),
......@@ -5669,7 +5670,7 @@ class V8_EXPORT FunctionTemplate : public Template {
public:
/** Creates a function template.*/
static Local<FunctionTemplate> New(
Isolate* isolate, FunctionCallback callback = 0,
Isolate* isolate, FunctionCallback callback = nullptr,
Local<Value> data = Local<Value>(),
Local<Signature> signature = Local<Signature>(), int length = 0,
ConstructorBehavior behavior = ConstructorBehavior::kAllow,
......@@ -5850,11 +5851,11 @@ struct NamedPropertyHandlerConfiguration {
NamedPropertyHandlerConfiguration(
/** Note: getter is required */
GenericNamedPropertyGetterCallback getter = 0,
GenericNamedPropertySetterCallback setter = 0,
GenericNamedPropertyQueryCallback query = 0,
GenericNamedPropertyDeleterCallback deleter = 0,
GenericNamedPropertyEnumeratorCallback enumerator = 0,
GenericNamedPropertyGetterCallback getter = nullptr,
GenericNamedPropertySetterCallback setter = nullptr,
GenericNamedPropertyQueryCallback query = nullptr,
GenericNamedPropertyDeleterCallback deleter = nullptr,
GenericNamedPropertyEnumeratorCallback enumerator = nullptr,
Local<Value> data = Local<Value>(),
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
: getter(getter),
......@@ -5862,8 +5863,8 @@ struct NamedPropertyHandlerConfiguration {
query(query),
deleter(deleter),
enumerator(enumerator),
definer(0),
descriptor(0),
definer(nullptr),
descriptor(nullptr),
data(data),
flags(flags) {}
......@@ -5878,7 +5879,7 @@ struct NamedPropertyHandlerConfiguration {
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
: getter(getter),
setter(setter),
query(0),
query(nullptr),
deleter(deleter),
enumerator(enumerator),
definer(definer),
......@@ -5920,11 +5921,11 @@ struct IndexedPropertyHandlerConfiguration {
IndexedPropertyHandlerConfiguration(
/** Note: getter is required */
IndexedPropertyGetterCallback getter = 0,
IndexedPropertySetterCallback setter = 0,
IndexedPropertyQueryCallback query = 0,
IndexedPropertyDeleterCallback deleter = 0,
IndexedPropertyEnumeratorCallback enumerator = 0,
IndexedPropertyGetterCallback getter = nullptr,
IndexedPropertySetterCallback setter = nullptr,
IndexedPropertyQueryCallback query = nullptr,
IndexedPropertyDeleterCallback deleter = nullptr,
IndexedPropertyEnumeratorCallback enumerator = nullptr,
Local<Value> data = Local<Value>(),
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
: getter(getter),
......@@ -5932,8 +5933,8 @@ struct IndexedPropertyHandlerConfiguration {
query(query),
deleter(deleter),
enumerator(enumerator),
definer(0),
descriptor(0),
definer(nullptr),
descriptor(nullptr),
data(data),
flags(flags) {}
......@@ -5948,7 +5949,7 @@ struct IndexedPropertyHandlerConfiguration {
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
: getter(getter),
setter(setter),
query(0),
query(nullptr),
deleter(deleter),
enumerator(enumerator),
definer(definer),
......@@ -6020,15 +6021,17 @@ class V8_EXPORT ObjectTemplate : public Template {
*/
void SetAccessor(
Local<String> name, AccessorGetterCallback getter,
AccessorSetterCallback setter = 0, Local<Value> data = Local<Value>(),
AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
AccessorSetterCallback setter = nullptr,
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
PropertyAttribute attribute = None,
Local<AccessorSignature> signature = Local<AccessorSignature>(),
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
void SetAccessor(
Local<Name> name, AccessorNameGetterCallback getter,
AccessorNameSetterCallback setter = 0, Local<Value> data = Local<Value>(),
AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
AccessorNameSetterCallback setter = nullptr,
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
PropertyAttribute attribute = None,
Local<AccessorSignature> signature = Local<AccessorSignature>(),
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
......@@ -6065,10 +6068,10 @@ class V8_EXPORT ObjectTemplate : public Template {
// TODO(dcarney): deprecate
void SetIndexedPropertyHandler(
IndexedPropertyGetterCallback getter,
IndexedPropertySetterCallback setter = 0,
IndexedPropertyQueryCallback query = 0,
IndexedPropertyDeleterCallback deleter = 0,
IndexedPropertyEnumeratorCallback enumerator = 0,
IndexedPropertySetterCallback setter = nullptr,
IndexedPropertyQueryCallback query = nullptr,
IndexedPropertyDeleterCallback deleter = nullptr,
IndexedPropertyEnumeratorCallback enumerator = nullptr,
Local<Value> data = Local<Value>()) {
SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
deleter, enumerator, data));
......@@ -6208,7 +6211,7 @@ V8_DEPRECATE_SOON("Implementation detail", class)
V8_EXPORT ExternalOneByteStringResourceImpl
: public String::ExternalOneByteStringResource {
public:
ExternalOneByteStringResourceImpl() : data_(0), length_(0) {}
ExternalOneByteStringResourceImpl() : data_(nullptr), length_(0) {}
ExternalOneByteStringResourceImpl(const char* data, size_t length)
: data_(data), length_(length) {}
const char* data() const { return data_; }
......@@ -6226,11 +6229,8 @@ class V8_EXPORT Extension { // NOLINT
public:
// Note that the strings passed into this constructor must live as long
// as the Extension itself.
Extension(const char* name,
const char* source = 0,
int dep_count = 0,
const char** deps = 0,
int source_length = -1);
Extension(const char* name, const char* source = nullptr, int dep_count = 0,
const char** deps = nullptr, int source_length = -1);
virtual ~Extension() { delete source_; }
virtual Local<FunctionTemplate> GetNativeFunctionTemplate(
Isolate* isolate, Local<String> name) {
......@@ -8846,7 +8846,7 @@ class V8_EXPORT TryCatch {
* of the C++ try catch handler itself.
*/
static void* JSStackComparableAddress(TryCatch* handler) {
if (handler == NULL) return NULL;
if (handler == nullptr) return nullptr;
return handler->js_stack_comparable_address_;
}
......@@ -8886,7 +8886,7 @@ class V8_EXPORT TryCatch {
*/
class V8_EXPORT ExtensionConfiguration {
public:
ExtensionConfiguration() : name_count_(0), names_(NULL) { }
ExtensionConfiguration() : name_count_(0), names_(nullptr) {}
ExtensionConfiguration(int name_count, const char* names[])
: name_count_(name_count), names_(names) { }
......@@ -8943,7 +8943,7 @@ class V8_EXPORT Context {
* and only object identify will remain.
*/
static Local<Context> New(
Isolate* isolate, ExtensionConfiguration* extensions = NULL,
Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
MaybeLocal<Value> global_object = MaybeLocal<Value>(),
DeserializeInternalFieldsCallback internal_fields_deserializer =
......@@ -9295,7 +9295,7 @@ Local<T> Local<T>::New(Isolate* isolate, const PersistentBase<T>& that) {
template <class T>
Local<T> Local<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return Local<T>();
if (that == nullptr) return Local<T>();
T* that_ptr = that;
internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
......@@ -9339,7 +9339,7 @@ void* WeakCallbackInfo<T>::GetInternalField(int index) const {
template <class T>
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
if (that == NULL) return NULL;
if (that == nullptr) return nullptr;
internal::Object** p = reinterpret_cast<internal::Object**>(that);
return reinterpret_cast<T*>(
V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
......@@ -9390,7 +9390,7 @@ template <class T>
void PersistentBase<T>::Reset() {
if (this->IsEmpty()) return;
V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
val_ = 0;
val_ = nullptr;
}
......
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