Skip to content

Commit 82fa9ae

Browse files
committed
[clang-tidy] Run modernize-use-nullptr over JSC
https://bugs.webkit.org/show_bug.cgi?id=211706 Reviewed by Darin Adler. * API/APICallbackFunction.h: * API/JSAPIGlobalObject.h: * API/JSBase.cpp: * API/JSCallbackObjectFunctions.h: * API/JSClassRef.cpp: * API/JSContextRef.cpp: * API/JSObjectRef.cpp: * API/JSScriptRef.cpp: * API/JSValueRef.cpp: * API/JSWeakObjectMapRefPrivate.cpp: * API/tests/ExecutionTimeLimitTest.cpp: * API/tests/PingPongStackOverflowTest.cpp: * assembler/AbstractMacroAssembler.h: * assembler/CPU.cpp: * bytecode/CodeBlock.cpp: * bytecode/DeleteByIdVariant.cpp: * bytecode/GetByIdVariant.cpp: * bytecode/InByIdVariant.cpp: * bytecode/InlineCallFrame.cpp: * bytecode/LazyOperandValueProfile.cpp: * bytecode/PutByIdVariant.cpp: * bytecode/ValueProfile.h: * bytecode/ValueRecovery.cpp: * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: * debugger/DebuggerScope.h: * dfg/DFGAbstractValue.cpp: * dfg/DFGAdjacencyList.h: * dfg/DFGArgumentPosition.h: * dfg/DFGArrayifySlowPathGenerator.h: * dfg/DFGAvailability.h: * dfg/DFGByteCodeParser.cpp: * dfg/DFGCFGSimplificationPhase.cpp: * dfg/DFGCPSRethreadingPhase.cpp: * dfg/DFGCompilationKey.h: * dfg/DFGConstantFoldingPhase.cpp: * dfg/DFGDisassembler.cpp: * dfg/DFGDoubleFormatState.h: * dfg/DFGEdge.h: * dfg/DFGFixupPhase.cpp: * dfg/DFGFrozenValue.cpp: * dfg/DFGGenerationInfo.h: * dfg/DFGGraph.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGIntegerCheckCombiningPhase.cpp: * dfg/DFGLazyJSValue.cpp: * dfg/DFGNode.h: * dfg/DFGOSREntrypointCreationPhase.cpp: * dfg/DFGOSRExit.cpp: * dfg/DFGOperations.cpp: * dfg/DFGSilentRegisterSavePlan.h: * dfg/DFGSpeculativeJIT.cpp: * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT64.cpp: * dfg/DFGStructureAbstractValue.cpp: * dfg/DFGTransition.cpp: * dfg/DFGTypeCheckHoistingPhase.cpp: * dfg/DFGWorklist.cpp: * ftl/FTLAbstractHeapRepository.h: * ftl/FTLAvailableRecovery.h: * ftl/FTLExitValue.cpp: * ftl/FTLFormattedValue.h: * ftl/FTLJITCode.cpp: * ftl/FTLLink.cpp: * ftl/FTLLowerDFGToB3.cpp: * ftl/FTLLoweredNodeValue.h: * ftl/FTLOSREntry.cpp: * ftl/FTLOSRExitCompiler.cpp: * ftl/FTLTypedPointer.h: * ftl/FTLValueFromBlock.h: * ftl/FTLValueRange.h: * heap/GCSegmentedArray.h: * heap/Handle.h: * heap/HandleSet.h: * heap/HandleTypes.h: * heap/HeapSnapshotBuilder.cpp: * heap/MarkedBlockInlines.h: * heap/Strong.h: * heap/WeakImpl.h: * heap/WeakInlines.h: * heap/WeakSet.cpp: * heap/WeakSet.h: * interpreter/CallFrame.cpp: * interpreter/CallFrame.h: * interpreter/Interpreter.cpp: * interpreter/ProtoCallFrame.h: * interpreter/StackVisitor.cpp: * interpreter/StackVisitor.h: * jit/AssemblyHelpers.h: * jit/CCallHelpers.h: * jit/JITCode.cpp: * jit/JITOperations.cpp: * jit/Repatch.cpp: * jit/ThunkGenerators.cpp: * jsc.cpp: * llint/LLIntSlowPaths.cpp: * parser/ASTBuilder.h: * parser/Lexer.cpp: * parser/Lexer.h: * parser/Nodes.cpp: * parser/Nodes.h: * parser/Parser.cpp: * parser/Parser.h: * parser/ParserArena.cpp: * parser/ParserArena.h: * parser/ParserFunctionInfo.h: * parser/SyntaxChecker.h: * parser/UnlinkedSourceCode.h: * profiler/ProfilerBytecodeSequence.cpp: * profiler/ProfilerCompilation.cpp: * profiler/ProfilerDatabase.cpp: * profiler/ProfilerOSRExitSite.cpp: * profiler/ProfilerOriginStack.cpp: * runtime/ArgList.h: * runtime/ArrayPrototype.cpp: * runtime/ClonedArguments.cpp: * runtime/CommonSlowPaths.cpp: * runtime/Completion.h: * runtime/DataView.h: * runtime/DatePrototype.cpp: * runtime/DirectEvalExecutable.cpp: * runtime/DumpContext.cpp: * runtime/FunctionExecutable.cpp: * runtime/IndirectEvalExecutable.cpp: * runtime/JSArray.cpp: * runtime/JSArrayBufferView.cpp: * runtime/JSCJSValue.cpp: * runtime/JSCJSValueInlines.h: * runtime/JSCell.cpp: * runtime/JSDataView.cpp: * runtime/JSDestructibleObject.h: * runtime/JSFunction.cpp: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSONObject.cpp: * runtime/JSObject.cpp: * runtime/JSObject.h: * runtime/JSScope.cpp: * runtime/JSScope.h: * runtime/LiteralParser.cpp: * runtime/OptionsList.h: * runtime/PropertyDescriptor.cpp: * runtime/PropertyMapHashTable.h: * runtime/PropertySlot.h: * runtime/PutPropertySlot.h: * runtime/RegExpMatchesArray.h: * runtime/RegExpPrototype.cpp: * runtime/StringPrototype.cpp: * runtime/Structure.cpp: * runtime/Structure.h: * runtime/TestRunnerUtils.cpp: * runtime/TypedArrayType.cpp: * runtime/VM.cpp: * runtime/Watchdog.cpp: * runtime/Watchdog.h: * runtime/WriteBarrier.h: * testRegExp.cpp: * tools/JSDollarVM.cpp: * wasm/WasmSlowPaths.cpp: * yarr/RegularExpression.h: * yarr/YarrInterpreter.cpp: * yarr/YarrJIT.cpp: * yarr/YarrJIT.h: * yarr/YarrPattern.cpp: * yarr/YarrPattern.h: Canonical link: https://commits.webkit.org/224610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 910bffd commit 82fa9ae

