[clang] Use nullptr instead of 0 or NULL (NFC)

Identified with modernize-use-nullptr.
This commit is contained in:
Kazu Hirata 2021-12-29 08:34:20 -08:00
parent 1b329fe282
commit 298367ee6e
10 changed files with 19 additions and 18 deletions

View file

@ -8476,8 +8476,8 @@ static TypedefDecl *CreateHexagonBuiltinVaListDecl(const ASTContext *Context) {
FieldDecl *Field = FieldDecl::Create(
const_cast<ASTContext &>(*Context), VaListTagDecl, SourceLocation(),
SourceLocation(), &Context->Idents.get(FieldNames[i]), FieldTypes[i],
/*TInfo=*/0,
/*BitWidth=*/0,
/*TInfo=*/nullptr,
/*BitWidth=*/nullptr,
/*Mutable=*/false, ICIS_NoInit);
Field->setAccess(AS_public);
VaListTagDecl->addDecl(Field);

View file

@ -194,7 +194,7 @@ void ConstantArrayType::Profile(llvm::FoldingSetNodeID &ID,
ID.AddInteger(ArraySize.getZExtValue());
ID.AddInteger(SizeMod);
ID.AddInteger(TypeQuals);
ID.AddBoolean(SizeExpr != 0);
ID.AddBoolean(SizeExpr != nullptr);
if (SizeExpr)
SizeExpr->Profile(ID, Context, true);
}

View file

@ -1595,9 +1595,9 @@ void CodeGenFunction::EmitBranchToCounterBlock(
if (!InstrumentRegions || !isInstrumentedCondition(Cond))
return EmitBranchOnBoolExpr(Cond, TrueBlock, FalseBlock, TrueCount, LH);
llvm::BasicBlock *ThenBlock = NULL;
llvm::BasicBlock *ElseBlock = NULL;
llvm::BasicBlock *NextBlock = NULL;
llvm::BasicBlock *ThenBlock = nullptr;
llvm::BasicBlock *ElseBlock = nullptr;
llvm::BasicBlock *NextBlock = nullptr;
// Create the block we'll use to increment the appropriate counter.
llvm::BasicBlock *CounterIncrBlock = createBasicBlock("lop.rhscnt");

View file

@ -8693,7 +8693,7 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF,
llvm::ConstantInt::get(CGF.Int32Ty, ArgSize),
"__new_saved_reg_area_pointer");
llvm::Value *UsingStack = 0;
llvm::Value *UsingStack = nullptr;
UsingStack = CGF.Builder.CreateICmpSGT(__new_saved_reg_area_pointer,
__saved_reg_area_end_pointer);

View file

@ -437,7 +437,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
// Enforce -static if -miamcu is present.
if (Args.hasFlag(options::OPT_miamcu, options::OPT_mno_iamcu, false))
DAL->AddFlagArg(0, Opts.getOption(options::OPT_static));
DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_static));
// Add a default value of -mlinker-version=, if one was given and the user
// didn't specify one.

View file

@ -76,7 +76,7 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
const char *Crt1 = "crt1.o";
const char *Entry = NULL;
const char *Entry = nullptr;
// If crt1-command.o exists, it supports new-style commands, so use it.
// Otherwise, use the old crt1.o. This is a temporary transition measure.

View file

@ -256,7 +256,7 @@ IncrementalParser::Parse(llvm::StringRef input) {
/*LoadedOffset=*/0, NewLoc);
// NewLoc only used for diags.
if (PP.EnterSourceFile(FID, /*DirLookup=*/0, NewLoc))
if (PP.EnterSourceFile(FID, /*DirLookup=*/nullptr, NewLoc))
return llvm::make_error<llvm::StringError>("Parsing failed. "
"Cannot enter source file.",
std::error_code());

View file

@ -2548,9 +2548,9 @@ static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr,
assert(CurPtr[0] == '\n' || CurPtr[0] == '\r');
// Position of the first trigraph in the ending sequence.
const char *TrigraphPos = 0;
const char *TrigraphPos = nullptr;
// Position of the first whitespace after a '\' in the ending sequence.
const char *SpacePos = 0;
const char *SpacePos = nullptr;
while (true) {
// Back up off the newline.

View file

@ -2804,7 +2804,8 @@ bool ConditionBRVisitor::patternMatch(const Expr *Ex,
Out << '\''
<< Lexer::getSourceText(
CharSourceRange::getTokenRange(Ex->getSourceRange()),
BRC.getSourceManager(), BRC.getASTContext().getLangOpts(), 0)
BRC.getSourceManager(), BRC.getASTContext().getLangOpts(),
nullptr)
<< '\'';
}

View file

@ -4949,7 +4949,7 @@ CXStringSet *clang_Cursor_getObjCManglings(CXCursor C) {
CXPrintingPolicy clang_getCursorPrintingPolicy(CXCursor C) {
if (clang_Cursor_isNull(C))
return 0;
return nullptr;
return new PrintingPolicy(getCursorContext(C).getPrintingPolicy());
}
@ -6975,16 +6975,16 @@ CXToken *clang_getToken(CXTranslationUnit TU, CXSourceLocation Location) {
if (isNotUsableTU(TU)) {
LOG_BAD_TU(TU);
return NULL;
return nullptr;
}
ASTUnit *CXXUnit = cxtu::getASTUnit(TU);
if (!CXXUnit)
return NULL;
return nullptr;
SourceLocation Begin = cxloc::translateSourceLocation(Location);
if (Begin.isInvalid())
return NULL;
return nullptr;
SourceManager &SM = CXXUnit->getSourceManager();
std::pair<FileID, unsigned> DecomposedEnd = SM.getDecomposedLoc(Begin);
DecomposedEnd.second +=
@ -6997,7 +6997,7 @@ CXToken *clang_getToken(CXTranslationUnit TU, CXSourceLocation Location) {
getTokens(CXXUnit, SourceRange(Begin, End), CXTokens);
if (CXTokens.empty())
return NULL;
return nullptr;
CXTokens.resize(1);
CXToken *Token = static_cast<CXToken *>(llvm::safe_malloc(sizeof(CXToken)));