summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index d88d1ca99f1..d335c94861f 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -661,7 +661,8 @@ static void EmitBlockID(unsigned ID, const char *Name,
Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
// Emit the block name if present.
- if (Name == 0 || Name[0] == 0) return;
+ if (!Name || Name[0] == 0)
+ return;
Record.clear();
while (*Name)
Record.push_back(*Name++);
@@ -3001,7 +3002,7 @@ class ASTIdentifierTableTrait {
if (MacroDirective *NextMD = getPublicSubmoduleMacro(MD, ModID, Overridden))
if (!shouldIgnoreMacro(NextMD, IsModule, PP))
return NextMD;
- return 0;
+ return nullptr;
}
MacroDirective *
@@ -3011,7 +3012,7 @@ class ASTIdentifierTableTrait {
getPublicSubmoduleMacro(MD->getPrevious(), ModID, Overridden))
if (!shouldIgnoreMacro(NextMD, IsModule, PP))
return NextMD;
- return 0;
+ return nullptr;
}
/// \brief Traverses the macro directives history and returns the latest
@@ -3027,7 +3028,7 @@ class ASTIdentifierTableTrait {
SubmoduleID &ModID,
OverriddenList &Overridden) {
if (!MD)
- return 0;
+ return nullptr;
Overridden.clear();
SubmoduleID OrigModID = ModID;
@@ -3083,7 +3084,7 @@ class ASTIdentifierTableTrait {
}
}
- return 0;
+ return nullptr;
}
SubmoduleID getSubmoduleID(MacroDirective *MD) {
@@ -3112,7 +3113,7 @@ public:
EmitKeyDataLength(raw_ostream& Out, IdentifierInfo* II, IdentID ID) {
unsigned KeyLen = II->getLength() + 1;
unsigned DataLen = 4; // 4 bytes for the persistent ID << 1
- MacroDirective *Macro = 0;
+ MacroDirective *Macro = nullptr;
if (isInterestingIdentifier(II, Macro)) {
DataLen += 2; // 2 bytes for builtin ID
DataLen += 2; // 2 bytes for flags
@@ -3175,7 +3176,7 @@ public:
IdentID ID, unsigned) {
using namespace llvm::support;
endian::Writer<little> LE(Out);
- MacroDirective *Macro = 0;
+ MacroDirective *Macro = nullptr;
if (!isInterestingIdentifier(II, Macro)) {
LE.write<uint32_t>(ID << 1);
return;
@@ -3922,8 +3923,8 @@ void ASTWriter::SetSelectorOffset(Selector Sel, uint32_t Offset) {
}
ASTWriter::ASTWriter(llvm::BitstreamWriter &Stream)
- : Stream(Stream), Context(0), PP(0), Chain(0), WritingModule(0),
- WritingAST(false), DoneWritingDeclsAndTypes(false),
+ : Stream(Stream), Context(nullptr), PP(nullptr), Chain(nullptr),
+ WritingModule(nullptr), WritingAST(false), DoneWritingDeclsAndTypes(false),
ASTHasCompilerErrors(false),
FirstDeclID(NUM_PREDEF_DECL_IDS), NextDeclID(FirstDeclID),
FirstTypeID(NUM_PREDEF_TYPE_IDS), NextTypeID(FirstTypeID),
@@ -3970,18 +3971,18 @@ void ASTWriter::WriteAST(Sema &SemaRef,
PP = &SemaRef.PP;
this->WritingModule = WritingModule;
WriteASTCore(SemaRef, isysroot, OutputFile, WritingModule);
- Context = 0;
- PP = 0;
- this->WritingModule = 0;
-
+ Context = nullptr;
+ PP = nullptr;
+ this->WritingModule = nullptr;
+
WritingAST = false;
}
template<typename Vector>
static void AddLazyVectorDecls(ASTWriter &Writer, Vector &Vec,
ASTWriter::RecordData &Record) {
- for (typename Vector::iterator I = Vec.begin(0, true), E = Vec.end();
- I != E; ++I) {
+ for (typename Vector::iterator I = Vec.begin(nullptr, true), E = Vec.end();
+ I != E; ++I) {
Writer.AddDeclRef(*I, Record);
}
}
@@ -3992,7 +3993,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
Module *WritingModule) {
using namespace llvm;
- bool isModule = WritingModule != 0;
+ bool isModule = WritingModule != nullptr;
// Make sure that the AST reader knows to finalize itself.
if (Chain)
@@ -4631,7 +4632,7 @@ void ASTWriter::AddIdentifierRef(const IdentifierInfo *II, RecordDataImpl &Recor
}
IdentID ASTWriter::getIdentifierRef(const IdentifierInfo *II) {
- if (II == 0)
+ if (!II)
return 0;
IdentID &ID = IdentifierIDs[II];
@@ -4644,7 +4645,7 @@ MacroID ASTWriter::getMacroRef(MacroInfo *MI, const IdentifierInfo *Name) {
// Don't emit builtin macros like __LINE__ to the AST file unless they
// have been redefined by the header (in which case they are not
// isBuiltinMacro).
- if (MI == 0 || MI->isBuiltinMacro())
+ if (!MI || MI->isBuiltinMacro())
return 0;
MacroID &ID = MacroIDs[MI];
@@ -4657,7 +4658,7 @@ MacroID ASTWriter::getMacroRef(MacroInfo *MI, const IdentifierInfo *Name) {
}
MacroID ASTWriter::getMacroID(MacroInfo *MI) {
- if (MI == 0 || MI->isBuiltinMacro())
+ if (!MI || MI->isBuiltinMacro())
return 0;
assert(MacroIDs.find(MI) != MacroIDs.end() && "Macro not emitted!");
@@ -4674,7 +4675,7 @@ void ASTWriter::AddSelectorRef(const Selector SelRef, RecordDataImpl &Record) {
}
SelectorID ASTWriter::getSelectorRef(Selector Sel) {
- if (Sel.getAsOpaquePtr() == 0) {
+ if (Sel.getAsOpaquePtr() == nullptr) {
return 0;
}
@@ -4752,7 +4753,7 @@ void ASTWriter::AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg,
void ASTWriter::AddTypeSourceInfo(TypeSourceInfo *TInfo,
RecordDataImpl &Record) {
- if (TInfo == 0) {
+ if (!TInfo) {
AddTypeRef(QualType(), Record);
return;
}
@@ -4820,8 +4821,8 @@ void ASTWriter::AddDeclRef(const Decl *D, RecordDataImpl &Record) {
DeclID ASTWriter::GetDeclRef(const Decl *D) {
assert(WritingAST && "Cannot request a declaration ID before AST writing");
-
- if (D == 0) {
+
+ if (!D) {
return 0;
}
@@ -4848,7 +4849,7 @@ DeclID ASTWriter::GetDeclRef(const Decl *D) {
}
DeclID ASTWriter::getDeclID(const Decl *D) {
- if (D == 0)
+ if (!D)
return 0;
// If D comes from an AST file, its declaration ID is already known and
@@ -5380,7 +5381,7 @@ void ASTWriter::AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Rec
case LCK_ByCopy:
case LCK_ByRef:
VarDecl *Var =
- Capture.capturesVariable() ? Capture.getCapturedVar() : 0;
+ Capture.capturesVariable() ? Capture.getCapturedVar() : nullptr;
AddDeclRef(Var, Record);
AddSourceLocation(Capture.isPackExpansion() ? Capture.getEllipsisLoc()
: SourceLocation(),
OpenPOWER on IntegriCloud