166 files changed

Lines changed: 917 additions & 744 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/APICallbackFunction.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::call(JSGlobalObject* globalObj
5656
for (int i = 0; i < argumentCount; i++)
5757
arguments.uncheckedAppend(toRef(globalObject, callFrame->uncheckedArgument(i)));
5858

59-
JSValueRef exception = 0;
59+
JSValueRef exception = nullptr;
6060
JSValueRef result;
6161
{
6262
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -91,7 +91,7 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::construct(JSGlobalObject* glob
9191
for (size_t i = 0; i < argumentCount; ++i)
9292
arguments.uncheckedAppend(toRef(globalObject, callFrame->uncheckedArgument(i)));
9393

94-
JSValueRef exception = 0;
94+
JSValueRef exception = nullptr;
9595
JSObjectRef result;
9696
{
9797
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -107,7 +107,7 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::construct(JSGlobalObject* glob
107107
return JSValue::encode(toJS(result));
108108
}
109109

110-
return JSValue::encode(toJS(JSObjectMake(ctx, jsCast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
110+
return JSValue::encode(toJS(JSObjectMake(ctx, jsCast<JSCallbackConstructor*>(constructor)->classRef(), nullptr)));
111111
}
112112

113113
} // namespace JSC

‎Source/JavaScriptCore/API/JSAPIGlobalObject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class JSAPIGlobalObject final : public JSGlobalObject {
5454

5555
static Structure* createStructure(VM& vm, JSValue prototype)
5656
{
57-
auto* result = Structure::create(vm, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
57+
auto* result = Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
5858
result->setTransitionWatchpointIsLikelyToBeFired(true);
5959
return result;
6060
}

‎Source/JavaScriptCore/API/JSBase.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ JSObjectRef JSGetMemoryUsageStatistics(JSContextRef ctx)
193193
{
194194
if (!ctx) {
195195
ASSERT_NOT_REACHED();
196-
return 0;
196+
return nullptr;
197197
}
198198

199199
JSGlobalObject* globalObject = toJS(ctx);

‎Source/JavaScriptCore/API/JSCallbackObjectFunctions.h‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool JSCallbackObject<Parent>::getOwnPropertySlot(JSObject* object, JSGlobalObje
175175
} else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
176176
if (!propertyNameRef)
177177
propertyNameRef = OpaqueJSString::tryCreate(name);
178-
JSValueRef exception = 0;
178+
JSValueRef exception = nullptr;
179179
JSValueRef value;
180180
{
181181
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -234,7 +234,7 @@ JSValue JSCallbackObject<Parent>::defaultValue(const JSObject* object, JSGlobalO
234234

235235
for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
236236
if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
237-
JSValueRef exception = 0;
237+
JSValueRef exception = nullptr;
238238
JSValueRef result = convertToType(ctx, thisRef, jsHint, &exception);
239239
if (exception) {
240240
throwException(globalObject, scope, toJS(globalObject, exception));
@@ -265,7 +265,7 @@ bool JSCallbackObject<Parent>::put(JSCell* cell, JSGlobalObject* globalObject, P
265265
if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) {
266266
if (!propertyNameRef)
267267
propertyNameRef = OpaqueJSString::tryCreate(name);
268-
JSValueRef exception = 0;
268+
JSValueRef exception = nullptr;
269269
bool result;
270270
{
271271
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -282,7 +282,7 @@ bool JSCallbackObject<Parent>::put(JSCell* cell, JSGlobalObject* globalObject, P
282282
if (entry->attributes & kJSPropertyAttributeReadOnly)
283283
return false;
284284
if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
285-
JSValueRef exception = 0;
285+
JSValueRef exception = nullptr;
286286
bool result;
287287
{
288288
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -329,7 +329,7 @@ bool JSCallbackObject<Parent>::putByIndex(JSCell* cell, JSGlobalObject* globalOb
329329
if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) {
330330
if (!propertyNameRef)
331331
propertyNameRef = OpaqueJSString::tryCreate(propertyName.impl());
332-
JSValueRef exception = 0;
332+
JSValueRef exception = nullptr;
333333
bool result;
334334
{
335335
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -346,7 +346,7 @@ bool JSCallbackObject<Parent>::putByIndex(JSCell* cell, JSGlobalObject* globalOb
346346
if (entry->attributes & kJSPropertyAttributeReadOnly)
347347
return false;
348348
if (JSObjectSetPropertyCallback setProperty = entry->setProperty) {
349-
JSValueRef exception = 0;
349+
JSValueRef exception = nullptr;
350350
bool result;
351351
{
352352
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -388,7 +388,7 @@ bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, JSGlobalObject* glob
388388
if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) {
389389
if (!propertyNameRef)
390390
propertyNameRef = OpaqueJSString::tryCreate(name);
391-
JSValueRef exception = 0;
391+
JSValueRef exception = nullptr;
392392
bool result;
393393
{
394394
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -461,7 +461,7 @@ EncodedJSValue JSCallbackObject<Parent>::construct(JSGlobalObject* globalObject,
461461
arguments.reserveInitialCapacity(argumentCount);
462462
for (size_t i = 0; i < argumentCount; ++i)
463463
arguments.uncheckedAppend(toRef(globalObject, callFrame->uncheckedArgument(i)));
464-
JSValueRef exception = 0;
464+
JSValueRef exception = nullptr;
465465
JSObject* result;
466466
{
467467
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -492,7 +492,7 @@ bool JSCallbackObject<Parent>::customHasInstance(JSObject* object, JSGlobalObjec
492492
for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
493493
if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
494494
JSValueRef valueRef = toRef(globalObject, value);
495-
JSValueRef exception = 0;
495+
JSValueRef exception = nullptr;
496496
bool result;
497497
{
498498
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -538,7 +538,7 @@ EncodedJSValue JSCallbackObject<Parent>::call(JSGlobalObject* globalObject, Call
538538
arguments.reserveInitialCapacity(argumentCount);
539539
for (size_t i = 0; i < argumentCount; ++i)
540540
arguments.uncheckedAppend(toRef(globalObject, callFrame->uncheckedArgument(i)));
541-
JSValueRef exception = 0;
541+
JSValueRef exception = nullptr;
542542
JSValue result;
543543
{
544544
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -635,7 +635,7 @@ JSValue JSCallbackObject<Parent>::getStaticValue(JSGlobalObject* globalObject, P
635635
if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(globalObject)) {
636636
if (StaticValueEntry* entry = staticValues->get(name)) {
637637
if (JSObjectGetPropertyCallback getProperty = entry->getProperty) {
638-
JSValueRef exception = 0;
638+
JSValueRef exception = nullptr;
639639
JSValueRef value;
640640
{
641641
JSLock::DropAllLocks dropAllLocks(globalObject);
@@ -702,7 +702,7 @@ EncodedJSValue JSCallbackObject<Parent>::callbackGetter(JSGlobalObject* globalOb
702702
if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) {
703703
if (!propertyNameRef)
704704
propertyNameRef = OpaqueJSString::tryCreate(name);
705-
JSValueRef exception = 0;
705+
JSValueRef exception = nullptr;
706706
JSValueRef value;
707707
{
708708
JSLock::DropAllLocks dropAllLocks(globalObject);

‎Source/JavaScriptCore/API/JSClassRef.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838

3939
using namespace JSC;
4040

41-
const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
41+
const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
4242

4343
OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass)
4444
: parentClass(definition->parentClass)
45-
, prototypeClass(0)
45+
, prototypeClass(nullptr)
4646
, initialize(definition->initialize)
4747
, finalize(definition->finalize)
4848
, hasProperty(definition->hasProperty)
@@ -107,20 +107,20 @@ OpaqueJSClass::~OpaqueJSClass()
107107

108108
Ref<OpaqueJSClass> OpaqueJSClass::createNoAutomaticPrototype(const JSClassDefinition* definition)
109109
{
110-
return adoptRef(*new OpaqueJSClass(definition, 0));
110+
return adoptRef(*new OpaqueJSClass(definition, nullptr));
111111
}
112112

113113
Ref<OpaqueJSClass> OpaqueJSClass::create(const JSClassDefinition* clientDefinition)
114114
{
115115
JSClassDefinition definition = *clientDefinition; // Avoid modifying client copy.
116116

117117
JSClassDefinition protoDefinition = kJSClassDefinitionEmpty;
118-
protoDefinition.finalize = 0;
118+
protoDefinition.finalize = nullptr;
119119
std::swap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype.
120120

121121
// We are supposed to use JSClassRetain/Release but since we know that we currently have
122122
// the only reference to this class object we cheat and use a RefPtr instead.
123-
RefPtr<OpaqueJSClass> protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0));
123+
RefPtr<OpaqueJSClass> protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, nullptr));
124124
return adoptRef(*new OpaqueJSClass(&definition, protoClass.get()));
125125
}
126126

@@ -182,7 +182,7 @@ JSObject* OpaqueJSClass::prototype(JSGlobalObject* globalObject)
182182
*/
183183

184184
if (!prototypeClass)
185-
return 0;
185+
return nullptr;
186186

187187
OpaqueJSClassContextData& jsClassData = contextData(globalObject);
188188

‎Source/JavaScriptCore/API/JSContextRef.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
128128
}
129129
#endif // OS(DARWIN)
130130

131-
return JSGlobalContextCreateInGroup(0, globalObjectClass);
131+
return JSGlobalContextCreateInGroup(nullptr, globalObjectClass);
132132
}
133133

134134
JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass)
@@ -148,7 +148,7 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass
148148
return JSGlobalContextRetain(toGlobalRef(globalObject));
149149
}
150150

151-
JSGlobalObject* globalObject = JSCallbackObject<JSGlobalObject>::create(vm.get(), globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(vm.get(), 0, jsNull()));
151+
JSGlobalObject* globalObject = JSCallbackObject<JSGlobalObject>::create(vm.get(), globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(vm.get(), nullptr, jsNull()));
152152
JSValue prototype = globalObjectClass->prototype(globalObject);
153153
if (!prototype)
154154
prototype = jsNull();
@@ -187,7 +187,7 @@ JSObjectRef JSContextGetGlobalObject(JSContextRef ctx)
187187
{
188188
if (!ctx) {
189189
ASSERT_NOT_REACHED();
190-
return 0;
190+
return nullptr;
191191
}
192192
JSGlobalObject* globalObject = toJS(ctx);
193193
VM& vm = globalObject->vm();
@@ -200,7 +200,7 @@ JSContextGroupRef JSContextGetGroup(JSContextRef ctx)
200200
{
201201
if (!ctx) {
202202
ASSERT_NOT_REACHED();
203-
return 0;
203+
return nullptr;
204204
}
205205
JSGlobalObject* globalObject = toJS(ctx);
206206
return toRef(&globalObject->vm());
@@ -210,7 +210,7 @@ JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx)
210210
{
211211
if (!ctx) {
212212
ASSERT_NOT_REACHED();
213-
return 0;
213+
return nullptr;
214214
}
215215
JSGlobalObject* globalObject = toJS(ctx);
216216
JSLockHolder locker(globalObject);
@@ -222,7 +222,7 @@ JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
222222
{
223223
if (!ctx) {
224224
ASSERT_NOT_REACHED();
225-
return 0;
225+
return nullptr;
226226
}
227227

228228
JSGlobalObject* globalObject = toJS(ctx);
@@ -231,7 +231,7 @@ JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
231231

232232
String name = globalObject->name();
233233
if (name.isNull())
234-
return 0;
234+
return nullptr;
235235

236236
return OpaqueJSString::tryCreate(name).leakRef();
237237
}
@@ -324,7 +324,7 @@ JSStringRef JSContextCreateBacktrace(JSContextRef ctx, unsigned maxStackSize)
324324
{
325325
if (!ctx) {
326326
ASSERT_NOT_REACHED();
327-
return 0;
327+
return nullptr;
328328
}
329329
JSGlobalObject* globalObject = toJS(ctx);
330330
VM& vm = globalObject->vm();

0 commit comments

Comments
 (0)