summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-05-06 06:48:52 +0000
committerCraig Topper <craig.topper@gmail.com>2014-05-06 06:48:52 +0000
commit9ee9b9e17b10ebd599850bfc65e088d9da839a57 (patch)
treeeee1e50fbd5084245e8784a6f20fc492da41fbf0
parente539c80b7c1a54b4df0cc53999e676ab4f14271f (diff)
[C++11] Use 'nullptr'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208063 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/ARCMigrate/ARCMT.h2
-rw-r--r--include/clang/AST/APValue.h2
-rw-r--r--include/clang/AST/ASTConsumer.h4
-rw-r--r--include/clang/AST/ASTContext.h23
-rw-r--r--include/clang/AST/ASTImporter.h2
-rw-r--r--include/clang/AST/ASTTypeTraits.h10
-rw-r--r--include/clang/AST/ASTVector.h8
-rw-r--r--include/clang/AST/AttrIterator.h4
-rw-r--r--include/clang/AST/CXXInheritance.h7
-rw-r--r--include/clang/AST/Comment.h28
-rw-r--r--include/clang/AST/CommentLexer.h2
-rw-r--r--include/clang/AST/CommentSema.h4
-rw-r--r--include/clang/AST/Decl.h70
-rw-r--r--include/clang/AST/DeclBase.h34
-rw-r--r--include/clang/AST/DeclCXX.h42
-rw-r--r--include/clang/AST/DeclContextInternals.h12
-rw-r--r--include/clang/AST/DeclFriend.h4
-rw-r--r--include/clang/AST/DeclGroup.h12
-rw-r--r--include/clang/AST/DeclObjC.h55
-rw-r--r--include/clang/AST/DeclTemplate.h48
-rw-r--r--include/clang/AST/DeclarationName.h8
-rw-r--r--include/clang/AST/DependentDiagnostic.h2
-rw-r--r--include/clang/AST/Expr.h88
-rw-r--r--include/clang/AST/ExprCXX.h65
-rw-r--r--include/clang/AST/ExprObjC.h14
-rw-r--r--include/clang/AST/ExternalASTSource.h6
-rw-r--r--include/clang/AST/NestedNameSpecifier.h14
-rw-r--r--include/clang/AST/OpenMPClause.h6
-rw-r--r--include/clang/AST/ParentMap.h2
-rw-r--r--include/clang/AST/Redeclarable.h8
-rw-r--r--include/clang/AST/Stmt.h38
-rw-r--r--include/clang/AST/StmtCXX.h2
-rw-r--r--include/clang/AST/StmtIterator.h4
-rw-r--r--include/clang/AST/StmtObjC.h6
-rw-r--r--include/clang/AST/TemplateBase.h2
-rw-r--r--include/clang/AST/TemplateName.h12
-rw-r--r--include/clang/AST/Type.h34
-rw-r--r--include/clang/AST/TypeLoc.h14
-rw-r--r--include/clang/AST/VTableBuilder.h8
-rw-r--r--include/clang/ASTMatchers/ASTMatchFinder.h2
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h46
-rw-r--r--include/clang/ASTMatchers/ASTMatchersInternal.h6
-rw-r--r--include/clang/ASTMatchers/Dynamic/VariantValue.h2
-rw-r--r--include/clang/Analysis/Analyses/Consumed.h4
-rw-r--r--include/clang/Analysis/Analyses/Dominators.h2
-rw-r--r--include/clang/Analysis/Analyses/FormatString.h20
-rw-r--r--include/clang/Analysis/Analyses/LiveVariables.h2
-rw-r--r--include/clang/Analysis/Analyses/PostOrderCFGView.h2
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafety.h2
-rw-r--r--include/clang/Analysis/Analyses/ThreadSafetyCommon.h3
-rw-r--r--include/clang/Analysis/AnalysisContext.h5
-rw-r--r--include/clang/Analysis/CFG.h30
-rw-r--r--include/clang/Analysis/ProgramPoint.h69
-rw-r--r--include/clang/Analysis/Support/BumpVector.h2
-rw-r--r--include/clang/Basic/ABI.h8
-rw-r--r--include/clang/Basic/Builtins.h20
-rw-r--r--include/clang/Basic/Diagnostic.h12
-rw-r--r--include/clang/Basic/FileManager.h10
-rw-r--r--include/clang/Basic/FileSystemStatCache.h2
-rw-r--r--include/clang/Basic/IdentifierTable.h4
-rw-r--r--include/clang/Basic/Module.h6
-rw-r--r--include/clang/Basic/PartialDiagnostic.h16
-rw-r--r--include/clang/Basic/SourceLocation.h22
-rw-r--r--include/clang/Basic/SourceManager.h92
-rw-r--r--include/clang/Basic/TargetInfo.h4
-rw-r--r--include/clang/Basic/VirtualFileSystem.h2
-rw-r--r--include/clang/CodeGen/CodeGenAction.h14
-rw-r--r--include/clang/Driver/Driver.h2
-rw-r--r--include/clang/Driver/ToolChain.h2
-rw-r--r--include/clang/Driver/Types.def22
-rw-r--r--include/clang/Edit/Commit.h8
-rw-r--r--include/clang/Edit/EditedSource.h2
-rw-r--r--include/clang/Frontend/ASTUnit.h21
-rw-r--r--include/clang/Frontend/CompilerInstance.h22
-rw-r--r--include/clang/Frontend/CompilerInvocation.h2
-rw-r--r--include/clang/Frontend/DiagnosticRenderer.h2
-rw-r--r--include/clang/Frontend/FrontendAction.h3
-rw-r--r--include/clang/Frontend/FrontendActions.h2
-rw-r--r--include/clang/Frontend/FrontendOptions.h8
-rw-r--r--include/clang/Frontend/Utils.h4
-rw-r--r--include/clang/Lex/DirectoryLookup.h10
-rw-r--r--include/clang/Lex/HeaderSearch.h2
-rw-r--r--include/clang/Lex/Lexer.h17
-rw-r--r--include/clang/Lex/LiteralSupport.h3
-rw-r--r--include/clang/Lex/MacroArgs.h5
-rw-r--r--include/clang/Lex/MacroInfo.h16
-rw-r--r--include/clang/Lex/ModuleMap.h8
-rw-r--r--include/clang/Lex/MultipleIncludeOpt.h10
-rw-r--r--include/clang/Lex/Pragma.h2
-rw-r--r--include/clang/Lex/PreprocessingRecord.h2
-rw-r--r--include/clang/Lex/Preprocessor.h35
-rw-r--r--include/clang/Lex/PreprocessorLexer.h2
-rw-r--r--include/clang/Lex/Token.h4
-rw-r--r--include/clang/Lex/TokenLexer.h4
-rw-r--r--include/clang/Parse/ParseAST.h2
-rw-r--r--include/clang/Parse/Parser.h120
-rw-r--r--include/clang/Rewrite/Core/HTMLRewrite.h2
-rw-r--r--include/clang/Rewrite/Core/RewriteRope.h9
-rw-r--r--include/clang/Rewrite/Core/Rewriter.h4
-rw-r--r--include/clang/Rewrite/Frontend/FixItRewriter.h4
-rw-r--r--include/clang/Sema/AttributeList.h30
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h31
-rw-r--r--include/clang/Sema/DeclSpec.h44
-rw-r--r--include/clang/Sema/DelayedDiagnostic.h2
-rw-r--r--include/clang/Sema/IdentifierResolver.h2
-rw-r--r--include/clang/Sema/Initialization.h29
-rw-r--r--include/clang/Sema/Lookup.h26
-rw-r--r--include/clang/Sema/MultiplexExternalSemaSource.h2
-rw-r--r--include/clang/Sema/ObjCMethodList.h2
-rw-r--r--include/clang/Sema/Overload.h2
-rw-r--r--include/clang/Sema/Ownership.h4
-rw-r--r--include/clang/Sema/ParsedTemplate.h4
-rw-r--r--include/clang/Sema/ScopeInfo.h10
-rw-r--r--include/clang/Sema/Sema.h223
-rw-r--r--include/clang/Sema/SemaInternal.h2
-rw-r--r--include/clang/Sema/Template.h22
-rw-r--r--include/clang/Sema/TemplateDeduction.h5
-rw-r--r--include/clang/Sema/TypoCorrection.h18
-rw-r--r--include/clang/Sema/Weak.h2
-rw-r--r--include/clang/Serialization/ASTReader.h10
-rw-r--r--include/clang/Serialization/ASTWriter.h2
-rw-r--r--include/clang/Serialization/ModuleManager.h4
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h15
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h31
-rw-r--r--include/clang/StaticAnalyzer/Core/Checker.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h22
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h22
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h14
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h12
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h19
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h12
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h8
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h4
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h6
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/Store.h3
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h2
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h10
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h2
-rw-r--r--include/clang/Tooling/CommonOptionsParser.h2
-rw-r--r--include/clang/Tooling/Tooling.h6
145 files changed, 1118 insertions, 1052 deletions
diff --git a/include/clang/ARCMigrate/ARCMT.h b/include/clang/ARCMigrate/ARCMT.h
index 196f6c0b73..ad4f23c604 100644
--- a/include/clang/ARCMigrate/ARCMT.h
+++ b/include/clang/ARCMigrate/ARCMT.h
@@ -113,7 +113,7 @@ public:
virtual void remove(CharSourceRange range) { }
};
- bool applyTransform(TransformFn trans, RewriteListener *listener = 0);
+ bool applyTransform(TransformFn trans, RewriteListener *listener = nullptr);
FileRemapper &getRemapper() { return Remapper; }
};
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h
index 079f25e7f1..e58c21923f 100644
--- a/include/clang/AST/APValue.h
+++ b/include/clang/AST/APValue.h
@@ -80,7 +80,7 @@ private:
struct Vec {
APValue *Elts;
unsigned NumElts;
- Vec() : Elts(0), NumElts(0) {}
+ Vec() : Elts(nullptr), NumElts(0) {}
~Vec() { delete[] Elts; }
};
struct Arr {
diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h
index 45d3067136..fde114711b 100644
--- a/include/clang/AST/ASTConsumer.h
+++ b/include/clang/AST/ASTConsumer.h
@@ -135,12 +135,12 @@ public:
/// \brief If the consumer is interested in entities getting modified after
/// their initial creation, it should return a pointer to
/// an ASTMutationListener here.
- virtual ASTMutationListener *GetASTMutationListener() { return 0; }
+ virtual ASTMutationListener *GetASTMutationListener() { return nullptr; }
/// \brief If the consumer is interested in entities being deserialized from
/// AST files, it should return a pointer to a ASTDeserializationListener here
virtual ASTDeserializationListener *GetASTDeserializationListener() {
- return 0;
+ return nullptr;
}
/// PrintStats - If desired, print any statistics.
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 21017fcb3d..70c3d5bbad 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -603,9 +603,9 @@ public:
///
/// \param OriginalDecl if not NULL, is set to declaration AST node that had
/// the comment, if the comment we found comes from a redeclaration.
- const RawComment *getRawCommentForAnyRedecl(
- const Decl *D,
- const Decl **OriginalDecl = NULL) const;
+ const RawComment *
+ getRawCommentForAnyRedecl(const Decl *D,
+ const Decl **OriginalDecl = nullptr) const;
/// Return parsed documentation comment attached to a given declaration.
/// Returns NULL if no comment is attached.
@@ -1058,7 +1058,7 @@ public:
/// \brief Return the unique reference to the type for the specified type
/// declaration.
QualType getTypeDeclType(const TypeDecl *Decl,
- const TypeDecl *PrevDecl = 0) const {
+ const TypeDecl *PrevDecl = nullptr) const {
assert(Decl && "Passed null for Decl param");
if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
@@ -1092,9 +1092,10 @@ public:
const TemplateTypeParmType *Replaced,
const TemplateArgument &ArgPack);
- QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
- bool ParameterPack,
- TemplateTypeParmDecl *ParmDecl = 0) const;
+ QualType
+ getTemplateTypeParmType(unsigned Depth, unsigned Index,
+ bool ParameterPack,
+ TemplateTypeParmDecl *ParmDecl = nullptr) const;
QualType getTemplateSpecializationType(TemplateName T,
const TemplateArgument *Args,
@@ -1138,7 +1139,7 @@ public:
Optional<unsigned> NumExpansions);
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
- ObjCInterfaceDecl *PrevDecl = 0) const;
+ ObjCInterfaceDecl *PrevDecl = nullptr) const;
QualType getObjCObjectType(QualType Base,
ObjCProtocolDecl * const *Protocols,
@@ -1368,7 +1369,7 @@ public:
///
/// If \p Field is specified then record field names are also encoded.
void getObjCEncodingForType(QualType T, std::string &S,
- const FieldDecl *Field=0) const;
+ const FieldDecl *Field=nullptr) const;
void getLegacyIntegralTypeEncoding(QualType &t) const;
@@ -1570,7 +1571,7 @@ public:
/// arguments to the builtin that are required to be integer constant
/// expressions.
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error,
- unsigned *IntegerConstantArgs = 0) const;
+ unsigned *IntegerConstantArgs = nullptr) const;
private:
CanQualType getFromTargetType(unsigned Type) const;
@@ -2038,7 +2039,7 @@ public:
const FunctionProtoType *ToFunctionType);
void ResetObjCLayout(const ObjCContainerDecl *CD) {
- ObjCLayouts[CD] = 0;
+ ObjCLayouts[CD] = nullptr;
}
//===--------------------------------------------------------------------===//
diff --git a/include/clang/AST/ASTImporter.h b/include/clang/AST/ASTImporter.h
index b74c8ee1bf..a335f980e6 100644
--- a/include/clang/AST/ASTImporter.h
+++ b/include/clang/AST/ASTImporter.h
@@ -278,7 +278,7 @@ namespace clang {
/// happens especially for anonymous structs. If the original of the second
/// RecordDecl can be found, we can complete it without the need for
/// importation, eliminating this loop.
- virtual Decl *GetOriginalDecl(Decl *To) { return NULL; }
+ virtual Decl *GetOriginalDecl(Decl *To) { return nullptr; }
/// \brief Determine whether the given types are structurally
/// equivalent.
diff --git a/include/clang/AST/ASTTypeTraits.h b/include/clang/AST/ASTTypeTraits.h
index abc88571eb..0e06e26e6d 100644
--- a/include/clang/AST/ASTTypeTraits.h
+++ b/include/clang/AST/ASTTypeTraits.h
@@ -59,7 +59,7 @@ public:
/// \brief Returns \c true if \c this is a base kind of (or same as) \c Other.
/// \param Distance If non-null, used to return the distance between \c this
/// and \c Other in the class hierarchy.
- bool isBaseOf(ASTNodeKind Other, unsigned *Distance = 0) const;
+ bool isBaseOf(ASTNodeKind Other, unsigned *Distance = nullptr) const;
/// \brief String representation of the kind.
StringRef asStringRef() const;
@@ -237,7 +237,7 @@ private:
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<BaseT>().isBaseOf(NodeKind))
return dyn_cast<T>(*reinterpret_cast<BaseT *const *>(Storage));
- return NULL;
+ return nullptr;
}
static DynTypedNode create(const BaseT &Node) {
DynTypedNode Result;
@@ -252,7 +252,7 @@ private:
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
return *reinterpret_cast<T *const *>(Storage);
- return NULL;
+ return nullptr;
}
static DynTypedNode create(const T &Node) {
DynTypedNode Result;
@@ -267,7 +267,7 @@ private:
static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
return reinterpret_cast<const T *>(Storage);
- return NULL;
+ return nullptr;
}
static DynTypedNode create(const T &Node) {
DynTypedNode Result;
@@ -355,7 +355,7 @@ inline const void *DynTypedNode::getMemoizationData() const {
} else if (ASTNodeKind::getFromNodeKind<NestedNameSpecifier>().isBaseOf(NodeKind)) {
return BaseConverter<NestedNameSpecifier>::get(NodeKind, Storage.buffer);
}
- return NULL;
+ return nullptr;
}
} // end namespace ast_type_traits
diff --git a/include/clang/AST/ASTVector.h b/include/clang/AST/ASTVector.h
index 1490a13f84..d92167e959 100644
--- a/include/clang/AST/ASTVector.h
+++ b/include/clang/AST/ASTVector.h
@@ -45,16 +45,16 @@ protected:
public:
// Default ctor - Initialize to empty.
- ASTVector() : Begin(0), End(0), Capacity(0, false) {}
+ ASTVector() : Begin(nullptr), End(nullptr), Capacity(nullptr, false) {}
ASTVector(ASTVector &&O) : Begin(O.Begin), End(O.End), Capacity(O.Capacity) {
- O.Begin = O.End = 0;
- O.Capacity.setPointer(0);
+ O.Begin = O.End = nullptr;
+ O.Capacity.setPointer(nullptr);
O.Capacity.setInt(false);
}
ASTVector(const ASTContext &C, unsigned N)
- : Begin(0), End(0), Capacity(0, false) {
+ : Begin(nullptr), End(nullptr), Capacity(nullptr, false) {
reserve(C, N);
}
diff --git a/include/clang/AST/AttrIterator.h b/include/clang/AST/AttrIterator.h
index 4ecf98fe0b..39ee81f120 100644
--- a/include/clang/AST/AttrIterator.h
+++ b/include/clang/AST/AttrIterator.h
@@ -98,7 +98,7 @@ public:
friend bool operator==(specific_attr_iterator Left,
specific_attr_iterator Right) {
- assert((Left.Current == 0) == (Right.Current == 0));
+ assert((Left.Current == nullptr) == (Right.Current == nullptr));
if (Left.Current < Right.Current)
Left.AdvanceToNext(Right.Current);
else
@@ -134,7 +134,7 @@ inline SpecificAttr *getSpecificAttr(const Container& container) {
if (i != specific_attr_end<SpecificAttr>(container))
return *i;
else
- return 0;
+ return nullptr;
}
} // end namespace clang
diff --git a/include/clang/AST/CXXInheritance.h b/include/clang/AST/CXXInheritance.h
index 3c7b7f03a0..37f6748ace 100644
--- a/include/clang/AST/CXXInheritance.h
+++ b/include/clang/AST/CXXInheritance.h
@@ -177,8 +177,8 @@ public:
bool RecordPaths = true,
bool DetectVirtual = true)
: FindAmbiguities(FindAmbiguities), RecordPaths(RecordPaths),
- DetectVirtual(DetectVirtual), DetectedVirtual(0), DeclsFound(0),
- NumDeclsFound(0) { }
+ DetectVirtual(DetectVirtual), DetectedVirtual(nullptr),
+ DeclsFound(nullptr), NumDeclsFound(0) { }
~CXXBasePaths() { delete [] DeclsFound; }
@@ -232,7 +232,8 @@ public:
/// \brief Uniquely identifies a virtual method within a class
/// hierarchy by the method itself and a class subobject number.
struct UniqueVirtualMethod {
- UniqueVirtualMethod() : Method(0), Subobject(0), InVirtualSubobject(0) { }
+ UniqueVirtualMethod()
+ : Method(nullptr), Subobject(0), InVirtualSubobject(nullptr) { }
UniqueVirtualMethod(CXXMethodDecl *Method, unsigned Subobject,
const CXXRecordDecl *InVirtualSubobject)
diff --git a/include/clang/AST/Comment.h b/include/clang/AST/Comment.h
index 03e5d692f4..e18fe9ab86 100644
--- a/include/clang/AST/Comment.h
+++ b/include/clang/AST/Comment.h
@@ -278,9 +278,9 @@ public:
return C->getCommentKind() == TextCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
StringRef getText() const LLVM_READONLY { return Text; }
@@ -336,9 +336,9 @@ public:
return C->getCommentKind() == InlineCommandCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
unsigned getCommandID() const {
return InlineCommandCommentBits.CommandID;
@@ -469,9 +469,9 @@ public:
return C->getCommentKind() == HTMLStartTagCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
unsigned getNumAttrs() const {
return Attributes.size();
@@ -524,9 +524,9 @@ public:
return C->getCommentKind() == HTMLEndTagCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
};
/// Block content (contains inline content).
@@ -620,7 +620,7 @@ protected:
unsigned CommandID,
CommandMarkerKind CommandMarker) :
BlockContentComment(K, LocBegin, LocEnd),
- Paragraph(NULL) {
+ Paragraph(nullptr) {
setLocation(getCommandNameBeginLoc());
BlockCommandCommentBits.CommandID = CommandID;
BlockCommandCommentBits.CommandMarker = CommandMarker;
@@ -632,7 +632,7 @@ public:
unsigned CommandID,
CommandMarkerKind CommandMarker) :
BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
- Paragraph(NULL) {
+ Paragraph(nullptr) {
setLocation(getCommandNameBeginLoc());
BlockCommandCommentBits.CommandID = CommandID;
BlockCommandCommentBits.CommandMarker = CommandMarker;
@@ -880,9 +880,9 @@ public:
return C->getCommentKind() == VerbatimBlockLineCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
StringRef getText() const LLVM_READONLY {
return Text;
@@ -967,9 +967,9 @@ public:
return C->getCommentKind() == VerbatimLineCommentKind;
}
- child_iterator child_begin() const { return NULL; }
+ child_iterator child_begin() const { return nullptr; }
- child_iterator child_end() const { return NULL; }
+ child_iterator child_end() const { return nullptr; }
StringRef getText() const {
return Text;
diff --git a/include/clang/AST/CommentLexer.h b/include/clang/AST/CommentLexer.h
index 8070615bb0..a6e3ed89b2 100644
--- a/include/clang/AST/CommentLexer.h
+++ b/include/clang/AST/CommentLexer.h
@@ -352,7 +352,7 @@ public:
StringRef getSpelling(const Token &Tok,
const SourceManager &SourceMgr,
- bool *Invalid = NULL) const;
+ bool *Invalid = nullptr) const;
};
} // end namespace comments
diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h
index 39109602b1..027c3b929d 100644
--- a/include/clang/AST/CommentSema.h
+++ b/include/clang/AST/CommentSema.h
@@ -84,8 +84,8 @@ public:
T *Mem = Allocator.Allocate<T>(Size);
std::uninitialized_copy(Source.begin(), Source.end(), Mem);
return llvm::makeArrayRef(Mem, Size);
- } else
- return llvm::makeArrayRef(static_cast<T *>(NULL), 0);
+ }
+ return ArrayRef<T>();
}
ParagraphComment *actOnParagraphComment(
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index f854118d04..bde5f41412 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -79,9 +79,9 @@ class TranslationUnitDecl : public Decl, public DeclContext {
NamespaceDecl *AnonymousNamespace;
explicit TranslationUnitDecl(ASTContext &ctx)
- : Decl(TranslationUnit, 0, SourceLocation()),
+ : Decl(TranslationUnit, nullptr, SourceLocation()),
DeclContext(TranslationUnit),
- Ctx(ctx), AnonymousNamespace(0) {}
+ Ctx(ctx), AnonymousNamespace(nullptr) {}
public:
ASTContext &getASTContext() const { return Ctx; }
@@ -508,7 +508,8 @@ struct QualifierInfo {
TemplateParameterList** TemplParamLists;
/// Default constructor.
- QualifierInfo() : QualifierLoc(), NumTemplParamLists(0), TemplParamLists(0) {}
+ QualifierInfo()
+ : QualifierLoc(), NumTemplParamLists(0), TemplParamLists(nullptr) {}
/// setTemplateParameterListsInfo - Sets info about "outer" template
/// parameter lists.
@@ -579,7 +580,7 @@ public:
/// declaration, if it was present in the source.
NestedNameSpecifier *getQualifier() const {
return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
- : 0;
+ : nullptr;
}
/// \brief Retrieve the nested-name-specifier (with source-location
@@ -991,7 +992,7 @@ public:
}
const Expr *getInit() const {
if (Init.isNull())
- return 0;
+ return nullptr;
const Stmt *S = Init.dyn_cast<Stmt *>();
if (!S) {
@@ -1002,7 +1003,7 @@ public:
}
Expr *getInit() {
if (Init.isNull())
- return 0;
+ return nullptr;
Stmt *S = Init.dyn_cast<Stmt *>();
if (!S) {
@@ -1053,7 +1054,7 @@ public:
if (Eval->WasEvaluated)
return &Eval->Evaluated;
- return 0;
+ return nullptr;
}
/// \brief Determines whether it is already known whether the
@@ -1214,7 +1215,7 @@ public:
ImplicitParamDecl(DeclContext *DC, SourceLocation IdLoc,
IdentifierInfo *Id, QualType Type)
: VarDecl(ImplicitParam, DC, IdLoc, IdLoc, Id, Type,
- /*tinfo*/ 0, SC_None) {
+ /*tinfo*/ nullptr, SC_None) {
setImplicit();
}
@@ -1357,9 +1358,7 @@ public:
/// real default argument via setDefaultArg when the class
/// definition enclosing the function declaration that owns this
/// default argument is completed.
- void setUnparsedDefaultArg() {
- Init = (UnparsedDefaultArgument *)0;
- }
+ void setUnparsedDefaultArg() { Init = (UnparsedDefaultArgument *)nullptr; }
bool hasInheritedDefaultArg() const {
return ParmVarDeclBits.HasInheritedDefaultArg;
@@ -1541,7 +1540,7 @@ protected:
: DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
StartLoc),
DeclContext(DK),
- ParamInfo(0), Body(),
+ ParamInfo(nullptr), Body(),
SClass(S),
IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
@@ -1997,7 +1996,7 @@ public:
/// \brief Determine whether this function is a function template
/// specialization.
bool isFunctionTemplateSpecialization() const {
- return getPrimaryTemplate() != 0;
+ return getPrimaryTemplate() != nullptr;
}
/// \brief Retrieve the class scope template pattern that this function
@@ -2070,11 +2069,11 @@ public:
/// \param PointOfInstantiation point at which the function template
/// specialization was first instantiated.
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
- const TemplateArgumentList *TemplateArgs,
- void *InsertPos,
- TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
- const TemplateArgumentListInfo *TemplateArgsAsWritten = 0,
- SourceLocation PointOfInstantiation = SourceLocation()) {
+ const TemplateArgumentList *TemplateArgs,
+ void *InsertPos,
+ TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
+ const TemplateArgumentListInfo *TemplateArgsAsWritten = nullptr,
+ SourceLocation PointOfInstantiation = SourceLocation()) {
setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
InsertPos, TSK, TemplateArgsAsWritten,
PointOfInstantiation);
@@ -2197,7 +2196,7 @@ public:
bool isAnonymousStructOrUnion() const;
Expr *getBitWidth() const {
- return isBitField() ? InitializerOrBitWidth.getPointer() : 0;
+ return isBitField() ? InitializerOrBitWidth.getPointer() : nullptr;
}
unsigned getBitWidthValue(const ASTContext &Ctx) const;
@@ -2208,7 +2207,7 @@ public:
// Note: used by some clients (i.e., do not remove it).
void removeBitWidth() {
assert(isBitField() && "no bitfield width to remove");
- InitializerOrBitWidth.setPointer(0);
+ InitializerOrBitWidth.setPointer(nullptr);
}
/// getInClassInitStyle - Get the kind of (C++11) in-class initializer which
@@ -2227,7 +2226,8 @@ public:
/// in-class initializer, but this returns null, then we have not parsed and
/// attached it yet.
Expr *getInClassInitializer() const {
- return hasInClassInitializer() ? InitializerOrBitWidth.getPointer() : 0;
+ return hasInClassInitializer() ? InitializerOrBitWidth.getPointer()
+ : nullptr;
}
/// setInClassInitializer - Set the C++11 in-class initializer for this
/// member.
@@ -2236,7 +2236,7 @@ public:
/// member.
void removeInClassInitializer() {
assert(hasInClassInitializer() && "no initializer to remove");
- InitializerOrBitWidth.setPointer(0);
+ InitializerOrBitWidth.setPointer(nullptr);
InitializerOrBitWidth.setInt(ICIS_NoInit);
}
@@ -2368,7 +2368,7 @@ class TypeDecl : public NamedDecl {
protected:
TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
SourceLocation StartL = SourceLocation())
- : NamedDecl(DK, DC, L, Id), TypeForDecl(0), LocStart(StartL) {}
+ : NamedDecl(DK, DC, L, Id), TypeForDecl(nullptr), LocStart(StartL) {}
public:
// Low-level accessor. If you just want the type defined by this node,
@@ -2583,7 +2583,7 @@ protected:
IsCompleteDefinition(false), IsBeingDefined(false),
IsEmbeddedInDeclarator(false), IsFreeStanding(false),
IsCompleteDefinitionRequired(false),
- NamedDeclOrQualifier((NamedDecl *)0) {
+ NamedDeclOrQualifier((NamedDecl *)nullptr) {
assert((DK != Enum || TK == TTK_Enum) &&
"EnumDecl not matched with TTK_Enum");
setPreviousDecl(PrevDecl);
@@ -2733,12 +2733,12 @@ public:
NamedDeclOrQualifier.get<NamedDecl *>());
}
DeclaratorDecl *getDeclaratorForAnonDecl() const {
- return hasExtInfo() ? 0 : dyn_cast_or_null<DeclaratorDecl>(
+ return hasExtInfo() ? nullptr : dyn_cast_or_null<DeclaratorDecl>(
NamedDeclOrQualifier.get<NamedDecl *>());
}
TypedefNameDecl *getTypedefNameForAnonDecl() const {
- return hasExtInfo() ? 0 : dyn_cast_or_null<TypedefNameDecl>(
+ return hasExtInfo() ? nullptr : dyn_cast_or_null<TypedefNameDecl>(
NamedDeclOrQualifier.get<NamedDecl *>());
}
@@ -2750,7 +2750,7 @@ public:
/// declaration, if it was present in the source.
NestedNameSpecifier *getQualifier() const {
return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier()
- : 0;
+ : nullptr;
}
/// \brief Retrieve the nested-name-specifier (with source-location
@@ -2825,9 +2825,9 @@ class EnumDecl : public TagDecl {
IdentifierInfo *Id, EnumDecl *PrevDecl,
bool Scoped, bool ScopedUsingClassTag, bool Fixed)
: TagDecl(Enum, TTK_Enum, DC, IdLoc, Id, PrevDecl, StartLoc),
- SpecializationInfo(0) {
+ SpecializationInfo(nullptr) {
assert(Scoped || !ScopedUsingClassTag);
- IntegerType = (const Type*)0;
+ IntegerType = (const Type *)nullptr;
NumNegativeBits = 0;
NumPositiveBits = 0;
IsScoped = Scoped;
@@ -3061,7 +3061,7 @@ protected:
public:
static RecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
- IdentifierInfo *Id, RecordDecl* PrevDecl = 0);
+ IdentifierInfo *Id, RecordDecl* PrevDecl = nullptr);
static RecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID);
RecordDecl *getPreviousDecl() {
@@ -3238,7 +3238,7 @@ public:
/// is not from outside the immediately enclosing function/block.
bool isNested() const { return VariableAndFlags.getInt() & flag_isNested; }
- bool hasCopyExpr() const { return CopyExpr != 0; }
+ bool hasCopyExpr() const { return CopyExpr != nullptr; }
Expr *getCopyExpr() const { return CopyExpr; }
void setCopyExpr(Expr *e) { CopyExpr = e; }
};
@@ -3269,9 +3269,9 @@ protected:
: Decl(Block, DC, CaretLoc), DeclContext(Block),
IsVariadic(false), CapturesCXXThis(false),
BlockMissingReturnType(true), IsConversionFromLambda(false),
- ParamInfo(0), NumParams(0), Body(0),
- SignatureAsWritten(0), Captures(0), NumCaptures(0),
- ManglingNumber(0), ManglingContextDecl(0) {}
+ ParamInfo(nullptr), NumParams(0), Body(nullptr),
+ SignatureAsWritten(nullptr), Captures(nullptr), NumCaptures(0),
+ ManglingNumber(0), ManglingContextDecl(nullptr) {}
public:
static BlockDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L);
@@ -3405,7 +3405,7 @@ private:
explicit CapturedDecl(DeclContext *DC, unsigned NumParams)
: Decl(Captured, DC, SourceLocation()), DeclContext(Captured),
- NumParams(NumParams), Body(0) { }
+ NumParams(NumParams), Body(nullptr) { }
ImplicitParamDecl **getParams() const {
return reinterpret_cast<ImplicitParamDecl **>(
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 6c3135847f..8c8332ba18 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -440,10 +440,10 @@ public:
}
attr_iterator attr_begin() const {
- return hasAttrs() ? getAttrs().begin() : 0;
+ return hasAttrs() ? getAttrs().begin() : nullptr;
}
attr_iterator attr_end() const {
- return hasAttrs() ? getAttrs().end() : 0;
+ return hasAttrs() ? getAttrs().end() : nullptr;
}
template <typename T>
@@ -473,7 +473,7 @@ public:
}
template<typename T> T *getAttr() const {
- return hasAttrs() ? getSpecificAttr<T>(getAttrs()) : 0;
+ return hasAttrs() ? getSpecificAttr<T>(getAttrs()) : nullptr;
}
template<typename T> bool hasAttr() const {
return hasAttrs() && hasSpecificAttr<T>(getAttrs());
@@ -570,14 +570,14 @@ public:
/// AR_Available, will be set to a (possibly empty) message
/// describing why the declaration has not been introduced, is
/// deprecated, or is unavailable.
- AvailabilityResult getAvailability(std::string *Message = 0) const;
+ AvailabilityResult getAvailability(std::string *Message = nullptr) const;
/// \brief Determine whether this declaration is marked 'deprecated'.
///
/// \param Message If non-NULL and the declaration is deprecated,
/// this will be set to the message describing why the declaration
/// was deprecated (which may be empty).
- bool isDeprecated(std::string *Message = 0) const {
+ bool isDeprecated(std::string *Message = nullptr) const {
return getAvailability(Message) == AR_Deprecated;
}
@@ -586,7 +586,7 @@ public:
/// \param Message If non-NULL and the declaration is unavailable,
/// this will be set to the message describing why the declaration
/// was made unavailable (which may be empty).
- bool isUnavailable(std::string *Message = 0) const {
+ bool isUnavailable(std::string *Message = nullptr) const {
return getAvailability(Message) == AR_Unavailable;
}
@@ -633,7 +633,7 @@ private:
public:
Module *getOwningModule() const {
if (!isFromASTFile())
- return 0;
+ return nullptr;
return getOwningModuleSlow();
}
@@ -688,7 +688,7 @@ public:
/// roughly global variables and functions, but also handles enums (which
/// could be defined inside or outside a function etc).
bool isDefinedOutsideFunctionOrMethod() const {
- return getParentFunctionOrMethod() == 0;
+ return getParentFunctionOrMethod() == nullptr;
}
/// \brief If this decl is defined inside a function/method/block it returns
@@ -717,7 +717,7 @@ protected:
/// \brief Implementation of getPreviousDecl(), to be overridden by any
/// subclass that has a redeclaration chain.
- virtual Decl *getPreviousDeclImpl() { return 0; }
+ virtual Decl *getPreviousDeclImpl() { return nullptr; }
/// \brief Implementation of getMostRecentDecl(), to be overridden by any
/// subclass that has a redeclaration chain.
@@ -737,7 +737,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
- redecl_iterator() : Current(0) { }
+ redecl_iterator() : Current(nullptr) { }
explicit redecl_iterator(Decl *C) : Current(C), Starter(C) { }
reference operator*() const { return Current; }
@@ -748,7 +748,7 @@ public:
// Get either previous decl or latest decl.
Decl *Next = Current->getNextRedeclaration();
assert(Next && "Should return next redeclaration or itself, never null!");
- Current = (Next != Starter ? Next : 0);
+ Current = (Next != Starter) ? Next : nullptr;
return *this;
}
@@ -791,7 +791,7 @@ public:
/// \brief True if this is the first declaration in its redeclaration chain.
bool isFirstDecl() const {
- return getPreviousDecl() == 0;
+ return getPreviousDecl() == nullptr;
}
/// \brief Retrieve the most recent declaration that declares the same entity
@@ -807,13 +807,13 @@ public:
/// getBody - If this Decl represents a declaration for a body of code,
/// such as a function or method definition, this method returns the
/// top-level Stmt* of that body. Otherwise this method returns null.
- virtual Stmt* getBody() const { return 0; }
+ virtual Stmt* getBody() const { return nullptr; }
/// \brief Returns true if this \c Decl represents a declaration for a body of
/// code, such as a function or method definition.
/// Note that \c hasBody can also return true if any redeclaration of this
/// \c Decl represents a declaration for a body of code.
- virtual bool hasBody() const { return getBody() != 0; }
+ virtual bool hasBody() const { return getBody() != nullptr; }
/// getBodyRBrace - Gets the right brace of the body, if a body exists.
/// This works whether the body is a CompoundStmt or a CXXTryStmt.
@@ -1068,8 +1068,8 @@ protected:
DeclContext(Decl::Kind K)
: DeclKind(K), ExternalLexicalStorage(false),
ExternalVisibleStorage(false),
- NeedToReconcileExternalVisibleStorage(false), LookupPtr(0, false),
- FirstDecl(0), LastDecl(0) {}
+ NeedToReconcileExternalVisibleStorage(false), LookupPtr(nullptr, false),
+ FirstDecl(nullptr), LastDecl(nullptr) {}
public:
~DeclContext();
@@ -1276,7 +1276,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
- decl_iterator() : Current(0) { }
+ decl_iterator() : Current(nullptr) { }
explicit decl_iterator(Decl *C) : Current(C) { }
reference operator*() const { return Current; }
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 46774e0cf1..0f0849d371 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -482,14 +482,14 @@ class CXXRecordDecl : public RecordDecl {
/// \brief Retrieve the set of direct base classes.
CXXBaseSpecifier *getBases() const {
if (!Bases.isOffset())
- return Bases.get(0);
+ return Bases.get(nullptr);
return getBasesSlowCase();
}
/// \brief Retrieve the set of virtual base classes.
CXXBaseSpecifier *getVBases() const {
if (!VBases.isOffset())
- return VBases.get(0);
+ return VBases.get(nullptr);
return getVBasesSlowCase();
}
@@ -501,14 +501,14 @@ class CXXRecordDecl : public RecordDecl {
/// \brief Describes a C++ closure type (generated by a lambda expression).
struct LambdaDefinitionData : public DefinitionData {
typedef LambdaExpr::Capture Capture;
-
- LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
+
+ LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info,
bool Dependent, bool IsGeneric,
LambdaCaptureDefault CaptureDefault)
: DefinitionData(D), Dependent(Dependent), IsGenericLambda(IsGeneric),
CaptureDefault(CaptureDefault), NumCaptures(0), NumExplicitCaptures(0),
- ManglingNumber(0), ContextDecl(0), Captures(0), MethodTyInfo(Info)
- {
+ ManglingNumber(0), ContextDecl(nullptr), Captures(nullptr),
+ MethodTyInfo(Info) {
IsLambda = true;
}
@@ -642,15 +642,16 @@ public:
}
CXXRecordDecl *getDefinition() const {
- if (!DefinitionData) return 0;
+ if (!DefinitionData) return nullptr;
return data().Definition;
}
- bool hasDefinition() const { return DefinitionData != 0; }
+ bool hasDefinition() const { return DefinitionData != nullptr; }
static CXXRecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
- IdentifierInfo *Id, CXXRecordDecl* PrevDecl=0,
+ IdentifierInfo *Id,
+ CXXRecordDecl *PrevDecl = nullptr,
bool DelayTypeCreation = false);
static CXXRecordDecl *CreateLambda(const ASTContext &C, DeclContext *DC,
TypeSourceInfo *Info, SourceLocation Loc,
@@ -1025,10 +1026,11 @@ public:
return capture_const_range(captures_begin(), captures_end());
}
capture_const_iterator captures_begin() const {
- return isLambda() ? getLambdaData().Captures : NULL;
+ return isLambda() ? getLambdaData().Captures : nullptr;
}
capture_const_iterator captures_end() const {
- return isLambda() ? captures_begin() + getLambdaData().NumCaptures : NULL;
+ return isLambda() ? captures_begin() + getLambdaData().NumCaptures
+ : nullptr;
}
typedef UnresolvedSetIterator conversion_iterator;
@@ -1988,20 +1990,20 @@ public:
FieldDecl *getMember() const {
if (isMemberInitializer())
return Initializee.get<FieldDecl*>();
- return 0;
+ return nullptr;
}
FieldDecl *getAnyMember() const {
if (isMemberInitializer())
return Initializee.get<FieldDecl*>();
if (isIndirectMemberInitializer())
return Initializee.get<IndirectFieldDecl*>()->getAnonField();
- return 0;
+ return nullptr;
}
IndirectFieldDecl *getIndirectMember() const {
if (isIndirectMemberInitializer())
return Initializee.get<IndirectFieldDecl*>();
- return 0;
+ return nullptr;
}
SourceLocation getMemberLocation() const {
@@ -2105,7 +2107,7 @@ class CXXConstructorDecl : public CXXMethodDecl {
bool isImplicitlyDeclared, bool isConstexpr)
: CXXMethodDecl(CXXConstructor, RD, StartLoc, NameInfo, T, TInfo,
SC_None, isInline, isConstexpr, SourceLocation()),
- IsExplicitSpecified(isExplicitSpecified), CtorInitializers(0),
+ IsExplicitSpecified(isExplicitSpecified), CtorInitializers(nullptr),
NumCtorInitializers(0) {
setImplicit(isImplicitlyDeclared);
}
@@ -2304,7 +2306,7 @@ class CXXDestructorDecl : public CXXMethodDecl {
bool isInline, bool isImplicitlyDeclared)
: CXXMethodDecl(CXXDestructor, RD, StartLoc, NameInfo, T, TInfo,
SC_None, isInline, /*isConstexpr=*/false, SourceLocation()),
- OperatorDelete(0) {
+ OperatorDelete(nullptr) {
setImplicit(isImplicitlyDeclared);
}
@@ -2812,7 +2814,7 @@ class UsingDecl : public NamedDecl {
const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword)
: NamedDecl(Using, DC, NameInfo.getLoc(), NameInfo.getName()),
UsingLocation(UL), QualifierLoc(QualifierLoc),
- DNLoc(NameInfo.getInfo()), FirstUsingShadow(0, HasTypenameKeyword) {
+ DNLoc(NameInfo.getInfo()), FirstUsingShadow(nullptr, HasTypenameKeyword) {
}
public:
@@ -2857,7 +2859,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
- shadow_iterator() : Current(0) { }
+ shadow_iterator() : Current(nullptr) { }
explicit shadow_iterator(UsingShadowDecl *C) : Current(C) { }
reference operator*() const { return Current; }
@@ -3137,9 +3139,9 @@ public:
static bool classof(const Decl *D) { return D->getKind() == MSProperty; }
- bool hasGetter() const { return GetterId != NULL; }
+ bool hasGetter() const { return GetterId != nullptr; }
IdentifierInfo* getGetterId() const { return GetterId; }
- bool hasSetter() const { return SetterId != NULL; }
+ bool hasSetter() const { return SetterId != nullptr; }
IdentifierInfo* getSetterId() const { return SetterId; }
friend class ASTDeclReader;
diff --git a/include/clang/AST/DeclContextInternals.h b/include/clang/AST/DeclContextInternals.h
index f85cea5016..9068c00a79 100644
--- a/include/clang/AST/DeclContextInternals.h
+++ b/include/clang/AST/DeclContextInternals.h
@@ -47,7 +47,7 @@ public:
StoredDeclsList() {}
StoredDeclsList(StoredDeclsList &&RHS) : Data(RHS.Data) {
- RHS.Data = (NamedDecl *)0;
+ RHS.Data = (NamedDecl *)nullptr;
}
~StoredDeclsList() {
@@ -60,7 +60,7 @@ public:
if (DeclsTy *Vector = getAsVector())
delete Vector;
Data = RHS.Data;
- RHS.Data = (NamedDecl *)0;
+ RHS.Data = (NamedDecl *)nullptr;
return *this;
}
@@ -107,7 +107,7 @@ public:
if (NamedDecl *Singleton = getAsDecl()) {
assert(Singleton == D && "list is different singleton");
(void)Singleton;
- Data = (NamedDecl *)0;
+ Data = (NamedDecl *)nullptr;
return;
}
@@ -142,8 +142,8 @@ public:
/// represents.
DeclContext::lookup_result getLookupResult() {
if (isNull())
- return DeclContext::lookup_result(DeclContext::lookup_iterator(0),
- DeclContext::lookup_iterator(0));
+ return DeclContext::lookup_result(DeclContext::lookup_iterator(nullptr),
+ DeclContext::lookup_iterator(nullptr));
// If we have a single NamedDecl, return it.
if (getAsDecl()) {
@@ -252,7 +252,7 @@ private:
class DependentStoredDeclsMap : public StoredDeclsMap {
public:
- DependentStoredDeclsMap() : FirstDiagnostic(0) {}
+ DependentStoredDeclsMap() : FirstDiagnostic(nullptr) {}
private:
friend class DependentDiagnostic;
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h
index bb852d0629..cd1aa717b4 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -91,7 +91,7 @@ private:
FriendDecl *getNextFriend() {
if (!NextFriend.isOffset())
- return cast_or_null<FriendDecl>(NextFriend.get(0));
+ return cast_or_null<FriendDecl>(NextFriend.get(nullptr));
return getNextFriendSlowCase();
}
FriendDecl *getNextFriendSlowCase();
@@ -224,7 +224,7 @@ inline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_begin() const {
}
inline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_end() const {
- return friend_iterator(0);
+ return friend_iterator(nullptr);
}
inline CXXRecordDecl::friend_range CXXRecordDecl::friends() const {
diff --git a/include/clang/AST/DeclGroup.h b/include/clang/AST/DeclGroup.h
index cda6ae520a..bd3dbd8fa7 100644
--- a/include/clang/AST/DeclGroup.h
+++ b/include/clang/AST/DeclGroup.h
@@ -63,7 +63,7 @@ class DeclGroupRef {
}
public:
- DeclGroupRef() : D(0) {}
+ DeclGroupRef() : D(nullptr) {}
explicit DeclGroupRef(Decl* d) : D(d) {}
explicit DeclGroupRef(DeclGroup* dg)
@@ -80,7 +80,7 @@ public:
typedef Decl** iterator;
typedef Decl* const * const_iterator;
- bool isNull() const { return D == 0; }
+ bool isNull() const { return D == nullptr; }
bool isSingleDecl() const { return getKind() == SingleDeclKind; }
bool isDeclGroup() const { return getKind() == DeclGroupKind; }
@@ -102,26 +102,26 @@ public:
iterator begin() {
if (isSingleDecl())
- return D ? &D : 0;
+ return D ? &D : nullptr;
return &getDeclGroup()[0];
}
iterator end() {
if (isSingleDecl())
- return D ? &D+1 : 0;
+ return D ? &D+1 : nullptr;
DeclGroup &G = getDeclGroup();
return &G[0] + G.size();
}
const_iterator begin() const {
if (isSingleDecl())
- return D ? &D : 0;
+ return D ? &D : nullptr;
return &getDeclGroup()[0];
}
const_iterator end() const {
if (isSingleDecl())
- return D ? &D+1 : 0;
+ return D ? &D+1 : nullptr;
const DeclGroup &G = getDeclGroup();
return &G[0] + G.size();
}
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index cdd7d2602d..737276a6e5 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -41,7 +41,7 @@ protected:
unsigned NumElts;
public:
- ObjCListBase() : List(0), NumElts(0) {}
+ ObjCListBase() : List(nullptr), NumElts(0) {}
unsigned size() const { return NumElts; }
bool empty() const { return NumElts == 0; }
@@ -79,7 +79,7 @@ class ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
using ObjCList<ObjCProtocolDecl>::set;
public:
- ObjCProtocolList() : ObjCList<ObjCProtocolDecl>(), Locations(0) { }
+ ObjCProtocolList() : ObjCList<ObjCProtocolDecl>(), Locations(nullptr) { }
typedef const SourceLocation *loc_iterator;
loc_iterator loc_begin() const { return Locations; }
@@ -238,8 +238,9 @@ private:
objcDeclQualifier(OBJC_TQ_None),
RelatedResultType(HasRelatedResultType),
SelLocsKind(SelLoc_StandardNoSpace), IsOverriding(0), HasSkippedBody(0),
- MethodDeclType(T), ReturnTInfo(ReturnTInfo), ParamsAndSelLocs(0),
- NumParams(0), DeclEndLoc(endLoc), Body(), SelfDecl(0), CmdDecl(0) {
+ MethodDeclType(T), ReturnTInfo(ReturnTInfo), ParamsAndSelLocs(nullptr),
+ NumParams(0), DeclEndLoc(endLoc), Body(), SelfDecl(nullptr),
+ CmdDecl(nullptr) {
setImplicit(isImplicitlyDeclared);
}
@@ -470,7 +471,7 @@ public:
/// the method declaration that was marked with the designated initializer
/// attribute.
bool isDesignatedInitializerForTheInterface(
- const ObjCMethodDecl **InitMethod = 0) const;
+ const ObjCMethodDecl **InitMethod = nullptr) const;
/// \brief Determine whether this method has a body.
bool hasBody() const override { return Body.isValid(); }
@@ -972,8 +973,9 @@ public:
///
/// \param InitMethod if non-null and the function returns true, it receives
/// the method that was marked as a designated initializer.
- bool isDesignatedInitializer(Selector Sel,
- const ObjCMethodDecl **InitMethod = 0) const;
+ bool
+ isDesignatedInitializer(Selector Sel,
+ const ObjCMethodDecl **InitMethod = nullptr) const;
/// \brief Determine whether this particular declaration of this class is
/// actually also a definition.
@@ -1002,14 +1004,14 @@ public:
/// has been forward-declared (with \@class) but not yet defined (with
/// \@interface).
ObjCInterfaceDecl *getDefinition() {
- return hasDefinition()? Data.getPointer()->Definition : 0;
+ return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
/// \brief Retrieve the definition of this class, or NULL if this class
/// has been forward-declared (with \@class) but not yet defined (with
/// \@interface).
const ObjCInterfaceDecl *getDefinition() const {
- return hasDefinition()? Data.getPointer()->Definition : 0;
+ return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
/// \brief Starts the definition of this Objective-C class, taking it from
@@ -1019,7 +1021,7 @@ public:
ObjCInterfaceDecl *getSuperClass() const {
// FIXME: Should make sure no callers ever do this.
if (!hasDefinition())
- return 0;
+ return nullptr;
if (data().ExternallyCompleted)
LoadExternalDefinition();
@@ -1051,7 +1053,7 @@ public:
typedef std::ptrdiff_t difference_type;
typedef std::input_iterator_tag iterator_category;
- filtered_category_iterator() : Current(0) { }
+ filtered_category_iterator() : Current(nullptr) { }
explicit filtered_category_iterator(ObjCCategoryDecl *Current)
: Current(Current)
{
@@ -1225,7 +1227,7 @@ public:
ObjCCategoryDecl* getCategoryListRaw() const {
// FIXME: Should make sure no callers ever do this.
if (!hasDefinition())
- return 0;
+ return nullptr;
if (data().ExternallyCompleted)
LoadExternalDefinition();
@@ -1249,7 +1251,7 @@ public:
/// super class of the specified interface class.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const {
// If RHS is derived from LHS it is OK; else it is not OK.
- while (I != NULL) {
+ while (I != nullptr) {
if (declaresSameEntity(this, I))
return true;
@@ -1281,7 +1283,7 @@ public:
ObjCMethodDecl *lookupMethod(Selector Sel, bool isInstance,
bool shallowCategoryLookup = false,
bool followSuper = true,
- const ObjCCategoryDecl *C = 0) const;
+ const ObjCCategoryDecl *C = nullptr) const;
/// Lookup an instance method for a given selector.
ObjCMethodDecl *lookupInstanceMethod(Selector Sel) const {
@@ -1398,14 +1400,14 @@ private:
bool synthesized)
: FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW,
/*Mutable=*/false, /*HasInit=*/ICIS_NoInit),
- NextIvar(0), DeclAccess(ac), Synthesized(synthesized) {}
+ NextIvar(nullptr), DeclAccess(ac), Synthesized(synthesized) {}
public:
static ObjCIvarDecl *Create(ASTContext &C, ObjCContainerDecl *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, QualType T,
TypeSourceInfo *TInfo,
- AccessControl ac, Expr *BW = NULL,
+ AccessControl ac, Expr *BW = nullptr,
bool synthesized=false);
static ObjCIvarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
@@ -1452,7 +1454,7 @@ class ObjCAtDefsFieldDecl : public FieldDecl {
SourceLocation IdLoc, IdentifierInfo *Id,
QualType T, Expr *BW)
: FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T,
- /*TInfo=*/0, // FIXME: Do ObjCAtDefs have declarators ?
+ /*TInfo=*/nullptr, // FIXME: Do ObjCAtDefs have declarators ?
BW, /*Mutable=*/false, /*HasInit=*/ICIS_NoInit) {}
public:
@@ -1634,12 +1636,12 @@ public:
/// \brief Retrieve the definition of this protocol, if any.
ObjCProtocolDecl *getDefinition() {
- return hasDefinition()? Data.getPointer()->Definition : 0;
+ return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
/// \brief Retrieve the definition of this protocol, if any.
const ObjCProtocolDecl *getDefinition() const {
- return hasDefinition()? Data.getPointer()->Definition : 0;
+ return hasDefinition()? Data.getPointer()->Definition : nullptr;
}
/// \brief Determine whether this particular declaration is also the
@@ -1728,7 +1730,7 @@ class ObjCCategoryDecl : public ObjCContainerDecl {
SourceLocation IvarLBraceLoc=SourceLocation(),
SourceLocation IvarRBraceLoc=SourceLocation())
: ObjCContainerDecl(ObjCCategory, DC, Id, ClassNameLoc, AtLoc),
- ClassInterface(IDecl), NextClassCategory(0),
+ ClassInterface(IDecl), NextClassCategory(nullptr),
CategoryNameLoc(CategoryNameLoc),
IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc) {
}
@@ -1794,7 +1796,7 @@ public:
return NextClassCategory;
}
- bool IsClassExtension() const { return getIdentifier() == 0; }
+ bool IsClassExtension() const { return getIdentifier() == nullptr; }
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
typedef llvm::iterator_range<specific_decl_iterator<ObjCIvarDecl>> ivar_range;
@@ -1839,7 +1841,8 @@ protected:
ObjCInterfaceDecl *classInterface,
SourceLocation nameLoc, SourceLocation atStartLoc)
: ObjCContainerDecl(DK, DC,
- classInterface? classInterface->getIdentifier() : 0,
+ classInterface? classInterface->getIdentifier()
+ : nullptr,
nameLoc, atStartLoc),
ClassInterface(classInterface) {}
@@ -2010,7 +2013,7 @@ class ObjCImplementationDecl : public ObjCImplDecl {
: ObjCImplDecl(ObjCImplementation, DC, classInterface, nameLoc, atStartLoc),
SuperClass(superDecl), SuperLoc(superLoc), IvarLBraceLoc(IvarLBraceLoc),
IvarRBraceLoc(IvarRBraceLoc),
- IvarInitializers(0), NumIvarInitializers(0),
+ IvarInitializers(nullptr), NumIvarInitializers(0),
HasNonZeroConstructors(false), HasDestructors(false) {}
public:
static ObjCImplementationDecl *Create(ASTContext &C, DeclContext *DC,
@@ -2220,7 +2223,9 @@ private:
PropertyImplementation(None),
GetterName(Selector()),
SetterName(Selector()),
- GetterMethodDecl(0), SetterMethodDecl(0) , PropertyIvarDecl(0) {}
+ GetterMethodDecl(nullptr), SetterMethodDecl(nullptr),
+ PropertyIvarDecl(nullptr) {}
+
public:
static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
@@ -2384,7 +2389,7 @@ private:
SourceLocation ivarLoc)
: Decl(ObjCPropertyImpl, DC, L), AtLoc(atLoc),
IvarLoc(ivarLoc), PropertyDecl(property), PropertyIvarDecl(ivarDecl),
- GetterCXXConstructor(0), SetterCXXAssignment(0) {
+ GetterCXXConstructor(nullptr), SetterCXXAssignment(nullptr) {
assert (PK == Dynamic || PropertyIvarDecl);
}
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index d55582a161..b0c9d5296b 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -232,13 +232,15 @@ protected:
// This is probably never used.
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
DeclarationName Name)
- : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(0) { }
+ : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
+ TemplateParams(nullptr) {}
// Construct a template decl with the given name and parameters.
// Used when there is not templated element (tt-params, alias?).
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
DeclarationName Name, TemplateParameterList *Params)
- : NamedDecl(DK, DC, L, Name), TemplatedDecl(0), TemplateParams(Params) { }
+ : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
+ TemplateParams(Params) {}
// Construct a template decl with name, parameters, and templated element.
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
@@ -274,8 +276,8 @@ public:
/// \brief Initialize the underlying templated declaration and
/// template parameters.
void init(NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
- assert(TemplatedDecl == 0 && "TemplatedDecl already set!");
- assert(TemplateParams == 0 && "TemplateParams already set!");
+ assert(!TemplatedDecl && "TemplatedDecl already set!");
+ assert(!TemplateParams && "TemplateParams already set!");
TemplatedDecl = templatedDecl;
TemplateParams = templateParams;
}
@@ -599,7 +601,7 @@ protected:
void *&InsertPos);
struct CommonBase {
- CommonBase() : InstantiatedFromMember(0, false) { }
+ CommonBase() : InstantiatedFromMember(nullptr, false) { }
/// \brief The template from which this was most
/// directly instantiated (or null).
@@ -972,7 +974,7 @@ public:
/// \brief Determine whether this template parameter has a default
/// argument.
- bool hasDefaultArgument() const { return DefaultArgument != 0; }
+ bool hasDefaultArgument() const { return DefaultArgument != nullptr; }
/// \brief Retrieve the default argument, if any.
QualType getDefaultArgument() const { return DefaultArgument->getType(); }
@@ -997,7 +999,7 @@ public:
/// \brief Removes the default argument of this template parameter.
void removeDefaultArgument() {
- DefaultArgument = 0;
+ DefaultArgument = nullptr;
InheritedDefault = false;
}
@@ -1051,7 +1053,7 @@ class NonTypeTemplateParmDecl
IdentifierInfo *Id, QualType T,
bool ParameterPack, TypeSourceInfo *TInfo)
: DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
- TemplateParmPosition(D, P), DefaultArgumentAndInherited(0, false),
+ TemplateParmPosition(D, P), DefaultArgumentAndInherited(nullptr, false),
ParameterPack(ParameterPack), ExpandedParameterPack(false),
NumExpandedTypes(0)
{ }
@@ -1096,7 +1098,7 @@ public:
/// \brief Determine whether this template parameter has a default
/// argument.
bool hasDefaultArgument() const {
- return DefaultArgumentAndInherited.getPointer() != 0;
+ return DefaultArgumentAndInherited.getPointer() != nullptr;
}
/// \brief Retrieve the default argument, if any.
@@ -1123,7 +1125,7 @@ public:
/// \brief Removes the default argument of this template parameter.
void removeDefaultArgument() {
- DefaultArgumentAndInherited.setPointer(0);
+ DefaultArgumentAndInherited.setPointer(nullptr);
DefaultArgumentAndInherited.setInt(false);
}
@@ -1410,7 +1412,7 @@ class ClassTemplateSpecializationDecl
SourceLocation TemplateKeywordLoc;
ExplicitSpecializationInfo()
- : TypeAsWritten(0), ExternLoc(), TemplateKeywordLoc() {}
+ : TypeAsWritten(nullptr), ExternLoc(), TemplateKeywordLoc() {}
};
/// \brief Further info for explicit template specialization/instantiation.
@@ -1595,7 +1597,7 @@ public:
/// \brief Gets the type of this specialization as it was written by
/// the user, if it was so written.
TypeSourceInfo *getTypeAsWritten() const {
- return ExplicitInfo ? ExplicitInfo->TypeAsWritten : 0;
+ return ExplicitInfo ? ExplicitInfo->TypeAsWritten : nullptr;
}
/// \brief Gets the location of the extern keyword, if present.
@@ -1676,7 +1678,8 @@ class ClassTemplatePartialSpecializationDecl
ClassTemplatePartialSpecializationDecl()
: ClassTemplateSpecializationDecl(ClassTemplatePartialSpecialization),
- TemplateParams(0), ArgsAsWritten(0), InstantiatedFromMember(0, false) { }
+ TemplateParams(nullptr), ArgsAsWritten(nullptr),
+ InstantiatedFromMember(nullptr, false) {}
public:
static ClassTemplatePartialSpecializationDecl *
@@ -1840,8 +1843,8 @@ protected:
: RedeclarableTemplateDecl(ClassTemplate, DC, L, Name, Params, Decl) { }
ClassTemplateDecl(EmptyShell Empty)
- : RedeclarableTemplateDecl(ClassTemplate, 0, SourceLocation(),
- DeclarationName(), 0, 0) { }
+ : RedeclarableTemplateDecl(ClassTemplate, nullptr, SourceLocation(),
+ DeclarationName(), nullptr, nullptr) { }
CommonBase *newCommon(ASTContext &C) const override;
@@ -2042,7 +2045,7 @@ private:
FriendTemplateDecl(EmptyShell Empty)
: Decl(Decl::FriendTemplate, Empty),
NumParams(0),
- Params(0)
+ Params(nullptr)
{}
public:
@@ -2275,7 +2278,7 @@ class VarTemplateSpecializationDecl : public VarDecl,
SourceLocation TemplateKeywordLoc;
ExplicitSpecializationInfo()
- : TypeAsWritten(0), ExternLoc(), TemplateKeywordLoc() {}
+ : TypeAsWritten(nullptr), ExternLoc(), TemplateKeywordLoc() {}
};
/// \brief Further info for explicit template specialization/instantiation.
@@ -2456,7 +2459,7 @@ public:
/// \brief Gets the type of this specialization as it was written by
/// the user, if it was so written.
TypeSourceInfo *getTypeAsWritten() const {
- return ExplicitInfo ? ExplicitInfo->TypeAsWritten : 0;
+ return ExplicitInfo ? ExplicitInfo->TypeAsWritten : nullptr;
}
/// \brief Gets the location of the extern keyword, if present.
@@ -2530,8 +2533,9 @@ class VarTemplatePartialSpecializationDecl
const ASTTemplateArgumentListInfo *ArgInfos);
VarTemplatePartialSpecializationDecl()
- : VarTemplateSpecializationDecl(VarTemplatePartialSpecialization),
- TemplateParams(0), ArgsAsWritten(0), InstantiatedFromMember(0, false) {}
+ : VarTemplateSpecializationDecl(VarTemplatePartialSpecialization),
+ TemplateParams(nullptr), ArgsAsWritten(nullptr),
+ InstantiatedFromMember(nullptr, false) {}
public:
static VarTemplatePartialSpecializationDecl *
@@ -2677,8 +2681,8 @@ protected:
: RedeclarableTemplateDecl(VarTemplate, DC, L, Name, Params, Decl) {}
VarTemplateDecl(EmptyShell Empty)
- : RedeclarableTemplateDecl(VarTemplate, 0, SourceLocation(),
- DeclarationName(), 0, 0) {}
+ : RedeclarableTemplateDecl(VarTemplate, nullptr, SourceLocation(),
+ DeclarationName(), nullptr, nullptr) {}
CommonBase *newCommon(ASTContext &C) const override;
diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h
index 00766c27c1..ab1575c220 100644
--- a/include/clang/AST/DeclarationName.h
+++ b/include/clang/AST/DeclarationName.h
@@ -116,20 +116,20 @@ private:
NameKind Kind = getNameKind();
if (Kind >= CXXConstructorName && Kind <= CXXConversionFunctionName)
return reinterpret_cast<CXXSpecialName *>(Ptr & ~PtrMask);
- return 0;
+ return nullptr;
}
/// getAsCXXOperatorIdName
CXXOperatorIdName *getAsCXXOperatorIdName() const {
if (getNameKind() == CXXOperatorName)
return reinterpret_cast<CXXOperatorIdName *>(Ptr & ~PtrMask);
- return 0;
+ return nullptr;
}
CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName() const {
if (getNameKind() == CXXLiteralOperatorName)
return reinterpret_cast<CXXLiteralOperatorIdName *>(Ptr & ~PtrMask);
- return 0;
+ return nullptr;
}
// Construct a declaration name from the name of a C++ constructor,
@@ -221,7 +221,7 @@ public:
IdentifierInfo *getAsIdentifierInfo() const {
if (isIdentifier())
return reinterpret_cast<IdentifierInfo *>(Ptr);
- return 0;
+ return nullptr;
}
/// getAsOpaqueInteger - Get the representation of this declaration
diff --git a/include/clang/AST/DependentDiagnostic.h b/include/clang/AST/DependentDiagnostic.h
index 0c783d2428..63047ec4db 100644
--- a/include/clang/AST/DependentDiagnostic.h
+++ b/include/clang/AST/DependentDiagnostic.h
@@ -123,7 +123,7 @@ private:
/// An iterator over the dependent diagnostics in a dependent context.
class DeclContext::ddiag_iterator {
public:
- ddiag_iterator() : Ptr(0) {}
+ ddiag_iterator() : Ptr(nullptr) {}
explicit ddiag_iterator(DependentDiagnostic *Ptr) : Ptr(Ptr) {}
typedef DependentDiagnostic *value_type;
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 729f8ba7de..fb1ce33abf 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -293,8 +293,8 @@ public:
/// \param Loc [in,out] - A source location which *may* be filled
/// in with the location of the expression making this a
/// non-modifiable lvalue, if specified.
- isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
- SourceLocation *Loc = 0) const;
+ isModifiableLvalueResult
+ isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc = nullptr) const;
/// \brief The return type of classify(). Represents the C++11 expression
/// taxonomy.
@@ -372,7 +372,7 @@ public:
/// lvalues and xvalues are collectively referred to as glvalues, while
/// prvalues and xvalues together form rvalues.
Classification Classify(ASTContext &Ctx) const {
- return ClassifyImpl(Ctx, 0);
+ return ClassifyImpl(Ctx, nullptr);
}
/// \brief ClassifyModifiable - Classify this expression according to the
@@ -483,10 +483,10 @@ public:
/// Note: This does not perform the implicit conversions required by C++11
/// [expr.const]p5.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx,
- SourceLocation *Loc = 0,
+ SourceLocation *Loc = nullptr,
bool isEvaluated = true) const;
bool isIntegerConstantExpr(const ASTContext &Ctx,
- SourceLocation *Loc = 0) const;
+ SourceLocation *Loc = nullptr) const;
/// isCXX98IntegralConstantExpr - Return true if this expression is an
/// integral constant expression in C++98. Can only be used in C++.
@@ -497,8 +497,8 @@ public:
///
/// Note: This does not perform the implicit conversions required by C++11
/// [expr.const]p5.
- bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result = 0,
- SourceLocation *Loc = 0) const;
+ bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result = nullptr,
+ SourceLocation *Loc = nullptr) const;
/// isPotentialConstantExpr - Return true if this function's definition
/// might be usable in a constant expression in C++11, if it were marked
@@ -537,7 +537,7 @@ public:
/// expression *is* a constant expression, no notes will be produced.
SmallVectorImpl<PartialDiagnosticAt> *Diag;
- EvalStatus() : HasSideEffects(false), Diag(0) {}
+ EvalStatus() : HasSideEffects(false), Diag(nullptr) {}
// hasSideEffects - Return true if the evaluated expression has
// side effects.
@@ -594,7 +594,7 @@ public:
/// integer. This must be called on an expression that constant folds to an
/// integer.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx,
- SmallVectorImpl<PartialDiagnosticAt> *Diag=0) const;
+ SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr) const;
void EvaluateForOverflow(const ASTContext &Ctx) const;
@@ -814,7 +814,7 @@ class OpaqueValueExpr : public Expr {
public:
OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK,
ExprObjectKind OK = OK_Ordinary,
- Expr *SourceExpr = 0)
+ Expr *SourceExpr = nullptr)
: Expr(OpaqueValueExprClass, T, VK, OK,
T->isDependentType(),
T->isDependentType() ||
@@ -958,25 +958,19 @@ public:
computeDependence(D->getASTContext());
}
- static DeclRefExpr *Create(const ASTContext &Context,
- NestedNameSpecifierLoc QualifierLoc,
- SourceLocation TemplateKWLoc,
- ValueDecl *D,
- bool isEnclosingLocal,
- SourceLocation NameLoc,
- QualType T, ExprValueKind VK,
- NamedDecl *FoundD = 0,
- const TemplateArgumentListInfo *TemplateArgs = 0);
-
- static DeclRefExpr *Create(const ASTContext &Context,
- NestedNameSpecifierLoc QualifierLoc,
- SourceLocation TemplateKWLoc,
- ValueDecl *D,
- bool isEnclosingLocal,
- const DeclarationNameInfo &NameInfo,
- QualType T, ExprValueKind VK,
- NamedDecl *FoundD = 0,
- const TemplateArgumentListInfo *TemplateArgs = 0);
+ static DeclRefExpr *
+ Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
+ SourceLocation TemplateKWLoc, ValueDecl *D, bool isEnclosingLocal,
+ SourceLocation NameLoc, QualType T, ExprValueKind VK,
+ NamedDecl *FoundD = nullptr,
+ const TemplateArgumentListInfo *TemplateArgs = nullptr);
+
+ static DeclRefExpr *
+ Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc,
+ SourceLocation TemplateKWLoc, ValueDecl *D, bool isEnclosingLocal,
+ const DeclarationNameInfo &NameInfo, QualType T, ExprValueKind VK,
+ NamedDecl *FoundD = nullptr,
+ const TemplateArgumentListInfo *TemplateArgs = nullptr);
/// \brief Construct an empty declaration reference expression.
static DeclRefExpr *CreateEmpty(const ASTContext &Context,
@@ -1006,7 +1000,7 @@ public:
/// that precedes the name. Otherwise, returns NULL.
NestedNameSpecifier *getQualifier() const {
if (!hasQualifier())
- return 0;
+ return nullptr;
return getInternalQualifierLoc().getNestedNameSpecifier();
}
@@ -1042,7 +1036,7 @@ public:
/// \brief Return the optional template keyword and arguments info.
ASTTemplateKWAndArgsInfo *getTemplateKWAndArgsInfo() {
if (!hasTemplateKWAndArgsInfo())
- return 0;
+ return nullptr;
if (hasFoundDecl())
return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
@@ -1106,7 +1100,7 @@ public:
/// This points to the same data as getExplicitTemplateArgs(), but
/// returns null if there are no explicit template arguments.
const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() const {
- if (!hasExplicitTemplateArgs()) return 0;
+ if (!hasExplicitTemplateArgs()) return nullptr;
return &getExplicitTemplateArgs();
}
@@ -1121,7 +1115,7 @@ public:
/// template-id.
const TemplateArgumentLoc *getTemplateArgs() const {
if (!hasExplicitTemplateArgs())
- return 0;
+ return nullptr;
return getExplicitTemplateArgs().getTemplateArgs();
}
@@ -1884,7 +1878,7 @@ private:
explicit OffsetOfExpr(unsigned numComps, unsigned numExprs)
: Expr(OffsetOfExprClass, EmptyShell()),
- TSInfo(0), NumComps(numComps), NumExprs(numExprs) {}
+ TSInfo(nullptr), NumComps(numComps), NumExprs(numExprs) {}
public:
@@ -2421,14 +2415,14 @@ public:
/// \brief Determines whether this member expression actually had
/// a C++ nested-name-specifier prior to the name of the member, e.g.,
/// x->Base::foo.
- bool hasQualifier() const { return getQualifier() != 0; }
+ bool hasQualifier() const { return getQualifier() != nullptr; }
/// \brief If the member name was qualified, retrieves the
/// nested-name-specifier that precedes the member name. Otherwise, returns
/// NULL.
NestedNameSpecifier *getQualifier() const {
if (!HasQualifierOrFoundDecl)
- return 0;
+ return nullptr;
return getMemberQualifier()->QualifierLoc.getNestedNameSpecifier();
}
@@ -2446,7 +2440,7 @@ public:
/// \brief Return the optional template keyword and arguments info.
ASTTemplateKWAndArgsInfo *getTemplateKWAndArgsInfo() {
if (!HasTemplateKWAndArgsInfo)
- return 0;
+ return nullptr;
if (!HasQualifierOrFoundDecl)
return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(this + 1);
@@ -2514,7 +2508,7 @@ public:
/// This points to the same data as getExplicitTemplateArgs(), but
/// returns null if there are no explicit template arguments.
const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() const {
- if (!hasExplicitTemplateArgs()) return 0;
+ if (!hasExplicitTemplateArgs()) return nullptr;
return &getExplicitTemplateArgs();
}
@@ -2522,7 +2516,7 @@ public:
/// template-id.
const TemplateArgumentLoc *getTemplateArgs() const {
if (!hasExplicitTemplateArgs())
- return 0;
+ return nullptr;
return getExplicitTemplateArgs().getTemplateArgs();
}
@@ -3449,7 +3443,7 @@ public:
/// \brief Build an empty vector-shuffle expression.
explicit ShuffleVectorExpr(EmptyShell Empty)
- : Expr(ShuffleVectorExprClass, Empty), SubExprs(0) { }
+ : Expr(ShuffleVectorExprClass, Empty), SubExprs(nullptr) { }
SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; }
@@ -3859,8 +3853,8 @@ public:
return const_cast<InitListExpr *>(this)->getInitializedFieldInUnion();
}
void setInitializedFieldInUnion(FieldDecl *FD) {
- assert((FD == 0
- || getInitializedFieldInUnion() == 0
+ assert((FD == nullptr
+ || getInitializedFieldInUnion() == nullptr
|| getInitializedFieldInUnion() == FD)
&& "Only one field of a union may be initialized at a time!");
ArrayFillerOrUnionFieldInit = FD;
@@ -3883,10 +3877,10 @@ public:
bool isSemanticForm() const { return AltForm.getInt(); }
InitListExpr *getSemanticForm() const {
- return isSemanticForm() ? 0 : AltForm.getPointer();
+ return isSemanticForm() ? nullptr : AltForm.getPointer();
}
InitListExpr *getSyntacticForm() const {
- return isSemanticForm() ? AltForm.getPointer() : 0;
+ return isSemanticForm() ? AltForm.getPointer() : nullptr;
}
void setSyntacticForm(InitListExpr *Init) {
@@ -3988,7 +3982,7 @@ private:
explicit DesignatedInitExpr(unsigned NumSubExprs)
: Expr(DesignatedInitExprClass, EmptyShell()),
- NumDesignators(0), NumSubExprs(NumSubExprs), Designators(0) { }
+ NumDesignators(0), NumSubExprs(NumSubExprs), Designators(nullptr) { }
public:
/// A field designator, e.g., ".x".
@@ -4085,7 +4079,7 @@ public:
FieldDecl *getField() const {
assert(Kind == FieldDesignator && "Only valid on a field designator");
if (Field.NameOrField & 0x01)
- return 0;
+ return nullptr;
else
return reinterpret_cast<FieldDecl *>(Field.NameOrField);
}
@@ -4677,7 +4671,7 @@ public:
/// Return the result-bearing expression, or null if there is none.
Expr *getResultExpr() {
if (PseudoObjectExprBits.ResultIndex == 0)
- return 0;
+ return nullptr;
return getSubExprsBuffer()[PseudoObjectExprBits.ResultIndex];
}
const Expr *getResultExpr() const {
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 2381fd9dbc..3cc00480b9 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -486,7 +486,7 @@ class CXXStdInitializerListExpr : public Expr {
Stmt *SubExpr;
CXXStdInitializerListExpr(EmptyShell Empty)
- : Expr(CXXStdInitializerListExprClass, Empty), SubExpr(0) {}
+ : Expr(CXXStdInitializerListExprClass, Empty), SubExpr(nullptr) {}
public:
CXXStdInitializerListExpr(QualType Ty, Expr *SubExpr)
@@ -553,9 +553,9 @@ public:
CXXTypeidExpr(EmptyShell Empty, bool isExpr)
: Expr(CXXTypeidExprClass, Empty) {
if (isExpr)
- Operand = (Expr*)0;
+ Operand = (Expr*)nullptr;
else
- Operand = (TypeSourceInfo*)0;
+ Operand = (TypeSourceInfo*)nullptr;
}
/// Determine whether this typeid has a type operand which is potentially
@@ -692,9 +692,9 @@ public:
CXXUuidofExpr(EmptyShell Empty, bool isExpr)
: Expr(CXXUuidofExprClass, Empty) {
if (isExpr)
- Operand = (Expr*)0;
+ Operand = (Expr*)nullptr;
else
- Operand = (TypeSourceInfo*)0;
+ Operand = (TypeSourceInfo*)nullptr;
}
bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); }
@@ -738,7 +738,7 @@ public:
/// Grabs __declspec(uuid()) off a type, or returns 0 if we cannot resolve to
/// a single GUID.
static UuidAttr *GetUuidAttrOfType(QualType QT,
- bool *HasMultipleGUIDsPtr = 0);
+ bool *HasMultipleGUIDsPtr = nullptr);
// Iterators
child_range children() {
@@ -832,7 +832,7 @@ public:
SourceLocation getLocStart() const LLVM_READONLY { return ThrowLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
- if (getSubExpr() == 0)
+ if (!getSubExpr())
return ThrowLoc;
return getSubExpr()->getLocEnd();
}
@@ -1031,7 +1031,7 @@ class CXXBindTemporaryExpr : public Expr {
public:
CXXBindTemporaryExpr(EmptyShell Empty)
- : Expr(CXXBindTemporaryExprClass, Empty), Temp(0), SubExpr(0) {}
+ : Expr(CXXBindTemporaryExprClass, Empty), Temp(nullptr), SubExpr(nullptr) {}
static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp,
Expr* SubExpr);
@@ -1094,18 +1094,18 @@ protected:
/// \brief Construct an empty C++ construction expression.
CXXConstructExpr(StmtClass SC, EmptyShell Empty)
- : Expr(SC, Empty), Constructor(0), NumArgs(0), Elidable(false),
+ : Expr(SC, Empty), Constructor(nullptr), NumArgs(0), Elidable(false),
HadMultipleCandidates(false), ListInitialization(false),
- ZeroInitialization(false), ConstructKind(0), Args(0)
+ ZeroInitialization(false), ConstructKind(0), Args(nullptr)
{ }
public:
/// \brief Construct an empty C++ construction expression.
explicit CXXConstructExpr(EmptyShell Empty)
- : Expr(CXXConstructExprClass, Empty), Constructor(0),
+ : Expr(CXXConstructExprClass, Empty), Constructor(nullptr),
NumArgs(0), Elidable(false), HadMultipleCandidates(false),
ListInitialization(false), ZeroInitialization(false),
- ConstructKind(0), Args(0)
+ ConstructKind(0), Args(nullptr)
{ }
static CXXConstructExpr *Create(const ASTContext &C, QualType T,
@@ -1388,7 +1388,7 @@ public:
/// capture that is a pack expansion, or an invalid source
/// location to indicate that this is not a pack expansion.
Capture(SourceLocation Loc, bool Implicit,
- LambdaCaptureKind Kind, VarDecl *Var = 0,
+ LambdaCaptureKind Kind, VarDecl *Var = nullptr,
SourceLocation EllipsisLoc = SourceLocation());
/// \brief Determine the kind of capture.
@@ -1396,7 +1396,7 @@ public:
/// \brief Determine whether this capture handles the C++ \c this
/// pointer.
- bool capturesThis() const { return DeclAndBits.getPointer() == 0; }
+ bool capturesThis() const { return DeclAndBits.getPointer() == nullptr; }
/// \brief Determine whether this capture handles a variable.
bool capturesVariable() const {
@@ -1465,7 +1465,7 @@ private:
: Expr(LambdaExprClass, Empty),
NumCaptures(NumCaptures), CaptureDefault(LCD_None), ExplicitParams(false),
ExplicitResultType(false), HasArrayIndexVars(true) {
- getStoredStmts()[NumCaptures] = 0;
+ getStoredStmts()[NumCaptures] = nullptr;
}
Stmt **getStoredStmts() const {
@@ -1720,7 +1720,7 @@ public:
QualType ty, TypeSourceInfo *AllocatedTypeInfo,
SourceRange Range, SourceRange directInitRange);
explicit CXXNewExpr(EmptyShell Shell)
- : Expr(CXXNewExprClass, Shell), SubExprs(0) { }
+ : Expr(CXXNewExprClass, Shell), SubExprs(nullptr) { }
void AllocateArgsArray(const ASTContext &C, bool isArray,
unsigned numPlaceArgs, bool hasInitializer);
@@ -1754,10 +1754,10 @@ public:
bool isArray() const { return Array; }
Expr *getArraySize() {
- return Array ? cast<Expr>(SubExprs[0]) : 0;
+ return Array ? cast<Expr>(SubExprs[0]) : nullptr;
}
const Expr *getArraySize() const {
- return Array ? cast<Expr>(SubExprs[0]) : 0;
+ return Array ? cast<Expr>(SubExprs[0]) : nullptr;
}
unsigned getNumPlacementArgs() const { return NumPlacementArgs; }
@@ -1791,10 +1791,10 @@ public:
/// \brief The initializer of this new-expression.
Expr *getInitializer() {
- return hasInitializer() ? cast<Expr>(SubExprs[Array]) : 0;
+ return hasInitializer() ? cast<Expr>(SubExprs[Array]) : nullptr;
}
const Expr *getInitializer() const {
- return hasInitializer() ? cast<Expr>(SubExprs[Array]) : 0;
+ return hasInitializer() ? cast<Expr>(SubExprs[Array]) : nullptr;
}
/// \brief Returns the CXXConstructExpr from this new-expression, or null.
@@ -1888,7 +1888,8 @@ public:
ArrayForm(arrayForm), ArrayFormAsWritten(arrayFormAsWritten),
UsualArrayDeleteWantsSize(usualArrayDeleteWantsSize) { }
explicit CXXDeleteExpr(EmptyShell Shell)
- : Expr(CXXDeleteExprClass, Shell), OperatorDelete(0), Argument(0) { }
+ : Expr(CXXDeleteExprClass, Shell), OperatorDelete(nullptr),
+ Argument(nullptr) {}
bool isGlobalDelete() const { return GlobalDelete; }
bool isArrayForm() const { return ArrayForm; }
@@ -2020,7 +2021,7 @@ public:
explicit CXXPseudoDestructorExpr(EmptyShell Shell)
: Expr(CXXPseudoDestructorExprClass, Shell),
- Base(0), IsArrow(false), QualifierLoc(), ScopeType(0) { }
+ Base(nullptr), IsArrow(false), QualifierLoc(), ScopeType(nullptr) { }
Expr *getBase() const { return cast<Expr>(Base); }
@@ -2381,7 +2382,7 @@ protected:
bool KnownContainsUnexpandedParameterPack);
OverloadExpr(StmtClass K, EmptyShell Empty)
- : Expr(K, Empty), QualifierLoc(), Results(0), NumResults(0),
+ : Expr(K, Empty), QualifierLoc(), Results(nullptr), NumResults(0),
HasTemplateKWAndArgsInfo(false) { }
void initializeResults(const ASTContext &C,
@@ -2514,7 +2515,7 @@ public:
/// This points to the same data as getExplicitTemplateArgs(), but
/// returns null if there are no explicit template arguments.
const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() const {
- if (!hasExplicitTemplateArgs()) return 0;
+ if (!hasExplicitTemplateArgs()) return nullptr;
return &getExplicitTemplateArgs();
}
@@ -2571,7 +2572,7 @@ class UnresolvedLookupExpr : public OverloadExpr {
UnresolvedLookupExpr(EmptyShell Empty)
: OverloadExpr(UnresolvedLookupExprClass, Empty),
- RequiresADL(false), Overloaded(false), NamingClass(0)
+ RequiresADL(false), Overloaded(false), NamingClass(nullptr)
{}
friend class ASTStmtReader;
@@ -2586,7 +2587,7 @@ public:
UnresolvedSetIterator End) {
return new(C) UnresolvedLookupExpr(C, NamingClass, QualifierLoc,
SourceLocation(), NameInfo,
- ADL, Overloaded, 0, Begin, End);
+ ADL, Overloaded, nullptr, Begin, End);
}
static UnresolvedLookupExpr *Create(const ASTContext &C,
@@ -2661,7 +2662,7 @@ class DependentScopeDeclRefExpr : public Expr {
/// \brief Return the optional template keyword and arguments info.
ASTTemplateKWAndArgsInfo *getTemplateKWAndArgsInfo() {
- if (!HasTemplateKWAndArgsInfo) return 0;
+ if (!HasTemplateKWAndArgsInfo) return nullptr;
return reinterpret_cast<ASTTemplateKWAndArgsInfo*>(this + 1);
}
/// \brief Return the optional template keyword and arguments info.
@@ -2755,7 +2756,7 @@ public:
/// This points to the same data as getExplicitTemplateArgs(), but
/// returns null if there are no explicit template arguments.
const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() const {
- if (!hasExplicitTemplateArgs()) return 0;
+ if (!hasExplicitTemplateArgs()) return nullptr;
return &getExplicitTemplateArgs();
}
@@ -3031,7 +3032,7 @@ class CXXDependentScopeMemberExpr : public Expr {
/// \brief Return the optional template keyword and arguments info.
ASTTemplateKWAndArgsInfo *getTemplateKWAndArgsInfo() {
- if (!HasTemplateKWAndArgsInfo) return 0;
+ if (!HasTemplateKWAndArgsInfo) return nullptr;
return reinterpret_cast<ASTTemplateKWAndArgsInfo*>(this + 1);
}
/// \brief Return the optional template keyword and arguments info.
@@ -3176,7 +3177,7 @@ public:
/// This points to the same data as getExplicitTemplateArgs(), but
/// returns null if there are no explicit template arguments.
const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() const {
- if (!hasExplicitTemplateArgs()) return 0;
+ if (!hasExplicitTemplateArgs()) return nullptr;
return &getExplicitTemplateArgs();
}
@@ -3278,7 +3279,7 @@ class UnresolvedMemberExpr : public OverloadExpr {
UnresolvedMemberExpr(EmptyShell Empty)
: OverloadExpr(UnresolvedMemberExprClass, Empty), IsArrow(false),
- HasUnresolvedUsing(false), Base(0) { }
+ HasUnresolvedUsing(false), Base(nullptr) { }
friend class ASTStmtReader;
@@ -3492,7 +3493,7 @@ public:
};
inline ASTTemplateKWAndArgsInfo *OverloadExpr::getTemplateKWAndArgsInfo() {
- if (!HasTemplateKWAndArgsInfo) return 0;
+ if (!HasTemplateKWAndArgsInfo) return nullptr;
if (isa<UnresolvedLookupExpr>(this))
return reinterpret_cast<ASTTemplateKWAndArgsInfo*>
(cast<UnresolvedLookupExpr>(this) + 1);
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index fc78e893e0..817c0cc431 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -277,14 +277,14 @@ class ObjCDictionaryLiteral : public Expr {
ExpansionData *getExpansionData() {
if (!HasPackExpansions)
- return 0;
+ return nullptr;
return reinterpret_cast<ExpansionData *>(getKeyValues() + NumElements);
}
const ExpansionData *getExpansionData() const {
if (!HasPackExpansions)
- return 0;
+ return nullptr;
return reinterpret_cast<const ExpansionData *>(getKeyValues()+NumElements);
}
@@ -743,7 +743,7 @@ private:
void setExplicitProperty(ObjCPropertyDecl *D, unsigned methRefFlags) {
PropertyOrGetter.setPointer(D);
PropertyOrGetter.setInt(false);
- SetterAndMethodRefFlags.setPointer(0);
+ SetterAndMethodRefFlags.setPointer(nullptr);
SetterAndMethodRefFlags.setInt(methRefFlags);
}
void setImplicitProperty(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
@@ -1174,7 +1174,7 @@ public:
if (getReceiverKind() == Instance)
return static_cast<Expr *>(getReceiverPointer());
- return 0;
+ return nullptr;
}
const Expr *getInstanceReceiver() const {
return const_cast<ObjCMessageExpr*>(this)->getInstanceReceiver();
@@ -1201,7 +1201,7 @@ public:
TypeSourceInfo *getClassReceiverTypeInfo() const {
if (getReceiverKind() == Class)
return reinterpret_cast<TypeSourceInfo *>(getReceiverPointer());
- return 0;
+ return nullptr;
}
void setClassReceiver(TypeSourceInfo *TSInfo) {
@@ -1270,14 +1270,14 @@ public:
if (HasMethod)
return reinterpret_cast<const ObjCMethodDecl *>(SelectorOrMethod);
- return 0;
+ return nullptr;
}
ObjCMethodDecl *getMethodDecl() {
if (HasMethod)
return reinterpret_cast<ObjCMethodDecl *>(SelectorOrMethod);
- return 0;
+ return nullptr;
}
void setMethodDecl(ObjCMethodDecl *MD) {
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index 54e96d99bc..584f4adedd 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -138,7 +138,7 @@ public:
virtual void completeVisibleDeclsMap(const DeclContext *DC);
/// \brief Retrieve the module that corresponds to the given module ID.
- virtual Module *getModule(unsigned ID) { return 0; }
+ virtual Module *getModule(unsigned ID) { return nullptr; }
/// \brief Finds all declarations lexically contained within the given
/// DeclContext, after applying an optional filter predicate.
@@ -160,7 +160,7 @@ public:
/// \return true if an error occurred
ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
SmallVectorImpl<Decl*> &Result) {
- return FindExternalLexicalDecls(DC, 0, Result);
+ return FindExternalLexicalDecls(DC, nullptr, Result);
}
template <typename DeclTy>
@@ -519,7 +519,7 @@ public:
if (From.Position < 0) {
Loaded.erase(Loaded.end() + From.Position, Loaded.end());
- From = begin(0, true);
+ From = begin(nullptr, true);
}
Local.erase(Local.begin() + From.Position, Local.begin() + To.Position);
diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h
index b332b153fe..fc719bdc16 100644
--- a/include/clang/AST/NestedNameSpecifier.h
+++ b/include/clang/AST/NestedNameSpecifier.h
@@ -88,7 +88,8 @@ public:
private:
/// \brief Builds the global specifier.
- NestedNameSpecifier() : Prefix(0, StoredIdentifier), Specifier(0) { }
+ NestedNameSpecifier()
+ : Prefix(nullptr, StoredIdentifier), Specifier(nullptr) {}
/// \brief Copy constructor used internally to clone nested name
/// specifiers.
@@ -160,7 +161,7 @@ public:
if (Prefix.getInt() == StoredIdentifier)
return (IdentifierInfo *)Specifier;
- return 0;
+ return nullptr;
}
/// \brief Retrieve the namespace stored in this nested name
@@ -177,7 +178,7 @@ public:
Prefix.getInt() == StoredTypeSpecWithTemplate)
return (const Type *)Specifier;
- return 0;
+ return nullptr;
}
/// \brief Whether this nested name specifier refers to a dependent
@@ -222,7 +223,7 @@ class NestedNameSpecifierLoc {
public:
/// \brief Construct an empty nested-name-specifier.
- NestedNameSpecifierLoc() : Qualifier(0), Data(0) { }
+ NestedNameSpecifierLoc() : Qualifier(nullptr), Data(nullptr) { }
/// \brief Construct a nested-name-specifier with source location information
/// from
@@ -344,7 +345,8 @@ class NestedNameSpecifierLocBuilder {
public:
NestedNameSpecifierLocBuilder()
- : Representation(0), Buffer(0), BufferSize(0), BufferCapacity(0) { }
+ : Representation(nullptr), Buffer(nullptr), BufferSize(0),
+ BufferCapacity(0) {}
NestedNameSpecifierLocBuilder(const NestedNameSpecifierLocBuilder &Other);
@@ -457,7 +459,7 @@ public:
/// \brief Clear out this builder, and prepare it to build another
/// nested-name-specifier with source-location information.
void Clear() {
- Representation = 0;
+ Representation = nullptr;
BufferSize = 0;
}
diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h
index 392eb9a281..108238c092 100644
--- a/include/clang/AST/OpenMPClause.h
+++ b/include/clang/AST/OpenMPClause.h
@@ -179,7 +179,7 @@ public:
///
OMPIfClause()
: OMPClause(OMPC_if, SourceLocation(), SourceLocation()),
- LParenLoc(SourceLocation()), Condition(0) {}
+ LParenLoc(SourceLocation()), Condition(nullptr) {}
/// \brief Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -233,7 +233,7 @@ public:
///
OMPNumThreadsClause()
: OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()),
- LParenLoc(SourceLocation()), NumThreads(0) {}
+ LParenLoc(SourceLocation()), NumThreads(nullptr) {}
/// \brief Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -289,7 +289,7 @@ public:
///
explicit OMPSafelenClause()
: OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()),
- LParenLoc(SourceLocation()), Safelen(0) {}
+ LParenLoc(SourceLocation()), Safelen(nullptr) {}
/// \brief Sets the location of '('.
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
diff --git a/include/clang/AST/ParentMap.h b/include/clang/AST/ParentMap.h
index bd2ebf5dbe..eece8510e9 100644
--- a/include/clang/AST/ParentMap.h
+++ b/include/clang/AST/ParentMap.h
@@ -53,7 +53,7 @@ public:
}
bool hasParent(Stmt* S) const {
- return getParent(S) != 0;
+ return getParent(S) != nullptr;
}
bool isConsumedExpr(Expr *E) const;
diff --git a/include/clang/AST/Redeclarable.h b/include/clang/AST/Redeclarable.h
index 1170eda819..1006566e6d 100644
--- a/include/clang/AST/Redeclarable.h
+++ b/include/clang/AST/Redeclarable.h
@@ -66,7 +66,7 @@ public:
decl_type *getPreviousDecl() {
if (RedeclLink.NextIsPrevious())
return RedeclLink.getNext();
- return 0;
+ return nullptr;
}
const decl_type *getPreviousDecl() const {
return const_cast<decl_type *>(
@@ -122,7 +122,7 @@ public:
typedef std::forward_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
- redecl_iterator() : Current(0) { }
+ redecl_iterator() : Current(nullptr) { }
explicit redecl_iterator(decl_type *C)
: Current(C), Starter(C), PassedFirst(false) { }
@@ -135,7 +135,7 @@ public:
if (Current->isFirstDecl()) {
if (PassedFirst) {
assert(0 && "Passed first decl twice, invalid redecl chain!");
- Current = 0;
+ Current = nullptr;
return *this;
}
PassedFirst = true;
@@ -143,7 +143,7 @@ public:
// Get either previous decl or latest decl.
decl_type *Next = Current->RedeclLink.getNext();
- Current = (Next != Starter ? Next : 0);
+ Current = (Next != Starter) ? Next : nullptr;
return *this;
}
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index ae34f42724..10afca4fbd 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -62,7 +62,7 @@ namespace clang {
Stmt** I;
public:
ExprIterator(Stmt** i) : I(i) {}
- ExprIterator() : I(0) {}
+ ExprIterator() : I(nullptr) {}
ExprIterator& operator++() { ++I; return *this; }
ExprIterator operator-(size_t i) { return I-i; }
ExprIterator operator+(size_t i) { return I+i; }
@@ -81,7 +81,7 @@ namespace clang {
const Stmt * const *I;
public:
ConstExprIterator(const Stmt * const *i) : I(i) {}
- ConstExprIterator() : I(0) {}
+ ConstExprIterator() : I(nullptr) {}
ConstExprIterator& operator++() { ++I; return *this; }
ConstExprIterator operator+(size_t i) const { return I+i; }
ConstExprIterator operator-(size_t i) const { return I-i; }
@@ -555,13 +555,13 @@ public:
// \brief Build an empty compound statement with a location.
explicit CompoundStmt(SourceLocation Loc)
- : Stmt(CompoundStmtClass), Body(0), LBracLoc(Loc), RBracLoc(Loc) {
+ : Stmt(CompoundStmtClass), Body(nullptr), LBracLoc(Loc), RBracLoc(Loc) {
CompoundStmtBits.NumStmts = 0;
}
// \brief Build an empty compound statement.
explicit CompoundStmt(EmptyShell Empty)
- : Stmt(CompoundStmtClass, Empty), Body(0) {
+ : Stmt(CompoundStmtClass, Empty), Body(nullptr) {
CompoundStmtBits.NumStmts = 0;
}
@@ -576,7 +576,7 @@ public:
body_range body() { return body_range(body_begin(), body_end()); }
body_iterator body_begin() { return Body; }
body_iterator body_end() { return Body + size(); }
- Stmt *body_back() { return !body_empty() ? Body[size()-1] : 0; }
+ Stmt *body_back() { return !body_empty() ? Body[size()-1] : nullptr; }
void setLastStmt(Stmt *S) {
assert(!body_empty() && "setLastStmt");
@@ -591,7 +591,9 @@ public:
}
const_body_iterator body_begin() const { return Body; }
const_body_iterator body_end() const { return Body + size(); }
- const Stmt *body_back() const { return !body_empty() ? Body[size()-1] : 0; }
+ const Stmt *body_back() const {
+ return !body_empty() ? Body[size() - 1] : nullptr;
+ }
typedef std::reverse_iterator<body_iterator> reverse_body_iterator;
reverse_body_iterator body_rbegin() {
@@ -644,10 +646,11 @@ protected:
SourceLocation ColonLoc;
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
- : Stmt(SC), NextSwitchCase(0), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {}
+ : Stmt(SC), NextSwitchCase(nullptr), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {
+ }
SwitchCase(StmtClass SC, EmptyShell)
- : Stmt(SC), NextSwitchCase(0) {}
+ : Stmt(SC), NextSwitchCase(nullptr) {}
public:
const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
@@ -684,7 +687,7 @@ public:
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
SourceLocation ellipsisLoc, SourceLocation colonLoc)
: SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
- SubExprs[SUBSTMT] = 0;
+ SubExprs[SUBSTMT] = nullptr;
SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs);
SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs);
EllipsisLoc = ellipsisLoc;
@@ -866,7 +869,8 @@ class IfStmt : public Stmt {
public:
IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
- Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
+ Stmt *then, SourceLocation EL = SourceLocation(),
+ Stmt *elsev = nullptr);
/// \brief Build an empty if/then/else statement
explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { }
@@ -1334,7 +1338,8 @@ class ReturnStmt : public Stmt {
public:
ReturnStmt(SourceLocation RL)
- : Stmt(ReturnStmtClass), RetExpr(0), RetLoc(RL), NRVOCandidate(0) { }
+ : Stmt(ReturnStmtClass), RetExpr(nullptr), RetLoc(RL),
+ NRVOCandidate(nullptr) {}
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
: Stmt(ReturnStmtClass), RetExpr((Stmt*) E), RetLoc(RL),
@@ -1403,7 +1408,7 @@ protected:
public:
/// \brief Build an empty inline-assembly statement.
explicit AsmStmt(StmtClass SC, EmptyShell Empty) :
- Stmt(SC, Empty), Exprs(0) { }
+ Stmt(SC, Empty), Exprs(nullptr) { }
SourceLocation getAsmLoc() const { return AsmLoc; }
void setAsmLoc(SourceLocation L) { AsmLoc = L; }
@@ -1531,7 +1536,7 @@ public:
/// \brief Build an empty inline-assembly statement.
explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty),
- Constraints(0), Clobbers(0), Names(0) { }
+ Constraints(nullptr), Clobbers(nullptr), Names(nullptr) { }
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
@@ -1707,7 +1712,7 @@ public:
/// \brief Build an empty MS-style inline-assembly statement.
explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty),
- NumAsmToks(0), AsmToks(0), Constraints(0), Clobbers(0) { }
+ NumAsmToks(0), AsmToks(nullptr), Constraints(nullptr), Clobbers(nullptr) { }
SourceLocation getLBraceLoc() const { return LBraceLoc; }
void setLBraceLoc(SourceLocation L) { LBraceLoc = L; }
@@ -1942,11 +1947,12 @@ public:
///
/// \param Var The variable being captured, or null if capturing this.
///
- Capture(SourceLocation Loc, VariableCaptureKind Kind, VarDecl *Var = 0)
+ Capture(SourceLocation Loc, VariableCaptureKind Kind,
+ VarDecl *Var = nullptr)
: VarAndKind(Var, Kind), Loc(Loc) {
switch (Kind) {
case VCK_This:
- assert(Var == 0 && "'this' capture cannot have a variable!");
+ assert(!Var && "'this' capture cannot have a variable!");
break;
case VCK_ByRef:
assert(Var && "capturing by reference must have a variable!");
diff --git a/include/clang/AST/StmtCXX.h b/include/clang/AST/StmtCXX.h
index df98d41ad5..837dc45d12 100644
--- a/include/clang/AST/StmtCXX.h
+++ b/include/clang/AST/StmtCXX.h
@@ -39,7 +39,7 @@ public:
HandlerBlock(handlerBlock) {}
CXXCatchStmt(EmptyShell Empty)
- : Stmt(CXXCatchStmtClass), ExceptionDecl(0), HandlerBlock(0) {}
+ : Stmt(CXXCatchStmtClass), ExceptionDecl(nullptr), HandlerBlock(nullptr) {}
SourceLocation getLocStart() const LLVM_READONLY { return CatchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h
index a31632fab9..18c55166be 100644
--- a/include/clang/AST/StmtIterator.h
+++ b/include/clang/AST/StmtIterator.h
@@ -64,10 +64,10 @@ protected:
Stmt*& GetDeclExpr() const;
- StmtIteratorBase(Stmt **s) : stmt(s), DGI(0), RawVAPtr(0) {}
+ StmtIteratorBase(Stmt **s) : stmt(s), DGI(nullptr), RawVAPtr(0) {}
StmtIteratorBase(const VariableArrayType *t);
StmtIteratorBase(Decl **dgi, Decl **dge);
- StmtIteratorBase() : stmt(0), DGI(0), RawVAPtr(0) {}
+ StmtIteratorBase() : stmt(nullptr), DGI(nullptr), RawVAPtr(0) {}
};
diff --git a/include/clang/AST/StmtObjC.h b/include/clang/AST/StmtObjC.h
index bfb4a9b0bb..d0527e2d8b 100644
--- a/include/clang/AST/StmtObjC.h
+++ b/include/clang/AST/StmtObjC.h
@@ -107,7 +107,7 @@ public:
SourceLocation getLocStart() const LLVM_READONLY { return AtCatchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return Body->getLocEnd(); }
- bool hasEllipsis() const { return getCatchParamDecl() == 0; }
+ bool hasEllipsis() const { return getCatchParamDecl() == nullptr; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ObjCAtCatchStmtClass;
@@ -222,13 +222,13 @@ public:
/// \brief Retrieve the \@finally statement, if any.
const ObjCAtFinallyStmt *getFinallyStmt() const {
if (!HasFinally)
- return 0;
+ return nullptr;
return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
}
ObjCAtFinallyStmt *getFinallyStmt() {
if (!HasFinally)
- return 0;
+ return nullptr;
return cast_or_null<ObjCAtFinallyStmt>(getStmts()[1 + NumCatchStmts]);
}
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h
index abe106cb4e..d1f428ded2 100644
--- a/include/clang/AST/TemplateBase.h
+++ b/include/clang/AST/TemplateBase.h
@@ -204,7 +204,7 @@ public:
}
static TemplateArgument getEmptyPack() {
- return TemplateArgument((TemplateArgument*)0, 0);
+ return TemplateArgument((TemplateArgument*)nullptr, 0);
}
/// \brief Create a new template argument pack by copying the given set of
diff --git a/include/clang/AST/TemplateName.h b/include/clang/AST/TemplateName.h
index 0b9d4c8547..f2eab057e2 100644
--- a/include/clang/AST/TemplateName.h
+++ b/include/clang/AST/TemplateName.h
@@ -71,19 +71,19 @@ public:
OverloadedTemplateStorage *getAsOverloadedStorage() {
return Bits.Kind == Overloaded
? reinterpret_cast<OverloadedTemplateStorage *>(this)
- : 0;
+ : nullptr;
}
SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() {
return Bits.Kind == SubstTemplateTemplateParm
? reinterpret_cast<SubstTemplateTemplateParmStorage *>(this)
- : 0;
+ : nullptr;
}
SubstTemplateTemplateParmPackStorage *getAsSubstTemplateTemplateParmPack() {
return Bits.Kind == SubstTemplateTemplateParmPack
? reinterpret_cast<SubstTemplateTemplateParmPackStorage *>(this)
- : 0;
+ : nullptr;
}
};
@@ -243,7 +243,7 @@ public:
Storage.dyn_cast<UncommonTemplateNameStorage *>())
return Uncommon->getAsOverloadedStorage();
- return 0;
+ return nullptr;
}
/// \brief Retrieve the substituted template template parameter, if
@@ -256,7 +256,7 @@ public:
Storage.dyn_cast<UncommonTemplateNameStorage *>())
return uncommon->getAsSubstTemplateTemplateParm();
- return 0;
+ return nullptr;
}
/// \brief Retrieve the substituted template template parameter pack, if
@@ -270,7 +270,7 @@ public:
Storage.dyn_cast<UncommonTemplateNameStorage *>())
return Uncommon->getAsSubstTemplateTemplateParmPack();
- return 0;
+ return nullptr;
}
/// \brief Retrieve the underlying qualified template name
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 8f0f412074..c51fc15c4a 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -500,7 +500,7 @@ struct SplitQualType {
/// The local qualifiers.
Qualifiers Quals;
- SplitQualType() : Ty(0), Quals() {}
+ SplitQualType() : Ty(nullptr), Quals() {}
SplitQualType(const Type *ty, Qualifiers qs) : Ty(ty), Quals(qs) {}
SplitQualType getSingleStepDesugaredType() const; // end of this file
@@ -1438,7 +1438,7 @@ public:
/// \brief Def If non-NULL, and the type refers to some kind of declaration
/// that can be completed (such as a C struct, C++ class, or Objective-C
/// class), will be set to the declaration.
- bool isIncompleteType(NamedDecl **Def = 0) const;
+ bool isIncompleteType(NamedDecl **Def = nullptr) const;
/// isIncompleteOrObjectType - Return true if this is an incomplete or object
/// type, in other words, not a function type.
@@ -2850,14 +2850,16 @@ public:
ExtProtoInfo()
: Variadic(false), HasTrailingReturn(false), TypeQuals(0),
ExceptionSpecType(EST_None), RefQualifier(RQ_None), NumExceptions(0),
- Exceptions(0), NoexceptExpr(0), ExceptionSpecDecl(0),
- ExceptionSpecTemplate(0), ConsumedParameters(0) {}
+ Exceptions(nullptr), NoexceptExpr(nullptr),
+ ExceptionSpecDecl(nullptr), ExceptionSpecTemplate(nullptr),
+ ConsumedParameters(nullptr) {}
ExtProtoInfo(CallingConv CC)
: ExtInfo(CC), Variadic(false), HasTrailingReturn(false), TypeQuals(0),
ExceptionSpecType(EST_None), RefQualifier(RQ_None), NumExceptions(0),
- Exceptions(0), NoexceptExpr(0), ExceptionSpecDecl(0),
- ExceptionSpecTemplate(0), ConsumedParameters(0) {}
+ Exceptions(nullptr), NoexceptExpr(nullptr),
+ ExceptionSpecDecl(nullptr), ExceptionSpecTemplate(nullptr),
+ ConsumedParameters(nullptr) {}
FunctionType::ExtInfo ExtInfo;
bool Variadic : 1;
@@ -3011,7 +3013,7 @@ public:
}
Expr *getNoexceptExpr() const {
if (getExceptionSpecType() != EST_ComputedNoexcept)
- return 0;
+ return nullptr;
// NoexceptExpr sits where the arguments end.
return *reinterpret_cast<Expr *const *>(param_type_end());
}
@@ -3022,7 +3024,7 @@ public:
FunctionDecl *getExceptionSpecDecl() const {
if (getExceptionSpecType() != EST_Uninstantiated &&
getExceptionSpecType() != EST_Unevaluated)
- return 0;
+ return nullptr;
return reinterpret_cast<FunctionDecl *const *>(param_type_end())[0];
}
/// \brief If this function type has an uninstantiated exception
@@ -3031,7 +3033,7 @@ public:
/// this type.
FunctionDecl *getExceptionSpecTemplate() const {
if (getExceptionSpecType() != EST_Uninstantiated)
- return 0;
+ return nullptr;
return reinterpret_cast<FunctionDecl *const *>(param_type_end())[1];
}
/// \brief Determine whether this function type has a non-throwing exception
@@ -3519,7 +3521,7 @@ public:
bool isParameterPack() const { return getCanTTPTInfo().ParameterPack; }
TemplateTypeParmDecl *getDecl() const {
- return isCanonicalUnqualified() ? 0 : TTPDecl;
+ return isCanonicalUnqualified() ? nullptr : TTPDecl;
}
IdentifierInfo *getIdentifier() const;
@@ -4014,7 +4016,7 @@ class ElaboratedType : public TypeWithKeyword, public llvm::FoldingSetNode {
NamedType->isVariablyModifiedType(),
NamedType->containsUnexpandedParameterPack()),
NNS(NNS), NamedType(NamedType) {
- assert(!(Keyword == ETK_None && NNS == 0) &&
+ assert(!(Keyword == ETK_None && NNS == nullptr) &&
"ElaboratedType cannot have elaborated type keyword "
"and name qualifier both null.");
}
@@ -4456,7 +4458,7 @@ inline ObjCInterfaceDecl *ObjCObjectType::getInterface() const {
if (const ObjCInterfaceType *T =
getBaseType()->getAs<ObjCInterfaceType>())
return T->getDecl();
- return 0;
+ return nullptr;
}
/// ObjCObjectPointerType - Used to represent a pointer to an
@@ -4661,7 +4663,7 @@ inline const Type *QualType::getTypePtr() const {
}
inline const Type *QualType::getTypePtrOrNull() const {
- return (isNull() ? 0 : getCommonPtr()->BaseType);
+ return (isNull() ? nullptr : getCommonPtr()->BaseType);
}
inline SplitQualType QualType::split() const {
@@ -5050,7 +5052,7 @@ inline const BuiltinType *Type::getAsPlaceholderType() const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(this))
if (BT->isPlaceholderType())
return BT;
- return 0;
+ return nullptr;
}
inline bool Type::isSpecificPlaceholderType(unsigned K) const {
@@ -5205,7 +5207,7 @@ template <typename T> const T *Type::getAs() const {
// If the canonical form of this type isn't the right kind, reject it.
if (!isa<T>(CanonicalType))
- return 0;
+ return nullptr;
// If this is a typedef for the type, strip the typedef off without
// losing all typedef information.
@@ -5219,7 +5221,7 @@ inline const ArrayType *Type::getAsArrayTypeUnsafe() const {
// If the canonical form of this type isn't the right kind, reject it.
if (!isa<ArrayType>(CanonicalType))
- return 0;
+ return nullptr;
// If this is a typedef for the type, strip the typedef off without
// losing all typedef information.
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h
index a54aee8703..3648d2a5c2 100644
--- a/include/clang/AST/TypeLoc.h
+++ b/include/clang/AST/TypeLoc.h
@@ -81,7 +81,7 @@ public:
Qualified
};
- TypeLoc() : Ty(0), Data(0) { }
+ TypeLoc() : Ty(nullptr), Data(nullptr) { }
TypeLoc(QualType ty, void *opaqueData)
: Ty(ty.getAsOpaquePtr()), Data(opaqueData) { }
TypeLoc(const Type *ty, void *opaqueData)
@@ -631,7 +631,7 @@ public:
bool isDefinition() const {
TagDecl *D = getDecl();
return D->isCompleteDefinition() &&
- (D->getIdentifier() == 0 || D->getLocation() == getNameLoc());
+ (D->getIdentifier() == nullptr || D->getLocation() == getNameLoc());
}
};
@@ -786,7 +786,7 @@ public:
setAttrNameLoc(loc);
if (hasAttrExprOperand()) {
setAttrOperandParensRange(SourceRange(loc));
- setAttrExprOperand(0);
+ setAttrExprOperand(nullptr);
} else if (hasAttrEnumOperand()) {
setAttrOperandParensRange(SourceRange(loc));
setAttrEnumOperandLoc(loc);
@@ -1101,7 +1101,7 @@ public:
void initializeLocal(ASTContext &Context, SourceLocation Loc) {
setSigilLoc(Loc);
- setClassTInfo(0);
+ setClassTInfo(nullptr);
}
SourceRange getLocalSourceRange() const {
@@ -1238,7 +1238,7 @@ public:
setRParenLoc(Loc);
setLocalRangeEnd(Loc);
for (unsigned i = 0, e = getNumParams(); i != e; ++i)
- setParam(i, NULL);
+ setParam(i, nullptr);
}
/// \brief Returns the size of the type source info data block that is
@@ -1314,7 +1314,7 @@ public:
void initializeLocal(ASTContext &Context, SourceLocation Loc) {
setLBracketLoc(Loc);
setRBracketLoc(Loc);
- setSizeExpr(NULL);
+ setSizeExpr(nullptr);
}
QualType getInnerType() const { return getTypePtr()->getElementType(); }
@@ -1774,7 +1774,7 @@ public:
// template specialization type, we won't record the nested-name-specifier
// location information when this type-source location information is
// part of a nested-name-specifier.
- getLocalData()->QualifierData = 0;
+ getLocalData()->QualifierData = nullptr;
return;
}
diff --git a/include/clang/AST/VTableBuilder.h b/include/clang/AST/VTableBuilder.h
index 02132d8f8f..4e24bdd730 100644
--- a/include/clang/AST/VTableBuilder.h
+++ b/include/clang/AST/VTableBuilder.h
@@ -297,7 +297,7 @@ public:
ThunksMapTy::const_iterator I = Thunks.find(MD);
if (I == Thunks.end()) {
// We did not find a thunk for this method.
- return 0;
+ return nullptr;
}
return &I->second;
@@ -419,7 +419,7 @@ struct VPtrInfo {
/// The vptr is stored inside the non-virtual component of this virtual base.
const CXXRecordDecl *getVBaseWithVPtr() const {
- return ContainingVBases.empty() ? 0 : ContainingVBases.front();
+ return ContainingVBases.empty() ? nullptr : ContainingVBases.front();
}
};
@@ -458,7 +458,7 @@ public:
uint64_t Index;
MethodVFTableLocation()
- : VBTableIndex(0), VBase(0), VFPtrOffset(CharUnits::Zero()),
+ : VBTableIndex(0), VBase(nullptr), VFPtrOffset(CharUnits::Zero()),
Index(0) {}
MethodVFTableLocation(uint64_t VBTableIndex, const CXXRecordDecl *VBase,
@@ -524,7 +524,7 @@ public:
// Complete destructors don't have a slot in a vftable, so no thunks needed.
if (isa<CXXDestructorDecl>(GD.getDecl()) &&
GD.getDtorType() == Dtor_Complete)
- return 0;
+ return nullptr;
return VTableContextBase::getThunkInfo(GD);
}
diff --git a/include/clang/ASTMatchers/ASTMatchFinder.h b/include/clang/ASTMatchers/ASTMatchFinder.h
index 8c8a509596..8af0546db5 100644
--- a/include/clang/ASTMatchers/ASTMatchFinder.h
+++ b/include/clang/ASTMatchers/ASTMatchFinder.h
@@ -222,7 +222,7 @@ selectFirst(StringRef BoundTo, const SmallVectorImpl<BoundNodes> &Results) {
if (NodeT *Node = I->getNodeAs<NodeT>(BoundTo))
return Node;
}
- return NULL;
+ return nullptr;
}
namespace internal {
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 15621b7725..81fa3d49fb 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -890,7 +890,7 @@ const internal::VariadicDynCastAllOfMatcher<Stmt, ForStmt> forStmt;
AST_MATCHER_P(ForStmt, hasIncrement, internal::Matcher<Stmt>,
InnerMatcher) {
const Stmt *const Increment = Node.getInc();
- return (Increment != NULL &&
+ return (Increment != nullptr &&
InnerMatcher.matches(*Increment, Finder, Builder));
}
@@ -905,7 +905,7 @@ AST_MATCHER_P(ForStmt, hasIncrement, internal::Matcher<Stmt>,
AST_MATCHER_P(ForStmt, hasLoopInit, internal::Matcher<Stmt>,
InnerMatcher) {
const Stmt *const Init = Node.getInit();
- return (Init != NULL && InnerMatcher.matches(*Init, Finder, Builder));
+ return (Init != nullptr && InnerMatcher.matches(*Init, Finder, Builder));
}
/// \brief Matches range-based for statements.
@@ -928,7 +928,7 @@ const internal::VariadicDynCastAllOfMatcher<Stmt, CXXForRangeStmt> forRangeStmt;
AST_MATCHER_P(CXXForRangeStmt, hasLoopVariable, internal::Matcher<VarDecl>,
InnerMatcher) {
const VarDecl *const Var = Node.getLoopVariable();
- return (Var != NULL && InnerMatcher.matches(*Var, Finder, Builder));
+ return (Var != nullptr && InnerMatcher.matches(*Var, Finder, Builder));
}
/// \brief Matches while statements.
@@ -1766,7 +1766,7 @@ AST_MATCHER_P(CXXMemberCallExpr, on, internal::Matcher<Expr>,
InnerMatcher) {
const Expr *ExprNode = Node.getImplicitObjectArgument()
->IgnoreParenImpCasts();
- return (ExprNode != NULL &&
+ return (ExprNode != nullptr &&
InnerMatcher.matches(*ExprNode, Finder, Builder));
}
@@ -1789,7 +1789,7 @@ AST_MATCHER_P(CXXMemberCallExpr, on, internal::Matcher<Expr>,
AST_MATCHER_P(CallExpr, callee, internal::Matcher<Stmt>,
InnerMatcher) {
const Expr *ExprNode = Node.getCallee();
- return (ExprNode != NULL &&
+ return (ExprNode != nullptr &&
InnerMatcher.matches(*ExprNode, Finder, Builder));
}
@@ -1944,7 +1944,7 @@ AST_MATCHER_P_OVERLOAD(QualType, references, internal::Matcher<Decl>,
AST_MATCHER_P(CXXMemberCallExpr, onImplicitObjectArgument,
internal::Matcher<Expr>, InnerMatcher) {
const Expr *ExprNode = Node.getImplicitObjectArgument();
- return (ExprNode != NULL &&
+ return (ExprNode != nullptr &&
InnerMatcher.matches(*ExprNode, Finder, Builder));
}
@@ -1977,7 +1977,7 @@ AST_MATCHER_P_OVERLOAD(CXXMemberCallExpr, thisPointerType,
AST_MATCHER_P(DeclRefExpr, to, internal::Matcher<Decl>,
InnerMatcher) {
const Decl *DeclNode = Node.getDecl();
- return (DeclNode != NULL &&
+ return (DeclNode != nullptr &&
InnerMatcher.matches(*DeclNode, Finder, Builder));
}
@@ -2034,7 +2034,7 @@ AST_MATCHER_P(
VarDecl, hasInitializer, internal::Matcher<Expr>,
InnerMatcher) {
const Expr *Initializer = Node.getAnyInitializer();
- return (Initializer != NULL &&
+ return (Initializer != nullptr &&
InnerMatcher.matches(*Initializer, Finder, Builder));
}
@@ -2146,7 +2146,7 @@ AST_MATCHER_P(CXXConstructorDecl, hasAnyConstructorInitializer,
AST_MATCHER_P(CXXCtorInitializer, forField,
internal::Matcher<FieldDecl>, InnerMatcher) {
const FieldDecl *NodeAsDecl = Node.getMember();
- return (NodeAsDecl != NULL &&
+ return (NodeAsDecl != nullptr &&
InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
}
@@ -2166,7 +2166,7 @@ AST_MATCHER_P(CXXCtorInitializer, forField,
AST_MATCHER_P(CXXCtorInitializer, withInitializer,
internal::Matcher<Expr>, InnerMatcher) {
const Expr* NodeAsExpr = Node.getInit();
- return (NodeAsExpr != NULL &&
+ return (NodeAsExpr != nullptr &&
InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
}
@@ -2316,7 +2316,7 @@ AST_POLYMORPHIC_MATCHER_P(
IfStmt, ForStmt, WhileStmt, DoStmt, ConditionalOperator),
internal::Matcher<Expr>, InnerMatcher) {
const Expr *const Condition = Node.getCond();
- return (Condition != NULL &&
+ return (Condition != nullptr &&
InnerMatcher.matches(*Condition, Finder, Builder));
}
@@ -2368,7 +2368,7 @@ AST_MATCHER_P(IfStmt, hasConditionVariableStatement,
internal::Matcher<DeclStmt>, InnerMatcher) {
const DeclStmt* const DeclarationStatement =
Node.getConditionVariableDeclStmt();
- return DeclarationStatement != NULL &&
+ return DeclarationStatement != nullptr &&
InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
}
@@ -2420,7 +2420,7 @@ AST_POLYMORPHIC_MATCHER_P(
hasBody, AST_POLYMORPHIC_SUPPORTED_TYPES_3(DoStmt, ForStmt, WhileStmt),
internal::Matcher<Stmt>, InnerMatcher) {
const Stmt *const Statement = Node.getBody();
- return (Statement != NULL &&
+ return (Statement != nullptr &&
InnerMatcher.matches(*Statement, Finder, Builder));
}
@@ -2494,7 +2494,7 @@ AST_POLYMORPHIC_MATCHER_P(hasOperatorName, AST_POLYMORPHIC_SUPPORTED_TYPES_2(
AST_MATCHER_P(BinaryOperator, hasLHS,
internal::Matcher<Expr>, InnerMatcher) {
Expr *LeftHandSide = Node.getLHS();
- return (LeftHandSide != NULL &&
+ return (LeftHandSide != nullptr &&
InnerMatcher.matches(*LeftHandSide, Finder, Builder));
}
@@ -2507,7 +2507,7 @@ AST_MATCHER_P(BinaryOperator, hasLHS,
AST_MATCHER_P(BinaryOperator, hasRHS,
internal::Matcher<Expr>, InnerMatcher) {
Expr *RightHandSide = Node.getRHS();
- return (RightHandSide != NULL &&
+ return (RightHandSide != nullptr &&
InnerMatcher.matches(*RightHandSide, Finder, Builder));
}
@@ -2527,7 +2527,7 @@ inline internal::Matcher<BinaryOperator> hasEitherOperand(
AST_MATCHER_P(UnaryOperator, hasUnaryOperand,
internal::Matcher<Expr>, InnerMatcher) {
const Expr * const Operand = Node.getSubExpr();
- return (Operand != NULL &&
+ return (Operand != nullptr &&
InnerMatcher.matches(*Operand, Finder, Builder));
}
@@ -2541,7 +2541,7 @@ AST_MATCHER_P(UnaryOperator, hasUnaryOperand,
AST_MATCHER_P(CastExpr, hasSourceExpression,
internal::Matcher<Expr>, InnerMatcher) {
const Expr* const SubExpression = Node.getSubExpr();
- return (SubExpression != NULL &&
+ return (SubExpression != nullptr &&
InnerMatcher.matches(*SubExpression, Finder, Builder));
}
@@ -2573,7 +2573,7 @@ AST_MATCHER_P(ImplicitCastExpr, hasImplicitDestinationType,
AST_MATCHER_P(ConditionalOperator, hasTrueExpression,
internal::Matcher<Expr>, InnerMatcher) {
Expr *Expression = Node.getTrueExpr();
- return (Expression != NULL &&
+ return (Expression != nullptr &&
InnerMatcher.matches(*Expression, Finder, Builder));
}
@@ -2586,7 +2586,7 @@ AST_MATCHER_P(ConditionalOperator, hasTrueExpression,
AST_MATCHER_P(ConditionalOperator, hasFalseExpression,
internal::Matcher<Expr>, InnerMatcher) {
Expr *Expression = Node.getFalseExpr();
- return (Expression != NULL &&
+ return (Expression != nullptr &&
InnerMatcher.matches(*Expression, Finder, Builder));
}
@@ -2628,7 +2628,7 @@ AST_POLYMORPHIC_MATCHER(isDefinition, AST_POLYMORPHIC_SUPPORTED_TYPES_3(
AST_MATCHER_P(CXXMethodDecl, ofClass,
internal::Matcher<CXXRecordDecl>, InnerMatcher) {
const CXXRecordDecl *Parent = Node.getParent();
- return (Parent != NULL &&
+ return (Parent != nullptr &&
InnerMatcher.matches(*Parent, Finder, Builder));
}
@@ -3383,7 +3383,7 @@ AST_MATCHER_FUNCTION_P_OVERLOAD(
/// matches "A::"
AST_MATCHER_P(NestedNameSpecifier, specifiesType,
internal::Matcher<QualType>, InnerMatcher) {
- if (Node.getAsType() == NULL)
+ if (!Node.getAsType())
return false;
return InnerMatcher.matches(QualType(Node.getAsType(), 0), Finder, Builder);
}
@@ -3417,7 +3417,7 @@ AST_MATCHER_P_OVERLOAD(NestedNameSpecifier, hasPrefix,
internal::Matcher<NestedNameSpecifier>, InnerMatcher,
0) {
NestedNameSpecifier *NextNode = Node.getPrefix();
- if (NextNode == NULL)
+ if (!NextNode)
return false;
return InnerMatcher.matches(*NextNode, Finder, Builder);
}
@@ -3452,7 +3452,7 @@ AST_MATCHER_P_OVERLOAD(NestedNameSpecifierLoc, hasPrefix,
/// matches "ns::"
AST_MATCHER_P(NestedNameSpecifier, specifiesNamespace,
internal::Matcher<NamespaceDecl>, InnerMatcher) {
- if (Node.getAsNamespace() == NULL)
+ if (!Node.getAsNamespace())
return false;
return InnerMatcher.matches(*Node.getAsNamespace(), Finder, Builder);
}
diff --git a/include/clang/ASTMatchers/ASTMatchersInternal.h b/include/clang/ASTMatchers/ASTMatchersInternal.h
index 23885a18e6..ed20dee088 100644
--- a/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -74,7 +74,7 @@ public:
const T *getNodeAs(StringRef ID) const {
IDToNodeMap::const_iterator It = NodeMap.find(ID);
if (It == NodeMap.end()) {
- return NULL;
+ return nullptr;
}
return It->second.get<T>();
}
@@ -507,7 +507,7 @@ template <typename T> struct has_getDecl {
static char (&f(CheckT<int Default::*, &C::getDecl>*))[1];
template<typename C> static char (&f(...))[2];
- static bool const value = sizeof(f<Derived>(0)) == 2;
+ static bool const value = sizeof(f<Derived>(nullptr)) == 2;
};
/// \brief Matches overloaded operators with a specific name.
@@ -626,7 +626,7 @@ private:
bool matchesDecl(const Decl *Node,
ASTMatchFinder *Finder,
BoundNodesTreeBuilder *Builder) const {
- return Node != NULL && InnerMatcher.matches(*Node, Finder, Builder);
+ return Node != nullptr && InnerMatcher.matches(*Node, Finder, Builder);
}
const Matcher<Decl> InnerMatcher;
diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h
index 336da3e5dd..b25267b1c5 100644
--- a/include/clang/ASTMatchers/Dynamic/VariantValue.h
+++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h
@@ -174,7 +174,7 @@ private:
Func, DynMatchers)));
}
- bool hasMatcher() const { return Out.get() != NULL; }
+ bool hasMatcher() const { return Out.get() != nullptr; }
const MatcherT &matcher() const { return *Out; }
private:
diff --git a/include/clang/Analysis/Analyses/Consumed.h b/include/clang/Analysis/Analyses/Consumed.h
index 7de4b59bf2..7550ddf80e 100644
--- a/include/clang/Analysis/Analyses/Consumed.h
+++ b/include/clang/Analysis/Analyses/Consumed.h
@@ -142,7 +142,7 @@ namespace consumed {
TmpMapType TmpMap;
public:
- ConsumedStateMap() : Reachable(true), From(NULL) {}
+ ConsumedStateMap() : Reachable(true), From(nullptr) {}
ConsumedStateMap(const ConsumedStateMap &Other)
: Reachable(Other.Reachable), From(Other.From), VarMap(Other.VarMap),
TmpMap() {}
@@ -203,7 +203,7 @@ namespace consumed {
ConsumedBlockInfo() { }
ConsumedBlockInfo(unsigned int NumBlocks, PostOrderCFGView *SortedGraph)
- : StateMapsArray(NumBlocks, 0), VisitOrder(NumBlocks, 0) {
+ : StateMapsArray(NumBlocks, nullptr), VisitOrder(NumBlocks, 0) {
unsigned int VisitOrderCounter = 0;
for (PostOrderCFGView::iterator BI = SortedGraph->begin(),
BE = SortedGraph->end(); BI != BE; ++BI) {
diff --git a/include/clang/Analysis/Analyses/Dominators.h b/include/clang/Analysis/Analyses/Dominators.h
index 1bfd05d57f..6c6d9238e5 100644
--- a/include/clang/Analysis/Analyses/Dominators.h
+++ b/include/clang/Analysis/Analyses/Dominators.h
@@ -153,7 +153,7 @@ public:
/// \brief This method converts the dominator tree to human readable form.
///
- virtual void print(raw_ostream &OS, const llvm::Module* M= 0) const {
+ virtual void print(raw_ostream &OS, const llvm::Module* M= nullptr) const {
DT->print(OS);
}
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h
index 3bffcd3ce0..76fe9ddca6 100644
--- a/include/clang/Analysis/Analyses/FormatString.h
+++ b/include/clang/Analysis/Analyses/FormatString.h
@@ -83,7 +83,7 @@ public:
};
LengthModifier()
- : Position(0), kind(None) {}
+ : Position(nullptr), kind(None) {}
LengthModifier(const char *pos, Kind k)
: Position(pos), kind(k) {}
@@ -169,10 +169,11 @@ public:
};
ConversionSpecifier(bool isPrintf = true)
- : IsPrintf(isPrintf), Position(0), EndScanList(0), kind(InvalidSpecifier) {}
+ : IsPrintf(isPrintf), Position(nullptr), EndScanList(nullptr),
+ kind(InvalidSpecifier) {}
ConversionSpecifier(bool isPrintf, const char *pos, Kind k)
- : IsPrintf(isPrintf), Position(pos), EndScanList(0), kind(k) {}
+ : IsPrintf(isPrintf), Position(pos), EndScanList(nullptr), kind(k) {}
const char *getStart() const {
return Position;
@@ -226,10 +227,11 @@ private:
const char *Name;
bool Ptr;
public:
- ArgType(Kind k = UnknownTy, const char *n = 0) : K(k), Name(n), Ptr(false) {}
- ArgType(QualType t, const char *n = 0)
+ ArgType(Kind k = UnknownTy, const char *n = nullptr)
+ : K(k), Name(n), Ptr(false) {}
+ ArgType(QualType t, const char *n = nullptr)
: K(SpecificTy), T(t), Name(n), Ptr(false) {}
- ArgType(CanQualType t) : K(SpecificTy), T(t), Name(0), Ptr(false) {}
+ ArgType(CanQualType t) : K(SpecificTy), T(t), Name(nullptr), Ptr(false) {}
static ArgType Invalid() { return ArgType(InvalidTy); }
bool isValid() const { return K != InvalidTy; }
@@ -262,7 +264,7 @@ public:
UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {}
OptionalAmount(bool valid = true)
- : start(0),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
+ : start(nullptr),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
UsesPositionalArg(0), UsesDotPrefix(0) {}
bool isInvalid() const {
@@ -389,7 +391,7 @@ class PrintfConversionSpecifier :
public analyze_format_string::ConversionSpecifier {
public:
PrintfConversionSpecifier()
- : ConversionSpecifier(true, 0, InvalidSpecifier) {}
+ : ConversionSpecifier(true, nullptr, InvalidSpecifier) {}
PrintfConversionSpecifier(const char *pos, Kind k)
: ConversionSpecifier(true, pos, k) {}
@@ -525,7 +527,7 @@ class ScanfConversionSpecifier :
public analyze_format_string::ConversionSpecifier {
public:
ScanfConversionSpecifier()
- : ConversionSpecifier(false, 0, InvalidSpecifier) {}
+ : ConversionSpecifier(false, nullptr, InvalidSpecifier) {}
ScanfConversionSpecifier(const char *pos, Kind k)
: ConversionSpecifier(false, pos, k) {}
diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h
index bbd2b02e82..784227108e 100644
--- a/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/include/clang/Analysis/Analyses/LiveVariables.h
@@ -38,7 +38,7 @@ public:
bool equals(const LivenessValues &V) const;
LivenessValues()
- : liveStmts(0), liveDecls(0) {}
+ : liveStmts(nullptr), liveDecls(nullptr) {}
LivenessValues(llvm::ImmutableSet<const Stmt *> LiveStmts,
llvm::ImmutableSet<const VarDecl *> LiveDecls)
diff --git a/include/clang/Analysis/Analyses/PostOrderCFGView.h b/include/clang/Analysis/Analyses/PostOrderCFGView.h
index 9ceace748b..91bf51cd61 100644
--- a/include/clang/Analysis/Analyses/PostOrderCFGView.h
+++ b/include/clang/Analysis/Analyses/PostOrderCFGView.h
@@ -52,7 +52,7 @@ public:
// make sure that Block is non-null. Moreover, the CFGBlock iterator will
// occasionally hand out null pointers for pruned edges, so we catch those
// here.
- if (Block == 0)
+ if (!Block)
return false; // if an edge is trivially false.
if (VisitedBlockIDs.test(Block->getBlockID()))
return false;
diff --git a/include/clang/Analysis/Analyses/ThreadSafety.h b/include/clang/Analysis/Analyses/ThreadSafety.h
index d8c08012ce..b533c1db49 100644
--- a/include/clang/Analysis/Analyses/ThreadSafety.h
+++ b/include/clang/Analysis/Analyses/ThreadSafety.h
@@ -159,7 +159,7 @@ public:
virtual void handleMutexNotHeld(StringRef Kind, const NamedDecl *D,
ProtectedOperationKind POK, Name LockName,
LockKind LK, SourceLocation Loc,
- Name *PossibleMatch = 0) {}
+ Name *PossibleMatch = nullptr) {}
/// Warn when a function is called while an excluded mutex is locked. For
/// example, the mutex may be locked inside the function.
diff --git a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
index 6a3ae3605b..5ad8132e47 100644
--- a/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+++ b/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
@@ -346,7 +346,8 @@ private:
}
til::SExpr *getCurrentLVarDefinition(const ValueDecl *VD);
- til::SExpr *addStatement(til::SExpr *E, const Stmt *S, const ValueDecl *VD=0);
+ til::SExpr *addStatement(til::SExpr *E, const Stmt *S,
+ const ValueDecl *VD = nullptr);
til::SExpr *lookupVarDecl(const ValueDecl *VD);
til::SExpr *addVarDecl(const ValueDecl *VD, til::SExpr *E);
til::SExpr *updateVarDecl(const ValueDecl *VD, til::SExpr *E);
diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h
index 73b38b78c0..08e335418a 100644
--- a/include/clang/Analysis/AnalysisContext.h
+++ b/include/clang/Analysis/AnalysisContext.h
@@ -287,7 +287,7 @@ public:
const CFGBlock *getCallSiteBlock() const { return Block; }
/// Return true if the current LocationContext has no caller context.
- bool inTopFrame() const override { return getParent() == 0; }
+ bool inTopFrame() const override { return getParent() == nullptr; }
unsigned getIndex() const { return Index; }
@@ -438,7 +438,8 @@ public:
// Get the top level stack frame.
const StackFrameContext *getStackFrame(const Decl *D) {
- return LocContexts.getStackFrame(getContext(D), 0, 0, 0, 0);
+ return LocContexts.getStackFrame(getContext(D), nullptr, nullptr, nullptr,
+ 0);
}
// Get a stack frame with parent.
diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h
index 87ba26db4f..1230a9662c 100644
--- a/include/clang/Analysis/CFG.h
+++ b/include/clang/Analysis/CFG.h
@@ -72,7 +72,7 @@ protected:
llvm::PointerIntPair<void *, 2> Data1;
llvm::PointerIntPair<void *, 2> Data2;
- CFGElement(Kind kind, const void *Ptr1, const void *Ptr2 = 0)
+ CFGElement(Kind kind, const void *Ptr1, const void *Ptr2 = nullptr)
: Data1(const_cast<void*>(Ptr1), ((unsigned) kind) & 0x3),
Data2(const_cast<void*>(Ptr2), (((unsigned) kind) >> 2) & 0x3) {
assert(getKind() == kind);
@@ -171,7 +171,7 @@ private:
class CFGImplicitDtor : public CFGElement {
protected:
CFGImplicitDtor() {}
- CFGImplicitDtor(Kind kind, const void *data1, const void *data2 = 0)
+ CFGImplicitDtor(Kind kind, const void *data1, const void *data2 = nullptr)
: CFGElement(kind, data1, data2) {
assert(kind >= DTOR_BEGIN && kind <= DTOR_END);
}
@@ -262,7 +262,7 @@ private:
class CFGMemberDtor : public CFGImplicitDtor {
public:
CFGMemberDtor(const FieldDecl *field)
- : CFGImplicitDtor(MemberDtor, field, 0) {}
+ : CFGImplicitDtor(MemberDtor, field, nullptr) {}
const FieldDecl *getFieldDecl() const {
return static_cast<const FieldDecl*>(Data1.getPointer());
@@ -281,7 +281,7 @@ private:
class CFGTemporaryDtor : public CFGImplicitDtor {
public:
CFGTemporaryDtor(CXXBindTemporaryExpr *expr)
- : CFGImplicitDtor(TemporaryDtor, expr, 0) {}
+ : CFGImplicitDtor(TemporaryDtor, expr, nullptr) {}
const CXXBindTemporaryExpr *getBindTemporaryExpr() const {
return static_cast<const CXXBindTemporaryExpr *>(Data1.getPointer());
@@ -490,7 +490,7 @@ private:
public:
explicit CFGBlock(unsigned blockid, BumpVectorContext &C, CFG *parent)
- : Elements(C), Label(NULL), Terminator(NULL), LoopTarget(NULL),
+ : Elements(C), Label(nullptr), Terminator(nullptr), LoopTarget(nullptr),
BlockID(blockid), Preds(C, 1), Succs(C, 1), HasNoReturnElement(false),
Parent(parent) {}
~CFGBlock() {}
@@ -691,7 +691,8 @@ public:
// the elements beginning at the last position in prepared space.
iterator beginAutomaticObjDtorsInsert(iterator I, size_t Cnt,
BumpVectorContext &C) {
- return iterator(Elements.insert(I.base(), Cnt, CFGAutomaticObjDtor(0, 0), C));
+ return iterator(Elements.insert(I.base(), Cnt,
+ CFGAutomaticObjDtor(nullptr, 0), C));
}
iterator insertAutomaticObjDtor(iterator I, VarDecl *VD, Stmt *S) {
*I = CFGAutomaticObjDtor(VD, S);
@@ -750,13 +751,11 @@ public:
}
BuildOptions()
- : forcedBlkExprs(0), Observer(0), PruneTriviallyFalseEdges(true)
- ,AddEHEdges(false)
- ,AddInitializers(false)
- ,AddImplicitDtors(false)
- ,AddTemporaryDtors(false)
- ,AddStaticInitBranches(false)
- ,AddCXXNewAllocator(false) {}
+ : forcedBlkExprs(nullptr), Observer(nullptr),
+ PruneTriviallyFalseEdges(true), AddEHEdges(false),
+ AddInitializers(false), AddImplicitDtors(false),
+ AddTemporaryDtors(false), AddStaticInitBranches(false),
+ AddCXXNewAllocator(false) {}
};
/// \brief Provides a custom implementation of the iterator class to have the
@@ -946,8 +945,9 @@ public:
// Internal: constructors and data.
//===--------------------------------------------------------------------===//
- CFG() : Entry(NULL), Exit(NULL), IndirectGotoBlock(NULL), NumBlockIDs(0),
- Blocks(BlkBVC, 10) {}
+ CFG()
+ : Entry(nullptr), Exit(nullptr), IndirectGotoBlock(nullptr), NumBlockIDs(0),
+ Blocks(BlkBVC, 10) {}
llvm::BumpPtrAllocator& getAllocator() {
return BlkBVC.getAllocator();
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index 1423e01365..57324d0429 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -77,9 +77,9 @@ protected:
ProgramPoint(const void *P,
Kind k,
const LocationContext *l,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: Data1(P),
- Data2(0, (((unsigned) k) >> 0) & 0x3),
+ Data2(nullptr, (((unsigned) k) >> 0) & 0x3),
L(l, (((unsigned) k) >> 2) & 0x3),
Tag(tag, (((unsigned) k) >> 4) & 0x3) {
assert(getKind() == k);
@@ -91,7 +91,7 @@ protected:
const void *P2,
Kind k,
const LocationContext *l,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: Data1(P1),
Data2(P2, (((unsigned) k) >> 0) & 0x3),
L(l, (((unsigned) k) >> 2) & 0x3),
@@ -193,7 +193,7 @@ public:
class BlockEntrance : public ProgramPoint {
public:
BlockEntrance(const CFGBlock *B, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: ProgramPoint(B, BlockEntranceKind, L, tag) {
assert(B && "BlockEntrance requires non-null block");
}
@@ -263,7 +263,7 @@ private:
class PreStmt : public StmtPoint {
public:
PreStmt(const Stmt *S, const LocationContext *L, const ProgramPointTag *tag,
- const Stmt *SubStmt = 0)
+ const Stmt *SubStmt = nullptr)
: StmtPoint(S, SubStmt, PreStmtKind, L, tag) {}
const Stmt *getSubStmt() const { return (const Stmt*) getData2(); }
@@ -280,17 +280,17 @@ class PostStmt : public StmtPoint {
protected:
PostStmt() {}
PostStmt(const Stmt *S, const void *data, Kind k, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: StmtPoint(S, data, k, L, tag) {}
public:
- explicit PostStmt(const Stmt *S, Kind k,
- const LocationContext *L, const ProgramPointTag *tag = 0)
- : StmtPoint(S, NULL, k, L, tag) {}
+ explicit PostStmt(const Stmt *S, Kind k, const LocationContext *L,
+ const ProgramPointTag *tag = nullptr)
+ : StmtPoint(S, nullptr, k, L, tag) {}
explicit PostStmt(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
- : StmtPoint(S, NULL, PostStmtKind, L, tag) {}
+ const ProgramPointTag *tag = nullptr)
+ : StmtPoint(S, nullptr, PostStmtKind, L, tag) {}
private:
friend class ProgramPoint;
@@ -304,7 +304,7 @@ private:
class PostCondition : public PostStmt {
public:
PostCondition(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: PostStmt(S, PostConditionKind, L, tag) {}
private:
@@ -320,7 +320,7 @@ protected:
LocationCheck() {}
LocationCheck(const Stmt *S, const LocationContext *L,
ProgramPoint::Kind K, const ProgramPointTag *tag)
- : StmtPoint(S, NULL, K, L, tag) {}
+ : StmtPoint(S, nullptr, K, L, tag) {}
private:
friend class ProgramPoint;
@@ -333,7 +333,7 @@ private:
class PreLoad : public LocationCheck {
public:
PreLoad(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: LocationCheck(S, L, PreLoadKind, tag) {}
private:
@@ -347,7 +347,7 @@ private:
class PreStore : public LocationCheck {
public:
PreStore(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: LocationCheck(S, L, PreStoreKind, tag) {}
private:
@@ -361,7 +361,7 @@ private:
class PostLoad : public PostStmt {
public:
PostLoad(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: PostStmt(S, PostLoadKind, L, tag) {}
private:
@@ -379,9 +379,9 @@ public:
/// \param Loc can be used to store the information about the location
/// used in the form it was uttered in the code.
PostStore(const Stmt *S, const LocationContext *L, const void *Loc,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: PostStmt(S, PostStoreKind, L, tag) {
- assert(getData2() == 0);
+ assert(getData2() == nullptr);
setData2(Loc);
}
@@ -402,7 +402,7 @@ private:
class PostLValue : public PostStmt {
public:
PostLValue(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
+ const ProgramPointTag *tag = nullptr)
: PostStmt(S, PostLValueKind, L, tag) {}
private:
@@ -418,8 +418,8 @@ private:
class PreStmtPurgeDeadSymbols : public StmtPoint {
public:
PreStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
- : StmtPoint(S, 0, PreStmtPurgeDeadSymbolsKind, L, tag) { }
+ const ProgramPointTag *tag = nullptr)
+ : StmtPoint(S, nullptr, PreStmtPurgeDeadSymbolsKind, L, tag) { }
private:
friend class ProgramPoint;
@@ -434,8 +434,8 @@ private:
class PostStmtPurgeDeadSymbols : public StmtPoint {
public:
PostStmtPurgeDeadSymbols(const Stmt *S, const LocationContext *L,
- const ProgramPointTag *tag = 0)
- : StmtPoint(S, 0, PostStmtPurgeDeadSymbolsKind, L, tag) { }
+ const ProgramPointTag *tag = nullptr)
+ : StmtPoint(S, nullptr, PostStmtPurgeDeadSymbolsKind, L, tag) { }
private:
friend class ProgramPoint;
@@ -527,8 +527,8 @@ private:
/// Explicit calls will appear as PreStmt program points.
class PreImplicitCall : public ImplicitCallPoint {
public:
- PreImplicitCall(const Decl *D, SourceLocation Loc,
- const LocationContext *L, const ProgramPointTag *Tag = 0)
+ PreImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L,
+ const ProgramPointTag *Tag = nullptr)
: ImplicitCallPoint(D, Loc, PreImplicitCallKind, L, Tag) {}
private:
@@ -544,8 +544,8 @@ private:
/// Explicit calls will appear as PostStmt program points.
class PostImplicitCall : public ImplicitCallPoint {
public:
- PostImplicitCall(const Decl *D, SourceLocation Loc,
- const LocationContext *L, const ProgramPointTag *Tag = 0)
+ PostImplicitCall(const Decl *D, SourceLocation Loc, const LocationContext *L,
+ const ProgramPointTag *Tag = nullptr)
: ImplicitCallPoint(D, Loc, PostImplicitCallKind, L, Tag) {}
private:
@@ -562,7 +562,7 @@ class CallEnter : public ProgramPoint {
public:
CallEnter(const Stmt *stmt, const StackFrameContext *calleeCtx,
const LocationContext *callerCtx)
- : ProgramPoint(stmt, calleeCtx, CallEnterKind, callerCtx, 0) {}
+ : ProgramPoint(stmt, calleeCtx, CallEnterKind, callerCtx, nullptr) {}
const Stmt *getCallExpr() const {
return static_cast<const Stmt *>(getData1());
@@ -593,7 +593,7 @@ class CallExitBegin : public ProgramPoint {
public:
// CallExitBegin uses the callee's location context.
CallExitBegin(const StackFrameContext *L)
- : ProgramPoint(0, CallExitBeginKind, L, 0) {}
+ : ProgramPoint(nullptr, CallExitBeginKind, L, nullptr) {}
private:
friend class ProgramPoint;
@@ -610,7 +610,7 @@ public:
// CallExitEnd uses the caller's location context.
CallExitEnd(const StackFrameContext *CalleeCtx,
const LocationContext *CallerCtx)
- : ProgramPoint(CalleeCtx, CallExitEndKind, CallerCtx, 0) {}
+ : ProgramPoint(CalleeCtx, CallExitEndKind, CallerCtx, nullptr) {}
const StackFrameContext *getCalleeContext() const {
return static_cast<const StackFrameContext *>(getData1());
@@ -629,7 +629,8 @@ private:
class EpsilonPoint : public ProgramPoint {
public:
EpsilonPoint(const LocationContext *L, const void *Data1,
- const void *Data2 = 0, const ProgramPointTag *tag = 0)
+ const void *Data2 = nullptr,
+ const ProgramPointTag *tag = nullptr)
: ProgramPoint(Data1, Data2, EpsilonKind, L, tag) {}
const void *getData() const { return getData1(); }
@@ -647,7 +648,7 @@ private:
/// description and potentially other information.
class ProgramPointTag {
public:
- ProgramPointTag(void *tagKind = 0) : TagKind(tagKind) {}
+ ProgramPointTag(void *tagKind = nullptr) : TagKind(tagKind) {}
virtual ~ProgramPointTag();
virtual StringRef getTagDescription() const = 0;
@@ -676,13 +677,13 @@ template <> struct DenseMapInfo<clang::ProgramPoint> {
static inline clang::ProgramPoint getEmptyKey() {
uintptr_t x =
reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getEmptyKey()) & ~0x7;
- return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), 0);
+ return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), nullptr);
}
static inline clang::ProgramPoint getTombstoneKey() {
uintptr_t x =
reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getTombstoneKey()) & ~0x7;
- return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), 0);
+ return clang::BlockEntrance(reinterpret_cast<clang::CFGBlock*>(x), nullptr);
}
static unsigned getHashValue(const clang::ProgramPoint &Loc) {
diff --git a/include/clang/Analysis/Support/BumpVector.h b/include/clang/Analysis/Support/BumpVector.h
index e246712a7e..6d0427ba92 100644
--- a/include/clang/Analysis/Support/BumpVector.h
+++ b/include/clang/Analysis/Support/BumpVector.h
@@ -55,7 +55,7 @@ class BumpVector {
public:
// Default ctor - Initialize to empty.
explicit BumpVector(BumpVectorContext &C, unsigned N)
- : Begin(NULL), End(NULL), Capacity(NULL) {
+ : Begin(nullptr), End(nullptr), Capacity(nullptr) {
reserve(C, N);
}
diff --git a/include/clang/Basic/ABI.h b/include/clang/Basic/ABI.h
index 3b3d59efc0..9e8ef2e3ee 100644
--- a/include/clang/Basic/ABI.h
+++ b/include/clang/Basic/ABI.h
@@ -186,10 +186,10 @@ struct ThunkInfo {
/// an ABI-specific comparator.
const CXXMethodDecl *Method;
- ThunkInfo() : Method(0) { }
+ ThunkInfo() : Method(nullptr) { }
ThunkInfo(const ThisAdjustment &This, const ReturnAdjustment &Return,
- const CXXMethodDecl *Method = 0)
+ const CXXMethodDecl *Method = nullptr)
: This(This), Return(Return), Method(Method) {}
friend bool operator==(const ThunkInfo &LHS, const ThunkInfo &RHS) {
@@ -197,7 +197,9 @@ struct ThunkInfo {
LHS.Method == RHS.Method;
}
- bool isEmpty() const { return This.isEmpty() && Return.isEmpty() && Method == 0; }
+ bool isEmpty() const {
+ return This.isEmpty() && Return.isEmpty() && Method == nullptr;
+ }
};
} // end namespace clang
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h
index fd8fd422b1..f9d30e4056 100644
--- a/include/clang/Basic/Builtins.h
+++ b/include/clang/Basic/Builtins.h
@@ -94,53 +94,53 @@ public:
/// \brief Return true if this function has no side effects and doesn't
/// read memory.
bool isConst(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'c') != 0;
+ return strchr(GetRecord(ID).Attributes, 'c') != nullptr;
}
/// \brief Return true if we know this builtin never throws an exception.
bool isNoThrow(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'n') != 0;
+ return strchr(GetRecord(ID).Attributes, 'n') != nullptr;
}
/// \brief Return true if we know this builtin never returns.
bool isNoReturn(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'r') != 0;
+ return strchr(GetRecord(ID).Attributes, 'r') != nullptr;
}
/// \brief Return true if we know this builtin can return twice.
bool isReturnsTwice(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'j') != 0;
+ return strchr(GetRecord(ID).Attributes, 'j') != nullptr;
}
/// \brief Returns true if this builtin does not perform the side-effects
/// of its arguments.
bool isUnevaluated(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'u') != 0;
+ return strchr(GetRecord(ID).Attributes, 'u') != nullptr;
}
/// \brief Return true if this is a builtin for a libc/libm function,
/// with a "__builtin_" prefix (e.g. __builtin_abs).
bool isLibFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'F') != 0;
+ return strchr(GetRecord(ID).Attributes, 'F') != nullptr;
}
/// \brief Determines whether this builtin is a predefined libc/libm
/// function, such as "malloc", where we know the signature a
/// priori.
bool isPredefinedLibFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'f') != 0;
+ return strchr(GetRecord(ID).Attributes, 'f') != nullptr;
}
/// \brief Determines whether this builtin is a predefined compiler-rt/libgcc
/// function, such as "__clear_cache", where we know the signature a
/// priori.
bool isPredefinedRuntimeFunction(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'i') != 0;
+ return strchr(GetRecord(ID).Attributes, 'i') != nullptr;
}
/// \brief Determines whether this builtin has custom typechecking.
bool hasCustomTypechecking(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 't') != 0;
+ return strchr(GetRecord(ID).Attributes, 't') != nullptr;
}
/// \brief Completely forget that the given ID was ever considered a builtin,
@@ -168,7 +168,7 @@ public:
///
/// Such functions can be const when the MathErrno lang option is disabled.
bool isConstWithoutErrno(unsigned ID) const {
- return strchr(GetRecord(ID).Attributes, 'e') != 0;
+ return strchr(GetRecord(ID).Attributes, 'e') != nullptr;
}
private:
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index d8d1ea6932..7739631f63 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -354,7 +354,7 @@ public:
explicit DiagnosticsEngine(
const IntrusiveRefCntPtr<DiagnosticIDs> &Diags,
DiagnosticOptions *DiagOpts,
- DiagnosticConsumer *client = 0,
+ DiagnosticConsumer *client = nullptr,
bool ShouldOwnClient = true);
~DiagnosticsEngine();
@@ -386,7 +386,7 @@ public:
return Client;
}
- bool hasSourceManager() const { return SourceMgr != 0; }
+ bool hasSourceManager() const { return SourceMgr != nullptr; }
SourceManager &getSourceManager() const {
assert(SourceMgr && "SourceManager not set!");
return *SourceMgr;
@@ -889,7 +889,7 @@ class DiagnosticBuilder {
friend class DiagnosticsEngine;
DiagnosticBuilder()
- : DiagObj(0), NumArgs(0), NumRanges(0), NumFixits(0), IsActive(false),
+ : DiagObj(nullptr), NumArgs(0), NumRanges(0), NumFixits(0), IsActive(false),
IsForceEmit(false) { }
explicit DiagnosticBuilder(DiagnosticsEngine *diagObj)
@@ -909,7 +909,7 @@ protected:
/// \brief Clear out the current diagnostic.
void Clear() const {
- DiagObj = 0;
+ DiagObj = nullptr;
IsActive = false;
IsForceEmit = false;
}
@@ -1245,7 +1245,7 @@ public:
}
const FixItHint *getFixItHints() const {
- return getNumFixItHints()? DiagObj->DiagFixItHints : 0;
+ return getNumFixItHints()? DiagObj->DiagFixItHints : nullptr;
}
/// \brief Format this diagnostic into a string, substituting the
@@ -1341,7 +1341,7 @@ public:
/// \param PP The preprocessor object being used for the source; this is
/// optional, e.g., it may not be present when processing AST source files.
virtual void BeginSourceFile(const LangOptions &LangOpts,
- const Preprocessor *PP = 0) {}
+ const Preprocessor *PP = nullptr) {}
/// \brief Callback to inform the diagnostic client that processing
/// of a source file has ended.
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h
index cc9e4e4079..023433b25b 100644
--- a/include/clang/Basic/FileManager.h
+++ b/include/clang/Basic/FileManager.h
@@ -49,7 +49,7 @@ class DirectoryEntry {
const char *Name; // Name of the directory.
friend class FileManager;
public:
- DirectoryEntry() : Name(0) {}
+ DirectoryEntry() : Name(nullptr) {}
const char *getName() const { return Name; }
};
@@ -74,7 +74,7 @@ class FileEntry {
friend class FileManager;
void closeFile() const {
- File.reset(0); // rely on destructor to close File
+ File.reset(nullptr); // rely on destructor to close File
}
void operator=(const FileEntry &) LLVM_DELETED_FUNCTION;
@@ -180,7 +180,7 @@ class FileManager : public RefCountedBase<FileManager> {
public:
FileManager(const FileSystemOptions &FileSystemOpts,
- IntrusiveRefCntPtr<vfs::FileSystem> FS = 0);
+ IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr);
~FileManager();
/// \brief Installs the provided FileSystemStatCache object within
@@ -241,10 +241,10 @@ public:
/// \brief Open the specified file as a MemoryBuffer, returning a new
/// MemoryBuffer if successful, otherwise returning null.
llvm::MemoryBuffer *getBufferForFile(const FileEntry *Entry,
- std::string *ErrorStr = 0,
+ std::string *ErrorStr = nullptr,
bool isVolatile = false);
llvm::MemoryBuffer *getBufferForFile(StringRef Filename,
- std::string *ErrorStr = 0);
+ std::string *ErrorStr = nullptr);
/// \brief Get the 'stat' information for the given \p Path.
///
diff --git a/include/clang/Basic/FileSystemStatCache.h b/include/clang/Basic/FileSystemStatCache.h
index c4a89b3dbe..2e9528db91 100644
--- a/include/clang/Basic/FileSystemStatCache.h
+++ b/include/clang/Basic/FileSystemStatCache.h
@@ -95,7 +95,7 @@ protected:
// If we hit the end of the list of stat caches to try, just compute and
// return it without a cache.
- return get(Path, Data, isFile, F, 0, FS) ? CacheMissing : CacheExists;
+ return get(Path, Data, isFile, F, nullptr, FS) ? CacheMissing : CacheExists;
}
};
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index abf5b930e4..f65ba86354 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -428,7 +428,7 @@ public:
/// \brief Create the identifier table, populating it with info about the
/// language keywords for the language specified by \p LangOpts.
IdentifierTable(const LangOptions &LangOpts,
- IdentifierInfoLookup* externalLookup = 0);
+ IdentifierInfoLookup* externalLookup = nullptr);
/// \brief Set the external identifier lookup mechanism.
void setExternalIdentifierLookup(IdentifierInfoLookup *IILookup) {
@@ -625,7 +625,7 @@ class Selector {
IdentifierInfo *getAsIdentifierInfo() const {
if (getIdentifierInfoFlag() < MultiArg)
return reinterpret_cast<IdentifierInfo *>(InfoPtr & ~ArgFlags);
- return 0;
+ return nullptr;
}
MultiKeywordSelector *getMultiKeywordSelector() const {
return reinterpret_cast<MultiKeywordSelector *>(InfoPtr & ~ArgFlags);
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h
index 783aa1d57b..89fd3886b4 100644
--- a/include/clang/Basic/Module.h
+++ b/include/clang/Basic/Module.h
@@ -311,7 +311,7 @@ public:
HeaderDirective &MissingHeader) const;
/// \brief Determine whether this module is a submodule.
- bool isSubModule() const { return Parent != 0; }
+ bool isSubModule() const { return Parent != nullptr; }
/// \brief Determine whether this module is a submodule of the given other
/// module.
@@ -362,8 +362,8 @@ public:
/// \brief Set the serialized AST file for the top-level module of this module.
void setASTFile(const FileEntry *File) {
- assert((File == 0 || getASTFile() == 0 || getASTFile() == File) &&
- "file path changed");
+ assert((File == nullptr || getASTFile() == nullptr ||
+ getASTFile() == File) && "file path changed");
getTopLevelModule()->ASTFile = File;
}
diff --git a/include/clang/Basic/PartialDiagnostic.h b/include/clang/Basic/PartialDiagnostic.h
index 314b9ef180..f5418c02d7 100644
--- a/include/clang/Basic/PartialDiagnostic.h
+++ b/include/clang/Basic/PartialDiagnostic.h
@@ -159,7 +159,7 @@ private:
Allocator->Deallocate(DiagStorage);
else if (Allocator != reinterpret_cast<StorageAllocator *>(~uintptr_t(0)))
delete DiagStorage;
- DiagStorage = 0;
+ DiagStorage = nullptr;
}
void AddSourceRange(const CharSourceRange &R) const {
@@ -187,13 +187,13 @@ public:
/// \brief Create a null partial diagnostic, which cannot carry a payload,
/// and only exists to be swapped with a real partial diagnostic.
PartialDiagnostic(NullDiagnostic)
- : DiagID(0), DiagStorage(0), Allocator(0) { }
+ : DiagID(0), DiagStorage(nullptr), Allocator(nullptr) { }
PartialDiagnostic(unsigned DiagID, StorageAllocator &Allocator)
- : DiagID(DiagID), DiagStorage(0), Allocator(&Allocator) { }
+ : DiagID(DiagID), DiagStorage(nullptr), Allocator(&Allocator) { }
PartialDiagnostic(const PartialDiagnostic &Other)
- : DiagID(Other.DiagID), DiagStorage(0), Allocator(Other.Allocator)
+ : DiagID(Other.DiagID), DiagStorage(nullptr), Allocator(Other.Allocator)
{
if (Other.DiagStorage) {
DiagStorage = getStorage();
@@ -204,7 +204,7 @@ public:
PartialDiagnostic(PartialDiagnostic &&Other)
: DiagID(Other.DiagID), DiagStorage(Other.DiagStorage),
Allocator(Other.Allocator) {
- Other.DiagStorage = 0;
+ Other.DiagStorage = nullptr;
}
PartialDiagnostic(const PartialDiagnostic &Other, Storage *DiagStorage)
@@ -216,7 +216,7 @@ public:
}
PartialDiagnostic(const Diagnostic &Other, StorageAllocator &Allocator)
- : DiagID(Other.getID()), DiagStorage(0), Allocator(&Allocator)
+ : DiagID(Other.getID()), DiagStorage(nullptr), Allocator(&Allocator)
{
// Copy arguments.
for (unsigned I = 0, N = Other.getNumArgs(); I != N; ++I) {
@@ -256,7 +256,7 @@ public:
DiagStorage = Other.DiagStorage;
Allocator = Other.Allocator;
- Other.DiagStorage = 0;
+ Other.DiagStorage = nullptr;
return *this;
}
@@ -335,7 +335,7 @@ public:
freeStorage();
}
- bool hasStorage() const { return DiagStorage != 0; }
+ bool hasStorage() const { return DiagStorage != nullptr; }
friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
unsigned I) {
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index 01ca9a5ac1..7b637d7e1f 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -268,7 +268,7 @@ class FullSourceLoc : public SourceLocation {
const SourceManager *SrcMgr;
public:
/// \brief Creates a FullSourceLoc where isValid() returns \c false.
- explicit FullSourceLoc() : SrcMgr(0) {}
+ explicit FullSourceLoc() : SrcMgr(nullptr) {}
explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM)
: SourceLocation(Loc), SrcMgr(&SM) {}
@@ -284,19 +284,19 @@ public:
FullSourceLoc getExpansionLoc() const;
FullSourceLoc getSpellingLoc() const;
- unsigned getExpansionLineNumber(bool *Invalid = 0) const;
- unsigned getExpansionColumnNumber(bool *Invalid = 0) const;
+ unsigned getExpansionLineNumber(bool *Invalid = nullptr) const;
+ unsigned getExpansionColumnNumber(bool *Invalid = nullptr) const;
- unsigned getSpellingLineNumber(bool *Invalid = 0) const;
- unsigned getSpellingColumnNumber(bool *Invalid = 0) const;
+ unsigned getSpellingLineNumber(bool *Invalid = nullptr) const;
+ unsigned getSpellingColumnNumber(bool *Invalid = nullptr) const;
- const char *getCharacterData(bool *Invalid = 0) const;
+ const char *getCharacterData(bool *Invalid = nullptr) const;
- const llvm::MemoryBuffer* getBuffer(bool *Invalid = 0) const;
+ const llvm::MemoryBuffer* getBuffer(bool *Invalid = nullptr) const;
/// \brief Return a StringRef to the source buffer data for the
/// specified FileID.
- StringRef getBufferData(bool *Invalid = 0) const;
+ StringRef getBufferData(bool *Invalid = nullptr) const;
/// \brief Decompose the specified location into a raw FileID + Offset pair.
///
@@ -358,7 +358,7 @@ class PresumedLoc {
unsigned Line, Col;
SourceLocation IncludeLoc;
public:
- PresumedLoc() : Filename(0) {}
+ PresumedLoc() : Filename(nullptr) {}
PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL)
: Filename(FN), Line(Ln), Col(Co), IncludeLoc(IL) {
}
@@ -367,8 +367,8 @@ public:
///
/// This occurs when created with invalid source locations or when walking
/// off the top of a \#include stack.
- bool isInvalid() const { return Filename == 0; }
- bool isValid() const { return Filename != 0; }
+ bool isInvalid() const { return Filename == nullptr; }
+ bool isValid() const { return Filename != nullptr; }
/// \brief Return the presumed filename of this location.
///
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 73fd770f72..df38f75adb 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -143,16 +143,16 @@ namespace SrcMgr {
/// file considered as a system one.
unsigned IsSystemFile : 1;
- ContentCache(const FileEntry *Ent = 0)
- : Buffer(0, false), OrigEntry(Ent), ContentsEntry(Ent),
- SourceLineCache(0), NumLines(0), BufferOverridden(false),
+ ContentCache(const FileEntry *Ent = nullptr)
+ : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(Ent),
+ SourceLineCache(nullptr), NumLines(0), BufferOverridden(false),
IsSystemFile(false) {
(void)NonceAligner; // Silence warnings about unused member.
}
ContentCache(const FileEntry *Ent, const FileEntry *contentEnt)
- : Buffer(0, false), OrigEntry(Ent), ContentsEntry(contentEnt),
- SourceLineCache(0), NumLines(0), BufferOverridden(false),
+ : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt),
+ SourceLineCache(nullptr), NumLines(0), BufferOverridden(false),
IsSystemFile(false) {}
~ContentCache();
@@ -161,15 +161,15 @@ namespace SrcMgr {
/// a non-NULL Buffer or SourceLineCache. Ownership of allocated memory
/// is not transferred, so this is a logical error.
ContentCache(const ContentCache &RHS)
- : Buffer(0, false), SourceLineCache(0), BufferOverridden(false),
- IsSystemFile(false)
- {
+ : Buffer(nullptr, false), SourceLineCache(nullptr),
+ BufferOverridden(false), IsSystemFile(false) {
OrigEntry = RHS.OrigEntry;
ContentsEntry = RHS.ContentsEntry;
-
- assert (RHS.Buffer.getPointer() == 0 && RHS.SourceLineCache == 0 &&
- "Passed ContentCache object cannot own a buffer.");
-
+
+ assert(RHS.Buffer.getPointer() == nullptr &&
+ RHS.SourceLineCache == nullptr &&
+ "Passed ContentCache object cannot own a buffer.");
+
NumLines = RHS.NumLines;
}
@@ -185,7 +185,7 @@ namespace SrcMgr {
const llvm::MemoryBuffer *getBuffer(DiagnosticsEngine &Diag,
const SourceManager &SM,
SourceLocation Loc = SourceLocation(),
- bool *Invalid = 0) const;
+ bool *Invalid = nullptr) const;
/// \brief Returns the size of the content encapsulated by this
/// ContentCache.
@@ -841,7 +841,7 @@ public:
/// \param Invalid If non-NULL, will be set \c true if an error
/// occurs while retrieving the memory buffer.
const llvm::MemoryBuffer *getMemoryBufferForFile(const FileEntry *File,
- bool *Invalid = 0);
+ bool *Invalid = nullptr);
/// \brief Override the contents of the given source file by providing an
/// already-allocated buffer.
@@ -893,7 +893,7 @@ public:
/// If there is an error opening this buffer the first time, this
/// manufactures a temporary buffer and returns a non-empty error string.
const llvm::MemoryBuffer *getBuffer(FileID FID, SourceLocation Loc,
- bool *Invalid = 0) const {
+ bool *Invalid = nullptr) const {
bool MyInvalid = false;
const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid);
if (MyInvalid || !Entry.isFile()) {
@@ -907,7 +907,8 @@ public:
Invalid);
}
- const llvm::MemoryBuffer *getBuffer(FileID FID, bool *Invalid = 0) const {
+ const llvm::MemoryBuffer *getBuffer(FileID FID,
+ bool *Invalid = nullptr) const {
bool MyInvalid = false;
const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid);
if (MyInvalid || !Entry.isFile()) {
@@ -927,11 +928,11 @@ public:
bool MyInvalid = false;
const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid);
if (MyInvalid || !Entry.isFile())
- return 0;
+ return nullptr;
const SrcMgr::ContentCache *Content = Entry.getFile().getContentCache();
if (!Content)
- return 0;
+ return nullptr;
return Content->OrigEntry;
}
@@ -940,7 +941,7 @@ public:
{
const SrcMgr::ContentCache *Content = sloc.getFile().getContentCache();
if (!Content)
- return 0;
+ return nullptr;
return Content->OrigEntry;
}
@@ -949,7 +950,7 @@ public:
///
/// \param FID The file ID whose contents will be returned.
/// \param Invalid If non-NULL, will be set true if an error occurred.
- StringRef getBufferData(FileID FID, bool *Invalid = 0) const;
+ StringRef getBufferData(FileID FID, bool *Invalid = nullptr) const;
/// \brief Get the number of FileIDs (files and macros) that were created
/// during preprocessing of \p FID, including it.
@@ -1184,15 +1185,16 @@ public:
/// \param MacroBegin If non-null and function returns true, it is set to the
/// begin location of the immediate macro expansion.
bool isAtStartOfImmediateMacroExpansion(SourceLocation Loc,
- SourceLocation *MacroBegin = 0) const;
+ SourceLocation *MacroBegin = nullptr) const;
/// \brief Returns true if the given MacroID location points at the character
/// end of the immediate macro expansion.
///
/// \param MacroEnd If non-null and function returns true, it is set to the
/// character end location of the immediate macro expansion.
- bool isAtEndOfImmediateMacroExpansion(SourceLocation Loc,
- SourceLocation *MacroEnd = 0) const;
+ bool
+ isAtEndOfImmediateMacroExpansion(SourceLocation Loc,
+ SourceLocation *MacroEnd = nullptr) const;
/// \brief Returns true if \p Loc is inside the [\p Start, +\p Length)
/// chunk of the source location address space.
@@ -1201,7 +1203,7 @@ public:
/// relative offset of \p Loc inside the chunk.
bool isInSLocAddrSpace(SourceLocation Loc,
SourceLocation Start, unsigned Length,
- unsigned *RelativeOffset = 0) const {
+ unsigned *RelativeOffset = nullptr) const {
assert(((Start.getOffset() < NextLocalOffset &&
Start.getOffset()+Length <= NextLocalOffset) ||
(Start.getOffset() >= CurrentLoadedOffset &&
@@ -1247,7 +1249,8 @@ public:
/// in the appropriate spelling MemoryBuffer.
///
/// \param Invalid If non-NULL, will be set \c true if an error occurs.
- const char *getCharacterData(SourceLocation SL, bool *Invalid = 0) const;
+ const char *getCharacterData(SourceLocation SL,
+ bool *Invalid = nullptr) const;
/// \brief Return the column # for the specified file position.
///
@@ -1256,12 +1259,13 @@ public:
/// on a file sloc, so you must choose a spelling or expansion location
/// before calling this method.
unsigned getColumnNumber(FileID FID, unsigned FilePos,
- bool *Invalid = 0) const;
- unsigned getSpellingColumnNumber(SourceLocation Loc, bool *Invalid = 0) const;
+ bool *Invalid = nullptr) const;
+ unsigned getSpellingColumnNumber(SourceLocation Loc,
+ bool *Invalid = nullptr) const;
unsigned getExpansionColumnNumber(SourceLocation Loc,
- bool *Invalid = 0) const;
- unsigned getPresumedColumnNumber(SourceLocation Loc, bool *Invalid = 0) const;
-
+ bool *Invalid = nullptr) const;
+ unsigned getPresumedColumnNumber(SourceLocation Loc,
+ bool *Invalid = nullptr) const;
/// \brief Given a SourceLocation, return the spelling line number
/// for the position indicated.
@@ -1269,17 +1273,17 @@ public:
/// This requires building and caching a table of line offsets for the
/// MemoryBuffer, so this is not cheap: use only when about to emit a
/// diagnostic.
- unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = 0) const;
- unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
- unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
- unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
+ unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = nullptr) const;
+ unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const;
+ unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const;
+ unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid = nullptr) const;
/// \brief Return the filename or buffer identifier of the buffer the
/// location is in.
///
/// Note that this name does not respect \#line directives. Use
/// getPresumedLoc for normal clients.
- const char *getBufferName(SourceLocation Loc, bool *Invalid = 0) const;
+ const char *getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const;
/// \brief Return the file characteristic of the specified source
/// location, indicating whether this is a normal file, a system
@@ -1356,7 +1360,7 @@ public:
/// FileID chunk and sets relative offset (offset of \p Loc from beginning
/// of FileID) to \p relativeOffset.
bool isInFileID(SourceLocation Loc, FileID FID,
- unsigned *RelativeOffset = 0) const {
+ unsigned *RelativeOffset = nullptr) const {
unsigned Offs = Loc.getOffset();
if (isOffsetInFileID(FID, Offs)) {
if (RelativeOffset)
@@ -1385,7 +1389,7 @@ public:
bool IsSystemHeader, bool IsExternCHeader);
/// \brief Determine if the source manager has a line table.
- bool hasLineTable() const { return LineTable != 0; }
+ bool hasLineTable() const { return LineTable != nullptr; }
/// \brief Retrieve the stored line table.
LineTableInfo &getLineTable();
@@ -1492,7 +1496,7 @@ public:
/// \brief Get a local SLocEntry. This is exposed for indexing.
const SrcMgr::SLocEntry &getLocalSLocEntry(unsigned Index,
- bool *Invalid = 0) const {
+ bool *Invalid = nullptr) const {
assert(Index < LocalSLocEntryTable.size() && "Invalid index");
return LocalSLocEntryTable[Index];
}
@@ -1502,14 +1506,15 @@ public:
/// \brief Get a loaded SLocEntry. This is exposed for indexing.
const SrcMgr::SLocEntry &getLoadedSLocEntry(unsigned Index,
- bool *Invalid = 0) const {
+ bool *Invalid = nullptr) const {
assert(Index < LoadedSLocEntryTable.size() && "Invalid index");
if (SLocEntryLoaded[Index])
return LoadedSLocEntryTable[Index];
return loadSLocEntry(Index, Invalid);
}
- const SrcMgr::SLocEntry &getSLocEntry(FileID FID, bool *Invalid = 0) const {
+ const SrcMgr::SLocEntry &getSLocEntry(FileID FID,
+ bool *Invalid = nullptr) const {
if (FID.ID == 0 || FID.ID == -1) {
if (Invalid) *Invalid = true;
return LocalSLocEntryTable[0];
@@ -1578,15 +1583,16 @@ private:
const SrcMgr::SLocEntry &loadSLocEntry(unsigned Index, bool *Invalid) const;
/// \brief Get the entry with the given unwrapped FileID.
- const SrcMgr::SLocEntry &getSLocEntryByID(int ID, bool *Invalid = 0) const {
+ const SrcMgr::SLocEntry &getSLocEntryByID(int ID,
+ bool *Invalid = nullptr) const {
assert(ID != -1 && "Using FileID sentinel value");
if (ID < 0)
return getLoadedSLocEntryByID(ID, Invalid);
return getLocalSLocEntry(static_cast<unsigned>(ID), Invalid);
}
- const SrcMgr::SLocEntry &getLoadedSLocEntryByID(int ID,
- bool *Invalid = 0) const {
+ const SrcMgr::SLocEntry &
+ getLoadedSLocEntryByID(int ID, bool *Invalid = nullptr) const {
return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2), Invalid);
}
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index f9f7904cb3..29de91569d 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -735,7 +735,7 @@ public:
/// \brief Return the section to use for C++ static initialization functions.
virtual const char *getStaticInitSectionSpecifier() const {
- return 0;
+ return nullptr;
}
const LangAS::Map &getAddressSpaceMap() const {
@@ -801,7 +801,7 @@ protected:
unsigned &NumAliases) const = 0;
virtual void getGCCAddlRegNames(const AddlRegName *&Addl,
unsigned &NumAddl) const {
- Addl = 0;
+ Addl = nullptr;
NumAddl = 0;
}
virtual bool validateAsmConstraint(const char *&Name,
diff --git a/include/clang/Basic/VirtualFileSystem.h b/include/clang/Basic/VirtualFileSystem.h
index f6307db991..ec2ca7050a 100644
--- a/include/clang/Basic/VirtualFileSystem.h
+++ b/include/clang/Basic/VirtualFileSystem.h
@@ -163,7 +163,7 @@ llvm::sys::fs::UniqueID getNextVirtualUniqueID();
IntrusiveRefCntPtr<FileSystem>
getVFSFromYAML(llvm::MemoryBuffer *Buffer,
llvm::SourceMgr::DiagHandlerTy DiagHandler,
- void *DiagContext = 0,
+ void *DiagContext = nullptr,
IntrusiveRefCntPtr<FileSystem> ExternalFS = getRealFileSystem());
} // end namespace vfs
diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h
index 2300d291de..37819c780d 100644
--- a/include/clang/CodeGen/CodeGenAction.h
+++ b/include/clang/CodeGen/CodeGenAction.h
@@ -33,7 +33,7 @@ protected:
/// Create a new code generation action. If the optional \p _VMContext
/// parameter is supplied, the action uses it without taking ownership,
/// otherwise it creates a fresh LLVM context and takes ownership.
- CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0);
+ CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = nullptr);
bool hasIRSupport() const override;
@@ -65,37 +65,37 @@ public:
class EmitAssemblyAction : public CodeGenAction {
virtual void anchor();
public:
- EmitAssemblyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitAssemblyAction(llvm::LLVMContext *_VMContext = nullptr);
};
class EmitBCAction : public CodeGenAction {
virtual void anchor();
public:
- EmitBCAction(llvm::LLVMContext *_VMContext = 0);
+ EmitBCAction(llvm::LLVMContext *_VMContext = nullptr);
};
class EmitLLVMAction : public CodeGenAction {
virtual void anchor();
public:
- EmitLLVMAction(llvm::LLVMContext *_VMContext = 0);
+ EmitLLVMAction(llvm::LLVMContext *_VMContext = nullptr);
};
class EmitLLVMOnlyAction : public CodeGenAction {
virtual void anchor();
public:
- EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = nullptr);
};
class EmitCodeGenOnlyAction : public CodeGenAction {
virtual void anchor();
public:
- EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = 0);
+ EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = nullptr);
};
class EmitObjAction : public CodeGenAction {
virtual void anchor();
public:
- EmitObjAction(llvm::LLVMContext *_VMContext = 0);
+ EmitObjAction(llvm::LLVMContext *_VMContext = nullptr);
};
}
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index 960e5c019a..269bc1ad6b 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -188,7 +188,7 @@ private:
// getFinalPhase - Determine which compilation mode we are in and record
// which option we used to determine the final phase.
phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
- llvm::opt::Arg **FinalPhaseArg = 0) const;
+ llvm::opt::Arg **FinalPhaseArg = nullptr) const;
public:
Driver(StringRef _ClangExecutable,
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index 953229c0bd..f3db2c1c90 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -147,7 +147,7 @@ public:
virtual llvm::opt::DerivedArgList *
TranslateArgs(const llvm::opt::DerivedArgList &Args,
const char *BoundArch) const {
- return 0;
+ return nullptr;
}
/// Choose a tool to use to handle the action \p JA.
diff --git a/include/clang/Driver/Types.def b/include/clang/Driver/Types.def
index d4f52d3220..32096792ca 100644
--- a/include/clang/Driver/Types.def
+++ b/include/clang/Driver/Types.def
@@ -54,22 +54,22 @@ TYPE("objective-c++", ObjCXX, PP_ObjCXX, "mm", "u")
// C family input files to precompile.
TYPE("c-header-cpp-output", PP_CHeader, INVALID, "i", "p")
-TYPE("c-header", CHeader, PP_CHeader, 0, "pu")
-TYPE("cl-header", CLHeader, PP_CHeader, 0, "pu")
+TYPE("c-header", CHeader, PP_CHeader, nullptr, "pu")
+TYPE("cl-header", CLHeader, PP_CHeader, nullptr, "pu")
TYPE("objective-c-header-cpp-output", PP_ObjCHeader, INVALID, "mi", "p")
-TYPE("objective-c-header", ObjCHeader, PP_ObjCHeader, 0, "pu")
+TYPE("objective-c-header", ObjCHeader, PP_ObjCHeader, nullptr, "pu")
TYPE("c++-header-cpp-output", PP_CXXHeader, INVALID, "ii", "p")
-TYPE("c++-header", CXXHeader, PP_CXXHeader, 0, "pu")
+TYPE("c++-header", CXXHeader, PP_CXXHeader, nullptr, "pu")
TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii", "p")
-TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, 0, "pu")
+TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, nullptr, "pu")
// Other languages.
-TYPE("ada", Ada, INVALID, 0, "u")
+TYPE("ada", Ada, INVALID, nullptr, "u")
TYPE("assembler", PP_Asm, INVALID, "s", "au")
TYPE("assembler-with-cpp", Asm, PP_Asm, "S", "au")
-TYPE("f95", PP_Fortran, INVALID, 0, "u")
-TYPE("f95-cpp-input", Fortran, PP_Fortran, 0, "u")
-TYPE("java", Java, INVALID, 0, "u")
+TYPE("f95", PP_Fortran, INVALID, nullptr, "u")
+TYPE("f95-cpp-input", Fortran, PP_Fortran, nullptr, "u")
+TYPE("java", Java, INVALID, nullptr, "u")
// LLVM IR/LTO types. We define separate types for IR and LTO because LTO
// outputs should use the standard suffixes.
@@ -87,8 +87,8 @@ TYPE("rewritten-legacy-objc", RewrittenLegacyObjC,INVALID, "cpp", "")
TYPE("remap", Remap, INVALID, "remap", "")
TYPE("precompiled-header", PCH, INVALID, "gch", "A")
TYPE("object", Object, INVALID, "o", "")
-TYPE("treelang", Treelang, INVALID, 0, "u")
+TYPE("treelang", Treelang, INVALID, nullptr, "u")
TYPE("image", Image, INVALID, "out", "")
TYPE("dSYM", dSYM, INVALID, "dSYM", "A")
TYPE("dependencies", Dependencies, INVALID, "d", "")
-TYPE("none", Nothing, INVALID, 0, "u")
+TYPE("none", Nothing, INVALID, nullptr, "u")
diff --git a/include/clang/Edit/Commit.h b/include/clang/Edit/Commit.h
index 0ff7034ba0..5cc5b9c6ff 100644
--- a/include/clang/Edit/Commit.h
+++ b/include/clang/Edit/Commit.h
@@ -58,8 +58,8 @@ private:
public:
explicit Commit(EditedSource &Editor);
Commit(const SourceManager &SM, const LangOptions &LangOpts,
- const PPConditionalDirectiveRecord *PPRec = 0)
- : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), Editor(0),
+ const PPConditionalDirectiveRecord *PPRec = nullptr)
+ : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), Editor(nullptr),
IsCommitable(true) { }
bool isCommitable() const { return IsCommitable; }
@@ -131,9 +131,9 @@ private:
void commitRemove(FileOffset offset, unsigned length);
bool isAtStartOfMacroExpansion(SourceLocation loc,
- SourceLocation *MacroBegin = 0) const;
+ SourceLocation *MacroBegin = nullptr) const;
bool isAtEndOfMacroExpansion(SourceLocation loc,
- SourceLocation *MacroEnd = 0) const;
+ SourceLocation *MacroEnd = nullptr) const;
StringRef copyString(StringRef str) {
char *buf = StrAlloc.Allocate<char>(str.size());
diff --git a/include/clang/Edit/EditedSource.h b/include/clang/Edit/EditedSource.h
index f9887cc9e8..150a5b41b5 100644
--- a/include/clang/Edit/EditedSource.h
+++ b/include/clang/Edit/EditedSource.h
@@ -45,7 +45,7 @@ class EditedSource {
public:
EditedSource(const SourceManager &SM, const LangOptions &LangOpts,
- const PPConditionalDirectiveRecord *PPRec = 0)
+ const PPConditionalDirectiveRecord *PPRec = nullptr)
: SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec),
StrAlloc() { }
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 17675c3037..3d7d0f2796 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -189,7 +189,7 @@ public:
mutable unsigned NumLines;
public:
- PreambleData() : File(0), NumLines(0) { }
+ PreambleData() : File(nullptr), NumLines(0) { }
void assign(const FileEntry *F, const char *begin, const char *end) {
File = F;
@@ -197,7 +197,7 @@ public:
NumLines = 0;
}
- void clear() { Buffer.clear(); File = 0; NumLines = 0; }
+ void clear() { Buffer.clear(); File = nullptr; NumLines = 0; }
size_t size() const { return Buffer.size(); }
bool empty() const { return Buffer.empty(); }
@@ -685,7 +685,7 @@ public:
bool isModuleFile();
llvm::MemoryBuffer *getBufferForFile(StringRef Filename,
- std::string *ErrorStr = 0);
+ std::string *ErrorStr = nullptr);
/// \brief Determine what kind of translation unit this AST represents.
TranslationUnitKind getTranslationUnitKind() const { return TUKind; }
@@ -757,12 +757,13 @@ public:
///
static ASTUnit *LoadFromCompilerInvocationAction(
CompilerInvocation *CI, IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
- ASTFrontendAction *Action = 0, ASTUnit *Unit = 0, bool Persistent = true,
- StringRef ResourceFilesPath = StringRef(), bool OnlyLocalDecls = false,
- bool CaptureDiagnostics = false, bool PrecompilePreamble = false,
- bool CacheCodeCompletionResults = false,
+ ASTFrontendAction *Action = nullptr, ASTUnit *Unit = nullptr,
+ bool Persistent = true, StringRef ResourceFilesPath = StringRef(),
+ bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,
+ bool PrecompilePreamble = false, bool CacheCodeCompletionResults = false,
bool IncludeBriefCommentsInCodeCompletion = false,
- bool UserFilesAreVolatile = false, std::unique_ptr<ASTUnit> *ErrAST = 0);
+ bool UserFilesAreVolatile = false,
+ std::unique_ptr<ASTUnit> *ErrAST = nullptr);
/// LoadFromCompilerInvocation - Create an ASTUnit from a source file, via a
/// CompilerInvocation object.
@@ -812,7 +813,7 @@ public:
bool IncludeBriefCommentsInCodeCompletion = false,
bool AllowPCHWithCompilerErrors = false, bool SkipFunctionBodies = false,
bool UserFilesAreVolatile = false, bool ForSerialization = false,
- std::unique_ptr<ASTUnit> *ErrAST = 0);
+ std::unique_ptr<ASTUnit> *ErrAST = nullptr);
/// \brief Reparse the source files using the same command-line options that
/// were originally used to produce this translation unit.
@@ -873,7 +874,7 @@ public:
SourceLocation ImportLoc, bool Complain) override {}
GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override
- { return 0; }
+ { return nullptr; }
bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override
{ return 0; };
};
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index cefd172faf..e936fbf23b 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -193,7 +193,7 @@ public:
/// @name Compiler Invocation and Options
/// {
- bool hasInvocation() const { return Invocation != 0; }
+ bool hasInvocation() const { return Invocation != nullptr; }
CompilerInvocation &getInvocation() {
assert(Invocation && "Compiler instance has no invocation!");
@@ -291,7 +291,7 @@ public:
/// @name Diagnostics Engine
/// {
- bool hasDiagnostics() const { return Diagnostics != 0; }
+ bool hasDiagnostics() const { return Diagnostics != nullptr; }
/// Get the current diagnostics engine.
DiagnosticsEngine &getDiagnostics() const {
@@ -312,7 +312,7 @@ public:
/// @name Target Info
/// {
- bool hasTarget() const { return Target != 0; }
+ bool hasTarget() const { return Target != nullptr; }
TargetInfo &getTarget() const {
assert(Target && "Compiler instance has no target!");
@@ -326,7 +326,7 @@ public:
/// @name Virtual File System
/// {
- bool hasVirtualFileSystem() const { return VirtualFileSystem != 0; }
+ bool hasVirtualFileSystem() const { return VirtualFileSystem != nullptr; }
vfs::FileSystem &getVirtualFileSystem() const {
assert(hasVirtualFileSystem() &&
@@ -346,7 +346,7 @@ public:
/// @name File Manager
/// {
- bool hasFileManager() const { return FileMgr != 0; }
+ bool hasFileManager() const { return FileMgr != nullptr; }
/// Return the current file manager to the caller.
FileManager &getFileManager() const {
@@ -366,7 +366,7 @@ public:
/// @name Source Manager
/// {
- bool hasSourceManager() const { return SourceMgr != 0; }
+ bool hasSourceManager() const { return SourceMgr != nullptr; }
/// Return the current source manager.
SourceManager &getSourceManager() const {
@@ -386,7 +386,7 @@ public:
/// @name Preprocessor
/// {
- bool hasPreprocessor() const { return PP != 0; }
+ bool hasPreprocessor() const { return PP != nullptr; }
/// Return the current preprocessor.
Preprocessor &getPreprocessor() const {
@@ -406,7 +406,7 @@ public:
/// @name ASTContext
/// {
- bool hasASTContext() const { return Context != 0; }
+ bool hasASTContext() const { return Context != nullptr; }
ASTContext &getASTContext() const {
assert(Context && "Compiler instance has no AST context!");
@@ -528,7 +528,7 @@ public:
///
/// \param ShouldOwnClient If Client is non-NULL, specifies whether
/// the diagnostic object should take ownership of the client.
- void createDiagnostics(DiagnosticConsumer *Client = 0,
+ void createDiagnostics(DiagnosticConsumer *Client = nullptr,
bool ShouldOwnClient = true);
/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
@@ -551,9 +551,9 @@ public:
/// \return The new object on success, or null on failure.
static IntrusiveRefCntPtr<DiagnosticsEngine>
createDiagnostics(DiagnosticOptions *Opts,
- DiagnosticConsumer *Client = 0,
+ DiagnosticConsumer *Client = nullptr,
bool ShouldOwnClient = true,
- const CodeGenOptions *CodeGenOpts = 0);
+ const CodeGenOptions *CodeGenOpts = nullptr);
/// Create the file manager and replace any existing one with it.
void createFileManager();
diff --git a/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index 7258dbeb2a..e6d79d81cb 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/include/clang/Frontend/CompilerInvocation.h
@@ -47,7 +47,7 @@ class DiagnosticsEngine;
/// When errors are encountered, return false and, if Diags is non-null,
/// report the error(s).
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
- DiagnosticsEngine *Diags = 0);
+ DiagnosticsEngine *Diags = nullptr);
class CompilerInvocationBase : public RefCountedBase<CompilerInvocation> {
protected:
diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h
index f554b88f45..019eec5e0e 100644
--- a/include/clang/Frontend/DiagnosticRenderer.h
+++ b/include/clang/Frontend/DiagnosticRenderer.h
@@ -144,7 +144,7 @@ public:
StringRef Message, ArrayRef<CharSourceRange> Ranges,
ArrayRef<FixItHint> FixItHints,
const SourceManager *SM,
- DiagOrStoredDiag D = (Diagnostic *)0);
+ DiagOrStoredDiag D = (Diagnostic *)nullptr);
void emitStoredDiagnostic(StoredDiagnostic &Diag);
};
diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h
index 8c245130ee..9ac9d2828f 100644
--- a/include/clang/Frontend/FrontendAction.h
+++ b/include/clang/Frontend/FrontendAction.h
@@ -148,7 +148,8 @@ public:
ASTUnit *takeCurrentASTUnit() { return CurrentASTUnit.release(); }
- void setCurrentInput(const FrontendInputFile &CurrentInput, ASTUnit *AST = 0);
+ void setCurrentInput(const FrontendInputFile &CurrentInput,
+ ASTUnit *AST = nullptr);
/// @}
/// @name Supported Modes
diff --git a/include/clang/Frontend/FrontendActions.h b/include/clang/Frontend/FrontendActions.h
index 0e2664ccb4..84cc82cfbe 100644
--- a/include/clang/Frontend/FrontendActions.h
+++ b/include/clang/Frontend/FrontendActions.h
@@ -201,7 +201,7 @@ class PrintPreambleAction : public FrontendAction {
protected:
void ExecuteAction() override;
ASTConsumer *CreateASTConsumer(CompilerInstance &, StringRef) override {
- return 0;
+ return nullptr;
}
bool usesPreprocessorOnly() const override { return true; }
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index fc13b19393..e87da8de1c 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -90,9 +90,9 @@ class FrontendInputFile {
bool IsSystem;
public:
- FrontendInputFile() : Buffer(0), Kind(IK_None) { }
+ FrontendInputFile() : Buffer(nullptr), Kind(IK_None) { }
FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false)
- : File(File.str()), Buffer(0), Kind(Kind), IsSystem(IsSystem) { }
+ : File(File.str()), Buffer(nullptr), Kind(Kind), IsSystem(IsSystem) { }
FrontendInputFile(llvm::MemoryBuffer *buffer, InputKind Kind,
bool IsSystem = false)
: Buffer(buffer), Kind(Kind), IsSystem(IsSystem) { }
@@ -100,9 +100,9 @@ public:
InputKind getKind() const { return Kind; }
bool isSystem() const { return IsSystem; }
- bool isEmpty() const { return File.empty() && Buffer == 0; }
+ bool isEmpty() const { return File.empty() && Buffer == nullptr; }
bool isFile() const { return !isBuffer(); }
- bool isBuffer() const { return Buffer != 0; }
+ bool isBuffer() const { return Buffer != nullptr; }
StringRef getFile() const {
assert(isFile());
diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h
index 4d86e0b899..8fb536ff57 100644
--- a/include/clang/Frontend/Utils.h
+++ b/include/clang/Frontend/Utils.h
@@ -118,7 +118,7 @@ createInvocationFromCommandLine(ArrayRef<const char *> Args,
/// is non-null, emits an error if the argument is given, but non-integral.
int getLastArgIntValue(const llvm::opt::ArgList &Args,
llvm::opt::OptSpecifier Id, int Default,
- DiagnosticsEngine *Diags = 0);
+ DiagnosticsEngine *Diags = nullptr);
inline int getLastArgIntValue(const llvm::opt::ArgList &Args,
llvm::opt::OptSpecifier Id, int Default,
@@ -128,7 +128,7 @@ inline int getLastArgIntValue(const llvm::opt::ArgList &Args,
uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
llvm::opt::OptSpecifier Id, uint64_t Default,
- DiagnosticsEngine *Diags = 0);
+ DiagnosticsEngine *Diags = nullptr);
inline uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args,
llvm::opt::OptSpecifier Id,
diff --git a/include/clang/Lex/DirectoryLookup.h b/include/clang/Lex/DirectoryLookup.h
index 16899a074b..9edf119660 100644
--- a/include/clang/Lex/DirectoryLookup.h
+++ b/include/clang/Lex/DirectoryLookup.h
@@ -92,17 +92,21 @@ public:
/// getDir - Return the directory that this entry refers to.
///
- const DirectoryEntry *getDir() const { return isNormalDir() ? u.Dir : 0; }
+ const DirectoryEntry *getDir() const {
+ return isNormalDir() ? u.Dir : nullptr;
+ }
/// getFrameworkDir - Return the directory that this framework refers to.
///
const DirectoryEntry *getFrameworkDir() const {
- return isFramework() ? u.Dir : 0;
+ return isFramework() ? u.Dir : nullptr;
}
/// getHeaderMap - Return the directory that this entry refers to.
///
- const HeaderMap *getHeaderMap() const { return isHeaderMap() ? u.Map : 0; }
+ const HeaderMap *getHeaderMap() const {
+ return isHeaderMap() ? u.Map : nullptr;
+ }
/// isNormalDir - Return true if this is a normal directory, not a header map.
bool isNormalDir() const { return getLookupType() == LT_NormalDir; }
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index a62a710d78..0342629827 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -106,7 +106,7 @@ struct HeaderFileInfo {
External(false), isModuleHeader(false), isCompilingModuleHeader(false),
HeaderRole(ModuleMap::NormalHeader),
Resolved(false), IndexHeaderMapHeader(false), IsValid(0),
- NumIncludes(0), ControllingMacroID(0), ControllingMacro(0) {}
+ NumIncludes(0), ControllingMacroID(0), ControllingMacro(nullptr) {}
/// \brief Retrieve the controlling macro for this header file, if
/// any.
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index 513eb88e4a..edcf883ece 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -205,7 +205,7 @@ public:
/// ReadToEndOfLine - Read the rest of the current preprocessor line as an
/// uninterpreted string. This switches the lexer out of directive mode.
- void ReadToEndOfLine(SmallVectorImpl<char> *Result = 0);
+ void ReadToEndOfLine(SmallVectorImpl<char> *Result = nullptr);
/// Diag - Forwarding function for diagnostics. This translate a source
@@ -248,7 +248,7 @@ public:
static unsigned getSpelling(const Token &Tok, const char *&Buffer,
const SourceManager &SourceMgr,
const LangOptions &LangOpts,
- bool *Invalid = 0);
+ bool *Invalid = nullptr);
/// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a
/// token is the characters used to represent the token in the source file
@@ -258,7 +258,7 @@ public:
static std::string getSpelling(const Token &Tok,
const SourceManager &SourceMgr,
const LangOptions &LangOpts,
- bool *Invalid = 0);
+ bool *Invalid = nullptr);
/// getSpelling - This method is used to get the spelling of the
/// token at the given source location. If, as is usually true, it
@@ -272,7 +272,7 @@ public:
SmallVectorImpl<char> &buffer,
const SourceManager &SourceMgr,
const LangOptions &LangOpts,
- bool *invalid = 0);
+ bool *invalid = nullptr);
/// MeasureTokenLength - Relex the token at the specified location and return
/// its length in bytes in the input file. If the token needs cleaning (e.g.
@@ -331,7 +331,7 @@ public:
static bool isAtStartOfMacroExpansion(SourceLocation loc,
const SourceManager &SM,
const LangOptions &LangOpts,
- SourceLocation *MacroBegin = 0);
+ SourceLocation *MacroBegin = nullptr);
/// \brief Returns true if the given MacroID location points at the last
/// token of the macro expansion.
@@ -341,7 +341,7 @@ public:
static bool isAtEndOfMacroExpansion(SourceLocation loc,
const SourceManager &SM,
const LangOptions &LangOpts,
- SourceLocation *MacroEnd = 0);
+ SourceLocation *MacroEnd = nullptr);
/// \brief Accepts a range and returns a character range with file locations.
///
@@ -377,7 +377,7 @@ public:
static StringRef getSourceText(CharSourceRange Range,
const SourceManager &SM,
const LangOptions &LangOpts,
- bool *Invalid = 0);
+ bool *Invalid = nullptr);
/// \brief Retrieve the name of the immediate macro expansion.
///
@@ -548,7 +548,8 @@ private:
/// getCharAndSizeSlow - Handle the slow/uncommon case of the getCharAndSize
/// method.
- char getCharAndSizeSlow(const char *Ptr, unsigned &Size, Token *Tok = 0);
+ char getCharAndSizeSlow(const char *Ptr, unsigned &Size,
+ Token *Tok = nullptr);
/// getEscapedNewLineSize - Return the size of the specified escaped newline,
/// or 0 if it is not an escaped newline. P[-1] is known to be a "\" on entry
diff --git a/include/clang/Lex/LiteralSupport.h b/include/clang/Lex/LiteralSupport.h
index 3e52418c0e..2eb7751f3c 100644
--- a/include/clang/Lex/LiteralSupport.h
+++ b/include/clang/Lex/LiteralSupport.h
@@ -200,7 +200,8 @@ public:
Preprocessor &PP, bool Complain = true);
StringLiteralParser(const Token *StringToks, unsigned NumStringToks,
const SourceManager &sm, const LangOptions &features,
- const TargetInfo &target, DiagnosticsEngine *diags = 0)
+ const TargetInfo &target,
+ DiagnosticsEngine *diags = nullptr)
: SM(sm), Features(features), Target(target), Diags(diags),
MaxTokenLength(0), SizeBound(0), CharByteWidth(0), Kind(tok::unknown),
ResultPtr(ResultBuf.data()), hadError(false), Pascal(false) {
diff --git a/include/clang/Lex/MacroArgs.h b/include/clang/Lex/MacroArgs.h
index 1fd295ebfa..4c0120c77f 100644
--- a/include/clang/Lex/MacroArgs.h
+++ b/include/clang/Lex/MacroArgs.h
@@ -52,9 +52,10 @@ class MacroArgs {
/// ArgCache - This is a linked list of MacroArgs objects that the
/// Preprocessor owns which we use to avoid thrashing malloc/free.
MacroArgs *ArgCache;
-
+
MacroArgs(unsigned NumToks, bool varargsElided)
- : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided), ArgCache(0) {}
+ : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided),
+ ArgCache(nullptr) {}
~MacroArgs() {}
public:
/// MacroArgs ctor function - Create a new MacroArgs object with the specified
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index cfbb376c16..7c04031570 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -108,7 +108,7 @@ private:
bool UsedForHeaderGuard : 1;
~MacroInfo() {
- assert(ArgumentList == 0 && "Didn't call destroy before dtor!");
+ assert(!ArgumentList && "Didn't call destroy before dtor!");
}
public:
@@ -119,7 +119,7 @@ public:
/// This restores this MacroInfo to a state where it can be reused for other
/// devious purposes.
void FreeArgumentList() {
- ArgumentList = 0;
+ ArgumentList = nullptr;
NumArguments = 0;
}
@@ -179,7 +179,7 @@ public:
/// this macro.
void setArgumentList(IdentifierInfo* const *List, unsigned NumArgs,
llvm::BumpPtrAllocator &PPAllocator) {
- assert(ArgumentList == 0 && NumArguments == 0 &&
+ assert(ArgumentList == nullptr && NumArguments == 0 &&
"Argument list already set!");
if (NumArgs == 0) return;
@@ -362,7 +362,7 @@ protected:
bool IsPublic : 1;
MacroDirective(Kind K, SourceLocation Loc)
- : Previous(0), Loc(Loc), MDKind(K), IsFromPCH(false),
+ : Previous(nullptr), Loc(Loc), MDKind(K), IsFromPCH(false),
IsImported(false), IsAmbiguous(false),
IsPublic(true) {
}
@@ -394,7 +394,7 @@ public:
bool IsPublic;
public:
- DefInfo() : DefDirective(0) { }
+ DefInfo() : DefDirective(nullptr) { }
DefInfo(DefMacroDirective *DefDirective, SourceLocation UndefLoc,
bool isPublic)
@@ -414,7 +414,7 @@ public:
bool isPublic() const { return IsPublic; }
- bool isValid() const { return DefDirective != 0; }
+ bool isValid() const { return DefDirective != nullptr; }
bool isInvalid() const { return !isValid(); }
LLVM_EXPLICIT operator bool() const { return isValid(); }
@@ -529,13 +529,13 @@ inline SourceLocation MacroDirective::DefInfo::getLocation() const {
inline MacroInfo *MacroDirective::DefInfo::getMacroInfo() {
if (isInvalid())
- return 0;
+ return nullptr;
return DefDirective->getInfo();
}
inline MacroDirective::DefInfo
MacroDirective::DefInfo::getPreviousDefinition() {
- if (isInvalid() || DefDirective->getPrevious() == 0)
+ if (isInvalid() || DefDirective->getPrevious() == nullptr)
return DefInfo();
return DefDirective->getPrevious()->getDefinition();
}
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h
index 74c83b26ea..a86a927499 100644
--- a/include/clang/Lex/ModuleMap.h
+++ b/include/clang/Lex/ModuleMap.h
@@ -86,7 +86,7 @@ public:
llvm::PointerIntPair<Module *, 2, ModuleHeaderRole> Storage;
public:
- KnownHeader() : Storage(0, NormalHeader) { }
+ KnownHeader() : Storage(nullptr, NormalHeader) { }
KnownHeader(Module *M, ModuleHeaderRole Role) : Storage(M, Role) { }
/// \brief Retrieve the module the header is stored in.
@@ -102,7 +102,9 @@ public:
// \brief Whether this known header is valid (i.e., it has an
// associated module).
- LLVM_EXPLICIT operator bool() const { return Storage.getPointer() != 0; }
+ LLVM_EXPLICIT operator bool() const {
+ return Storage.getPointer() != nullptr;
+ }
};
private:
@@ -243,7 +245,7 @@ public:
/// given header file. The KnownHeader is default constructed to indicate
/// that no module owns this header file.
KnownHeader findModuleForHeader(const FileEntry *File,
- Module *RequestingModule = NULL);
+ Module *RequestingModule = nullptr);
/// \brief Reports errors if a module must not include a specific file.
///
diff --git a/include/clang/Lex/MultipleIncludeOpt.h b/include/clang/Lex/MultipleIncludeOpt.h
index b532bf82f0..e3c6de555b 100644
--- a/include/clang/Lex/MultipleIncludeOpt.h
+++ b/include/clang/Lex/MultipleIncludeOpt.h
@@ -60,8 +60,8 @@ public:
ReadAnyTokens = false;
ImmediatelyAfterTopLevelIfndef = false;
DidMacroExpansion = false;
- TheMacro = 0;
- DefinedMacro = 0;
+ TheMacro = nullptr;
+ DefinedMacro = nullptr;
}
SourceLocation GetMacroLocation() const {
@@ -88,8 +88,8 @@ public:
// below can never "accept".
ReadAnyTokens = true;
ImmediatelyAfterTopLevelIfndef = false;
- DefinedMacro = 0;
- TheMacro = 0;
+ DefinedMacro = nullptr;
+ TheMacro = nullptr;
}
/// getHasReadAnyTokensVal - This is used for the \#ifndef hande-shake at the
@@ -166,7 +166,7 @@ public:
// macro if it's valid (if it isn't, it will be null).
if (!ReadAnyTokens)
return TheMacro;
- return 0;
+ return nullptr;
}
/// \brief If the ControllingMacro is followed by a macro definition, return
diff --git a/include/clang/Lex/Pragma.h b/include/clang/Lex/Pragma.h
index f263820b53..4a695a0e90 100644
--- a/include/clang/Lex/Pragma.h
+++ b/include/clang/Lex/Pragma.h
@@ -69,7 +69,7 @@ public:
/// getIfNamespace - If this is a namespace, return it. This is equivalent to
/// using a dynamic_cast, but doesn't require RTTI.
- virtual PragmaNamespace *getIfNamespace() { return 0; }
+ virtual PragmaNamespace *getIfNamespace() { return nullptr; }
};
/// EmptyPragmaHandler - A pragma handler which takes no action, which can be
diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h
index 495da76cd3..4609fe3c68 100644
--- a/include/clang/Lex/PreprocessingRecord.h
+++ b/include/clang/Lex/PreprocessingRecord.h
@@ -403,7 +403,7 @@ namespace clang {
typedef std::random_access_iterator_tag iterator_category;
typedef int difference_type;
- iterator() : Self(0), Position(0) { }
+ iterator() : Self(nullptr), Position(0) { }
iterator(PreprocessingRecord *Self, int Position)
: Self(Self), Position(Position) { }
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index d1b28dd8f0..33ffe7759f 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -65,7 +65,7 @@ class TokenValue {
IdentifierInfo *II;
public:
- TokenValue(tok::TokenKind Kind) : Kind(Kind), II(0) {
+ TokenValue(tok::TokenKind Kind) : Kind(Kind), II(nullptr) {
assert(Kind != tok::raw_identifier && "Raw identifiers are not supported.");
assert(Kind != tok::identifier &&
"Identifiers should be created by TokenValue(IdentifierInfo *)");
@@ -457,7 +457,7 @@ public:
DiagnosticsEngine &diags, LangOptions &opts,
SourceManager &SM, HeaderSearch &Headers,
ModuleLoader &TheModuleLoader,
- IdentifierInfoLookup *IILookup = 0,
+ IdentifierInfoLookup *IILookup = nullptr,
bool OwnsHeaderSearch = false,
TranslationUnitKind TUKind = TU_Complete);
@@ -577,7 +577,7 @@ public:
/// \#defined or null if it isn't \#define'd.
MacroDirective *getMacroDirective(IdentifierInfo *II) const {
if (!II->hasMacroDefinition())
- return 0;
+ return nullptr;
MacroDirective *MD = getMacroDirectiveHistory(II);
assert(MD->isDefined() && "Macro is undefined!");
@@ -591,7 +591,7 @@ public:
MacroInfo *getMacroInfo(IdentifierInfo *II) {
if (MacroDirective *MD = getMacroDirective(II))
return MD->getMacroInfo();
- return 0;
+ return nullptr;
}
/// \brief Given an identifier, return the (probably #undef'd) MacroInfo
@@ -687,7 +687,7 @@ public:
/// \brief Clear out the code completion handler.
void clearCodeCompletionHandler() {
- CodeComplete = 0;
+ CodeComplete = nullptr;
}
/// \brief Hook used by the lexer to invoke the "natural language" code
@@ -948,7 +948,7 @@ public:
unsigned Line, unsigned Column);
/// \brief Determine if we are performing code completion.
- bool isCodeCompletionEnabled() const { return CodeCompletionFile != 0; }
+ bool isCodeCompletionEnabled() const { return CodeCompletionFile != nullptr; }
/// \brief Returns the location of the code-completion point.
///
@@ -1021,7 +1021,7 @@ public:
/// \param invalid If non-null, will be set \c true if an error occurs.
StringRef getSpelling(SourceLocation loc,
SmallVectorImpl<char> &buffer,
- bool *invalid = 0) const {
+ bool *invalid = nullptr) const {
return Lexer::getSpelling(loc, buffer, SourceMgr, LangOpts, invalid);
}
@@ -1033,7 +1033,7 @@ public:
/// things like digraphs, UCNs, etc.
///
/// \param Invalid If non-null, will be set \c true if an error occurs.
- std::string getSpelling(const Token &Tok, bool *Invalid = 0) const {
+ std::string getSpelling(const Token &Tok, bool *Invalid = nullptr) const {
return Lexer::getSpelling(Tok, SourceMgr, LangOpts, Invalid);
}
@@ -1050,7 +1050,7 @@ public:
/// copy). The caller is not allowed to modify the returned buffer pointer
/// if an internal buffer is returned.
unsigned getSpelling(const Token &Tok, const char *&Buffer,
- bool *Invalid = 0) const {
+ bool *Invalid = nullptr) const {
return Lexer::getSpelling(Tok, Buffer, SourceMgr, LangOpts, Invalid);
}
@@ -1060,7 +1060,7 @@ public:
/// supplied buffer if a copy can be avoided.
StringRef getSpelling(const Token &Tok,
SmallVectorImpl<char> &Buffer,
- bool *Invalid = 0) const;
+ bool *Invalid = nullptr) const;
/// \brief Relex the token at the specified location.
/// \returns true if there was a failure, false on success.
@@ -1071,8 +1071,9 @@ public:
/// \brief Given a Token \p Tok that is a numeric constant with length 1,
/// return the character.
- char getSpellingOfSingleCharacterNumericConstant(const Token &Tok,
- bool *Invalid = 0) const {
+ char
+ getSpellingOfSingleCharacterNumericConstant(const Token &Tok,
+ bool *Invalid = nullptr) const {
assert(Tok.is(tok::numeric_constant) &&
Tok.getLength() == 1 && "Called on unsupported token");
assert(!Tok.needsCleaning() && "Token can't need cleaning with length 1");
@@ -1132,7 +1133,7 @@ public:
/// \param MacroBegin If non-null and function returns true, it is set to
/// begin location of the macro.
bool isAtStartOfMacroExpansion(SourceLocation loc,
- SourceLocation *MacroBegin = 0) const {
+ SourceLocation *MacroBegin = nullptr) const {
return Lexer::isAtStartOfMacroExpansion(loc, SourceMgr, LangOpts,
MacroBegin);
}
@@ -1143,7 +1144,7 @@ public:
/// \param MacroEnd If non-null and function returns true, it is set to
/// end location of the macro.
bool isAtEndOfMacroExpansion(SourceLocation loc,
- SourceLocation *MacroEnd = 0) const {
+ SourceLocation *MacroEnd = nullptr) const {
return Lexer::isAtEndOfMacroExpansion(loc, SourceMgr, LangOpts, MacroEnd);
}
@@ -1348,7 +1349,7 @@ private:
IncludeMacroStack.push_back(IncludeStackInfo(
CurLexerKind, CurSubmodule, std::move(CurLexer), std::move(CurPTHLexer),
CurPPLexer, std::move(CurTokenLexer), CurDirLookup));
- CurPPLexer = 0;
+ CurPPLexer = nullptr;
}
void PopIncludeMacroStack() {
@@ -1475,7 +1476,7 @@ private:
/// \brief Returns true if we are lexing from a file and not a
/// pragma or a macro.
static bool IsFileLexer(const Lexer* L, const PreprocessorLexer* P) {
- return L ? !L->isPragmaLexer() : P != 0;
+ return L ? !L->isPragmaLexer() : P != nullptr;
}
static bool IsFileLexer(const IncludeStackInfo& I) {
@@ -1517,7 +1518,7 @@ private:
// File inclusion.
void HandleIncludeDirective(SourceLocation HashLoc,
Token &Tok,
- const DirectoryLookup *LookupFrom = 0,
+ const DirectoryLookup *LookupFrom = nullptr,
bool isImport = false);
void HandleIncludeNextDirective(SourceLocation HashLoc, Token &Tok);
void HandleIncludeMacrosDirective(SourceLocation HashLoc, Token &Tok);
diff --git a/include/clang/Lex/PreprocessorLexer.h b/include/clang/Lex/PreprocessorLexer.h
index 27a8df43a2..ed226ae9a3 100644
--- a/include/clang/Lex/PreprocessorLexer.h
+++ b/include/clang/Lex/PreprocessorLexer.h
@@ -76,7 +76,7 @@ protected:
PreprocessorLexer(Preprocessor *pp, FileID fid);
PreprocessorLexer()
- : PP(0), InitialNumSLocEntries(0),
+ : PP(nullptr), InitialNumSLocEntries(0),
ParsingPreprocessorDirective(false),
ParsingFilename(false),
LexingRawMode(false) {}
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h
index 580bb128c5..a38e92d40e 100644
--- a/include/clang/Lex/Token.h
+++ b/include/clang/Lex/Token.h
@@ -150,7 +150,7 @@ public:
void startToken() {
Kind = tok::unknown;
Flags = 0;
- PtrData = 0;
+ PtrData = nullptr;
UintData = 0;
Loc = SourceLocation();
}
@@ -160,7 +160,7 @@ public:
"getIdentifierInfo() on a tok::raw_identifier token!");
assert(!isAnnotation() &&
"getIdentifierInfo() on an annotation token!");
- if (isLiteral()) return 0;
+ if (isLiteral()) return nullptr;
return (IdentifierInfo*) PtrData;
}
void setIdentifierInfo(IdentifierInfo *II) {
diff --git a/include/clang/Lex/TokenLexer.h b/include/clang/Lex/TokenLexer.h
index 659643dedf..a873a2e275 100644
--- a/include/clang/Lex/TokenLexer.h
+++ b/include/clang/Lex/TokenLexer.h
@@ -108,7 +108,7 @@ public:
/// identifier for an object-like macro.
TokenLexer(Token &Tok, SourceLocation ILEnd, MacroInfo *MI,
MacroArgs *ActualArgs, Preprocessor &pp)
- : Macro(0), ActualArgs(0), PP(pp), OwnsTokens(false) {
+ : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(false) {
Init(Tok, ILEnd, MI, ActualArgs);
}
@@ -124,7 +124,7 @@ public:
/// the token lexer is empty.
TokenLexer(const Token *TokArray, unsigned NumToks, bool DisableExpansion,
bool ownsTokens, Preprocessor &pp)
- : Macro(0), ActualArgs(0), PP(pp), OwnsTokens(false) {
+ : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(false) {
Init(TokArray, NumToks, DisableExpansion, ownsTokens);
}
diff --git a/include/clang/Parse/ParseAST.h b/include/clang/Parse/ParseAST.h
index 2405a0ccd6..21f9701c3e 100644
--- a/include/clang/Parse/ParseAST.h
+++ b/include/clang/Parse/ParseAST.h
@@ -36,7 +36,7 @@ namespace clang {
void ParseAST(Preprocessor &pp, ASTConsumer *C,
ASTContext &Ctx, bool PrintStats = false,
TranslationUnitKind TUKind = TU_Complete,
- CodeCompleteConsumer *CompletionConsumer = 0,
+ CodeCompleteConsumer *CompletionConsumer = nullptr,
bool SkipFunctionBodies = false);
/// \brief Parse the main file known to the preprocessor, producing an
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 1c6c5bd0bb..0b15eb6841 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -584,7 +584,7 @@ private:
ANK_Success
};
AnnotatedNameKind TryAnnotateName(bool IsAddressOfOperand,
- CorrectionCandidateCallback *CCC = 0);
+ CorrectionCandidateCallback *CCC = nullptr);
/// Push a tok::annot_cxxscope token onto the token stream.
void AnnotateScopeToken(CXXScopeSpec &SS, bool IsNewAnnotation);
@@ -697,7 +697,7 @@ private:
public:
explicit ObjCDeclContextSwitch(Parser &p)
: P(p), DC(p.getObjCDeclContext()),
- WithinObjCContainer(P.ParsingInObjCContainer, DC != 0) {
+ WithinObjCContainer(P.ParsingInObjCContainer, DC != nullptr) {
if (DC)
P.Actions.ActOnObjCTemporaryExitContainerContext(cast<DeclContext>(DC));
}
@@ -765,7 +765,7 @@ public:
if (BeforeCompoundStmt)
Self->incrementMSLocalManglingNumber();
- this->Self = 0;
+ this->Self = nullptr;
}
}
@@ -774,7 +774,7 @@ public:
void Exit() {
if (Self) {
Self->ExitScope();
- Self = 0;
+ Self = nullptr;
}
}
@@ -961,7 +961,7 @@ private:
/// (C++ [class.mem]p2).
struct LateParsedDefaultArgument {
explicit LateParsedDefaultArgument(Decl *P,
- CachedTokens *Toks = 0)
+ CachedTokens *Toks = nullptr)
: Param(P), Toks(Toks) { }
/// Param - The parameter declaration for this parameter.
@@ -980,7 +980,8 @@ private:
/// argument (C++ [class.mem]p2).
struct LateParsedMethodDeclaration : public LateParsedDeclaration {
explicit LateParsedMethodDeclaration(Parser *P, Decl *M)
- : Self(P), Method(M), TemplateScope(false), ExceptionSpecTokens(0) { }
+ : Self(P), Method(M), TemplateScope(false),
+ ExceptionSpecTokens(nullptr) {}
void ParseLexedMethodDeclarations() override;
@@ -1103,7 +1104,7 @@ private:
/// specifiers.
struct ParsedTemplateInfo {
ParsedTemplateInfo()
- : Kind(NonTemplate), TemplateParams(0), TemplateLoc() { }
+ : Kind(NonTemplate), TemplateParams(nullptr), TemplateLoc() { }
ParsedTemplateInfo(TemplateParameterLists *TemplateParams,
bool isSpecialization,
@@ -1114,7 +1115,7 @@ private:
explicit ParsedTemplateInfo(SourceLocation ExternLoc,
SourceLocation TemplateLoc)
- : Kind(ExplicitInstantiation), TemplateParams(0),
+ : Kind(ExplicitInstantiation), TemplateParams(nullptr),
ExternLoc(ExternLoc), TemplateLoc(TemplateLoc),
LastParameterListWasEmpty(false){ }
@@ -1207,12 +1208,12 @@ private:
};
DeclGroupPtrTy ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
- ParsingDeclSpec *DS = 0);
+ ParsingDeclSpec *DS = nullptr);
bool isDeclarationAfterDeclarator();
bool isStartOfFunctionDefinition(const ParsingDeclarator &Declarator);
DeclGroupPtrTy ParseDeclarationOrFunctionDefinition(
ParsedAttributesWithRange &attrs,
- ParsingDeclSpec *DS = 0,
+ ParsingDeclSpec *DS = nullptr,
AccessSpecifier AS = AS_none);
DeclGroupPtrTy ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
ParsingDeclSpec &DS,
@@ -1220,11 +1221,11 @@ private:
Decl *ParseFunctionDefinition(ParsingDeclarator &D,
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
- LateParsedAttrList *LateParsedAttrs = 0);
+ LateParsedAttrList *LateParsedAttrs = nullptr);
void ParseKNRParamDeclarations(Declarator &D);
// EndLoc, if non-NULL, is filled with the location of the last token of
// the simple-asm.
- ExprResult ParseSimpleAsm(SourceLocation *EndLoc = 0);
+ ExprResult ParseSimpleAsm(SourceLocation *EndLoc = nullptr);
ExprResult ParseAsmStringLiteral();
// Objective-C External Declarations
@@ -1364,12 +1365,12 @@ private:
typedef SmallVector<SourceLocation, 20> CommaLocsTy;
/// ParseExpressionList - Used for C/C++ (argument-)expression-list.
- bool ParseExpressionList(SmallVectorImpl<Expr*> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs,
- void (Sema::*Completer)(Scope *S,
- Expr *Data,
- ArrayRef<Expr *> Args) = 0,
- Expr *Data = 0);
+ bool
+ ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
+ SmallVectorImpl<SourceLocation> &CommaLocs,
+ void (Sema::*Completer)(Scope *S, Expr *Data,
+ ArrayRef<Expr *> Args) = nullptr,
+ Expr *Data = nullptr);
/// ParseSimpleExpressionList - A simple comma-separated list of expressions,
/// used for misc language extensions.
@@ -1416,9 +1417,9 @@ private:
bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
ParsedType ObjectType,
bool EnteringContext,
- bool *MayBePseudoDestructor = 0,
+ bool *MayBePseudoDestructor = nullptr,
bool IsTypename = false,
- IdentifierInfo **LastII = 0);
+ IdentifierInfo **LastII = nullptr);
void CheckForLParenAfterColonColon();
@@ -1429,7 +1430,7 @@ private:
ExprResult ParseLambdaExpression();
ExprResult TryParseLambdaExpression();
Optional<unsigned> ParseLambdaIntroducer(LambdaIntroducer &Intro,
- bool *SkippedInits = 0);
+ bool *SkippedInits = nullptr);
bool TryParseLambdaIntroducer(LambdaIntroducer &Intro);
ExprResult ParseLambdaExpressionAfterIntroducer(
LambdaIntroducer &Intro);
@@ -1565,10 +1566,10 @@ private:
/// A SmallVector of types.
typedef SmallVector<ParsedType, 12> TypeVector;
- StmtResult ParseStatement(SourceLocation *TrailingElseLoc = 0);
- StmtResult ParseStatementOrDeclaration(StmtVector &Stmts,
- bool OnlyStatement,
- SourceLocation *TrailingElseLoc = 0);
+ StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr);
+ StmtResult
+ ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement,
+ SourceLocation *TrailingElseLoc = nullptr);
StmtResult ParseStatementOrDeclarationAfterAttributes(
StmtVector &Stmts,
bool OnlyStatement,
@@ -1717,12 +1718,12 @@ private:
SourceLocation &DeclEnd,
ParsedAttributesWithRange &attrs,
bool RequireSemi,
- ForRangeInit *FRI = 0);
+ ForRangeInit *FRI = nullptr);
bool MightBeDeclarator(unsigned Context);
DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context,
bool AllowFunctionDefinitions,
- SourceLocation *DeclEnd = 0,
- ForRangeInit *FRI = 0);
+ SourceLocation *DeclEnd = nullptr,
+ ForRangeInit *FRI = nullptr);
Decl *ParseDeclarationAfterDeclarator(Declarator &D,
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo());
bool ParseAsmAttributesAfterDeclarator(Declarator &D);
@@ -1746,10 +1747,10 @@ private:
const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
AccessSpecifier AS = AS_none,
DeclSpecContext DSC = DSC_normal,
- LateParsedAttrList *LateAttrs = 0);
+ LateParsedAttrList *LateAttrs = nullptr);
bool DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS,
- DeclSpecContext DSContext,
- LateParsedAttrList *LateAttrs = 0);
+ DeclSpecContext DSContext,
+ LateParsedAttrList *LateAttrs = nullptr);
void ParseSpecifierQualifierList(DeclSpec &DS, AccessSpecifier AS = AS_none,
DeclSpecContext DSC = DSC_normal);
@@ -1873,7 +1874,7 @@ private:
/// might be a constructor-style initializer.
/// If during the disambiguation process a parsing error is encountered,
/// the function returns true to let the declaration parsing code handle it.
- bool isCXXFunctionDeclarator(bool *IsAmbiguous = 0);
+ bool isCXXFunctionDeclarator(bool *IsAmbiguous = nullptr);
/// isCXXConditionDeclaration - Disambiguates between a declaration or an
/// expression for a condition of a if/switch/while/for statement.
@@ -1931,7 +1932,7 @@ private:
/// Doesn't consume tokens.
TPResult
isCXXDeclarationSpecifier(TPResult BracedCastResult = TPResult::False(),
- bool *HasMissingTypename = 0);
+ bool *HasMissingTypename = nullptr);
/// Given that isCXXDeclarationSpecifier returns \c TPResult::True or
/// \c TPResult::Ambiguous, determine whether the decl-specifier would be
@@ -1957,19 +1958,20 @@ private:
TPResult TryParseOperatorId();
TPResult TryParseInitDeclaratorList();
TPResult TryParseDeclarator(bool mayBeAbstract, bool mayHaveIdentifier=true);
- TPResult TryParseParameterDeclarationClause(bool *InvalidAsDeclaration = 0,
- bool VersusTemplateArg = false);
+ TPResult
+ TryParseParameterDeclarationClause(bool *InvalidAsDeclaration = nullptr,
+ bool VersusTemplateArg = false);
TPResult TryParseFunctionDeclarator();
TPResult TryParseBracketDeclarator();
TPResult TryConsumeDeclarationSpecifier();
public:
- TypeResult ParseTypeName(SourceRange *Range = 0,
+ TypeResult ParseTypeName(SourceRange *Range = nullptr,
Declarator::TheContext Context
= Declarator::TypeNameContext,
AccessSpecifier AS = AS_none,
- Decl **OwnedType = 0,
- ParsedAttributes *Attrs = 0);
+ Decl **OwnedType = nullptr,
+ ParsedAttributes *Attrs = nullptr);
private:
void ParseBlockId(SourceLocation CaretLoc);
@@ -2022,7 +2024,7 @@ private:
AttributeList::Syntax Syntax);
void MaybeParseGNUAttributes(Declarator &D,
- LateParsedAttrList *LateAttrs = 0) {
+ LateParsedAttrList *LateAttrs = nullptr) {
if (Tok.is(tok::kw___attribute)) {
ParsedAttributes attrs(AttrFactory);
SourceLocation endLoc;
@@ -2031,15 +2033,15 @@ private:
}
}
void MaybeParseGNUAttributes(ParsedAttributes &attrs,
- SourceLocation *endLoc = 0,
- LateParsedAttrList *LateAttrs = 0) {
+ SourceLocation *endLoc = nullptr,
+ LateParsedAttrList *LateAttrs = nullptr) {
if (Tok.is(tok::kw___attribute))
ParseGNUAttributes(attrs, endLoc, LateAttrs);
}
void ParseGNUAttributes(ParsedAttributes &attrs,
- SourceLocation *endLoc = 0,
- LateParsedAttrList *LateAttrs = 0,
- Declarator *D = 0);
+ SourceLocation *endLoc = nullptr,
+ LateParsedAttrList *LateAttrs = nullptr,
+ Declarator *D = nullptr);
void ParseGNUAttributeArgs(IdentifierInfo *AttrName,
SourceLocation AttrNameLoc,
ParsedAttributes &Attrs,
@@ -2059,7 +2061,7 @@ private:
}
}
void MaybeParseCXX11Attributes(ParsedAttributes &attrs,
- SourceLocation *endLoc = 0) {
+ SourceLocation *endLoc = nullptr) {
if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier()) {
ParsedAttributesWithRange attrsWithRange(AttrFactory);
ParseCXX11Attributes(attrsWithRange, endLoc);
@@ -2067,7 +2069,7 @@ private:
}
}
void MaybeParseCXX11Attributes(ParsedAttributesWithRange &attrs,
- SourceLocation *endLoc = 0,
+ SourceLocation *endLoc = nullptr,
bool OuterMightBeMessageSend = false) {
if (getLangOpts().CPlusPlus11 &&
isCXX11AttributeSpecifier(false, OuterMightBeMessageSend))
@@ -2075,9 +2077,9 @@ private:
}
void ParseCXX11AttributeSpecifier(ParsedAttributes &attrs,
- SourceLocation *EndLoc = 0);
+ SourceLocation *EndLoc = nullptr);
void ParseCXX11Attributes(ParsedAttributesWithRange &attrs,
- SourceLocation *EndLoc = 0);
+ SourceLocation *EndLoc = nullptr);
/// \brief Parses a C++-style attribute argument list. Returns true if this
/// results in adding an attribute to the ParsedAttributes list.
bool ParseCXX11AttributeArgs(IdentifierInfo *AttrName,
@@ -2089,12 +2091,12 @@ private:
IdentifierInfo *TryParseCXX11AttributeIdentifier(SourceLocation &Loc);
void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs,
- SourceLocation *endLoc = 0) {
+ SourceLocation *endLoc = nullptr) {
if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square))
ParseMicrosoftAttributes(attrs, endLoc);
}
void ParseMicrosoftAttributes(ParsedAttributes &attrs,
- SourceLocation *endLoc = 0);
+ SourceLocation *endLoc = nullptr);
void ParseMicrosoftDeclSpec(ParsedAttributes &Attrs);
bool ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName,
SourceLocation AttrNameLoc,
@@ -2137,7 +2139,7 @@ private:
ExprResult ParseAlignArgument(SourceLocation Start,
SourceLocation &EllipsisLoc);
void ParseAlignmentSpecifier(ParsedAttributes &Attrs,
- SourceLocation *endLoc = 0);
+ SourceLocation *endLoc = nullptr);
VirtSpecifiers::Specifier isCXX11VirtSpecifier(const Token &Tok) const;
VirtSpecifiers::Specifier isCXX11VirtSpecifier() const {
@@ -2241,7 +2243,7 @@ private:
const ParsedTemplateInfo &TemplateInfo,
SourceLocation &DeclEnd,
ParsedAttributesWithRange &attrs,
- Decl **OwnedType = 0);
+ Decl **OwnedType = nullptr);
Decl *ParseUsingDirective(unsigned Context,
SourceLocation UsingLoc,
SourceLocation &DeclEnd,
@@ -2251,7 +2253,7 @@ private:
SourceLocation UsingLoc,
SourceLocation &DeclEnd,
AccessSpecifier AS = AS_none,
- Decl **OwnedType = 0);
+ Decl **OwnedType = nullptr);
Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc,
SourceLocation AliasLoc, IdentifierInfo *Alias,
@@ -2277,8 +2279,8 @@ private:
ExprResult &BitfieldSize,
LateParsedAttrList &LateAttrs);
void ParseCXXClassMemberDeclaration(AccessSpecifier AS, AttributeList *Attr,
- const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
- ParsingDeclRAIIObject *DiagsFromTParams = 0);
+ const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(),
+ ParsingDeclRAIIObject *DiagsFromTParams = nullptr);
void ParseConstructorInitializer(Decl *ConstructorDecl);
MemInitResult ParseMemInitializer(Decl *ConstructorDecl);
void HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo,
@@ -2358,9 +2360,9 @@ private:
// C++ 14.1: Template Parameters [temp.param]
Decl *ParseDeclarationStartingWithTemplate(unsigned Context,
- SourceLocation &DeclEnd,
- AccessSpecifier AS = AS_none,
- AttributeList *AccessAttrs = 0);
+ SourceLocation &DeclEnd,
+ AccessSpecifier AS = AS_none,
+ AttributeList *AccessAttrs = nullptr);
Decl *ParseTemplateDeclarationOrSpecialization(unsigned Context,
SourceLocation &DeclEnd,
AccessSpecifier AS,
@@ -2371,7 +2373,7 @@ private:
ParsingDeclRAIIObject &DiagsFromParams,
SourceLocation &DeclEnd,
AccessSpecifier AS=AS_none,
- AttributeList *AccessAttrs = 0);
+ AttributeList *AccessAttrs = nullptr);
bool ParseTemplateParameters(unsigned Depth,
SmallVectorImpl<Decl*> &TemplateParams,
SourceLocation &LAngleLoc,
diff --git a/include/clang/Rewrite/Core/HTMLRewrite.h b/include/clang/Rewrite/Core/HTMLRewrite.h
index 3cd04615d8..ec061dc7db 100644
--- a/include/clang/Rewrite/Core/HTMLRewrite.h
+++ b/include/clang/Rewrite/Core/HTMLRewrite.h
@@ -63,7 +63,7 @@ namespace html {
void AddLineNumbers(Rewriter& R, FileID FID);
void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
- const char *title = NULL);
+ const char *title = nullptr);
/// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
/// information about keywords, comments, etc.
diff --git a/include/clang/Rewrite/Core/RewriteRope.h b/include/clang/Rewrite/Core/RewriteRope.h
index 5167c50752..f312aedc08 100644
--- a/include/clang/Rewrite/Core/RewriteRope.h
+++ b/include/clang/Rewrite/Core/RewriteRope.h
@@ -61,7 +61,7 @@ namespace clang {
unsigned StartOffs;
unsigned EndOffs;
- RopePiece() : StrData(0), StartOffs(0), EndOffs(0) {}
+ RopePiece() : StrData(nullptr), StartOffs(0), EndOffs(0) {}
RopePiece(RopeRefCountString *Str, unsigned Start, unsigned End)
: StrData(Str), StartOffs(Start), EndOffs(End) {
@@ -122,7 +122,8 @@ namespace clang {
// begin iterator.
RopePieceBTreeIterator(const void /*RopePieceBTreeNode*/ *N);
// end iterator
- RopePieceBTreeIterator() : CurNode(0), CurPiece(0), CurChar(0) {}
+ RopePieceBTreeIterator()
+ : CurNode(nullptr), CurPiece(nullptr), CurChar(0) {}
char operator*() const {
return (*CurPiece)[CurChar];
@@ -195,9 +196,9 @@ class RewriteRope {
enum { AllocChunkSize = 4080 };
public:
- RewriteRope() : AllocBuffer(0), AllocOffs(AllocChunkSize) {}
+ RewriteRope() : AllocBuffer(nullptr), AllocOffs(AllocChunkSize) {}
RewriteRope(const RewriteRope &RHS)
- : Chunks(RHS.Chunks), AllocBuffer(0), AllocOffs(AllocChunkSize) {
+ : Chunks(RHS.Chunks), AllocBuffer(nullptr), AllocOffs(AllocChunkSize) {
}
~RewriteRope() {
diff --git a/include/clang/Rewrite/Core/Rewriter.h b/include/clang/Rewrite/Core/Rewriter.h
index 2d2917b910..7b22fb49bc 100644
--- a/include/clang/Rewrite/Core/Rewriter.h
+++ b/include/clang/Rewrite/Core/Rewriter.h
@@ -151,7 +151,7 @@ public:
explicit Rewriter(SourceManager &SM, const LangOptions &LO)
: SourceMgr(&SM), LangOpts(&LO) {}
- explicit Rewriter() : SourceMgr(0), LangOpts(0) {}
+ explicit Rewriter() : SourceMgr(nullptr), LangOpts(nullptr) {}
void setSourceMgr(SourceManager &SM, const LangOptions &LO) {
SourceMgr = &SM;
@@ -275,7 +275,7 @@ public:
const RewriteBuffer *getRewriteBufferFor(FileID FID) const {
std::map<FileID, RewriteBuffer>::const_iterator I =
RewriteBuffers.find(FID);
- return I == RewriteBuffers.end() ? 0 : &I->second;
+ return I == RewriteBuffers.end() ? nullptr : &I->second;
}
// Iterators over rewrite buffers.
diff --git a/include/clang/Rewrite/Frontend/FixItRewriter.h b/include/clang/Rewrite/Frontend/FixItRewriter.h
index ff03eff486..3ad8f408af 100644
--- a/include/clang/Rewrite/Frontend/FixItRewriter.h
+++ b/include/clang/Rewrite/Frontend/FixItRewriter.h
@@ -90,7 +90,7 @@ public:
/// \brief Check whether there are modifications for a given file.
bool IsModified(FileID ID) const {
- return Rewrite.getRewriteBufferFor(ID) != NULL;
+ return Rewrite.getRewriteBufferFor(ID) != nullptr;
}
// Iteration over files with changes.
@@ -106,7 +106,7 @@ public:
///
/// \returns true if there was an error, false otherwise.
bool WriteFixedFiles(
- std::vector<std::pair<std::string, std::string> > *RewrittenFiles = 0);
+ std::vector<std::pair<std::string, std::string> > *RewrittenFiles=nullptr);
/// IncludeInDiagnosticCounts - This method (whose default implementation
/// returns true) indicates whether the diagnostics handled by this
diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h
index 171f9f9b9f..6872ccc98d 100644
--- a/include/clang/Sema/AttributeList.h
+++ b/include/clang/Sema/AttributeList.h
@@ -218,7 +218,7 @@ private:
ScopeLoc(scopeLoc), EllipsisLoc(ellipsisLoc), NumArgs(numArgs),
SyntaxUsed(syntaxUsed), Invalid(false), UsedAsTypeAttr(false),
IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
- HasParsedType(false), NextInPosition(0), NextInPool(0) {
+ HasParsedType(false), NextInPosition(nullptr), NextInPool(nullptr) {
if (numArgs) memcpy(getArgsBuffer(), args, numArgs * sizeof(ArgsUnion));
AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
@@ -237,7 +237,7 @@ private:
Invalid(false), UsedAsTypeAttr(false), IsAvailability(true),
IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
UnavailableLoc(unavailable), MessageExpr(messageExpr),
- NextInPosition(0), NextInPool(0) {
+ NextInPosition(nullptr), NextInPool(nullptr) {
ArgsUnion PVal(Parm);
memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
new (&getAvailabilitySlot(IntroducedSlot)) AvailabilityChange(introduced);
@@ -257,7 +257,7 @@ private:
ScopeLoc(scopeLoc), EllipsisLoc(), NumArgs(3), SyntaxUsed(syntaxUsed),
Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
- NextInPosition(0), NextInPool(0) {
+ NextInPosition(nullptr), NextInPool(nullptr) {
ArgsVector Args;
Args.push_back(Parm1);
Args.push_back(Parm2);
@@ -275,7 +275,7 @@ private:
ScopeLoc(scopeLoc), EllipsisLoc(), NumArgs(1), SyntaxUsed(syntaxUsed),
Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
IsTypeTagForDatatype(true), IsProperty(false), HasParsedType(false),
- NextInPosition(NULL), NextInPool(NULL) {
+ NextInPosition(nullptr), NextInPool(nullptr) {
ArgsUnion PVal(ArgKind);
memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
@@ -293,7 +293,7 @@ private:
ScopeLoc(scopeLoc), EllipsisLoc(), NumArgs(0), SyntaxUsed(syntaxUsed),
Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(true),
- NextInPosition(0), NextInPool(0) {
+ NextInPosition(nullptr), NextInPool(nullptr) {
new (&getTypeBuffer()) ParsedType(typeArg);
AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
@@ -307,7 +307,7 @@ private:
ScopeLoc(scopeLoc), EllipsisLoc(), NumArgs(0), SyntaxUsed(syntaxUsed),
Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
IsTypeTagForDatatype(false), IsProperty(true), HasParsedType(false),
- NextInPosition(0), NextInPool(0) {
+ NextInPosition(nullptr), NextInPool(nullptr) {
new (&getPropertyDataBuffer()) PropertyData(getterId, setterId);
AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
@@ -546,11 +546,11 @@ class AttributePool {
public:
/// Create a new pool for a factory.
- AttributePool(AttributeFactory &factory) : Factory(factory), Head(0) {}
+ AttributePool(AttributeFactory &factory) : Factory(factory), Head(nullptr) {}
/// Move the given pool's allocations to this pool.
AttributePool(AttributePool &pool) : Factory(pool.Factory), Head(pool.Head) {
- pool.Head = 0;
+ pool.Head = nullptr;
}
AttributeFactory &getFactory() const { return Factory; }
@@ -558,7 +558,7 @@ public:
void clear() {
if (Head) {
Factory.reclaimPool(Head);
- Head = 0;
+ Head = nullptr;
}
}
@@ -566,7 +566,7 @@ public:
void takeAllFrom(AttributePool &pool) {
if (pool.Head) {
takePool(pool.Head);
- pool.Head = 0;
+ pool.Head = nullptr;
}
}
@@ -664,18 +664,18 @@ public:
class ParsedAttributes {
public:
ParsedAttributes(AttributeFactory &factory)
- : pool(factory), list(0) {
+ : pool(factory), list(nullptr) {
}
ParsedAttributes(const ParsedAttributes &) LLVM_DELETED_FUNCTION;
AttributePool &getPool() const { return pool; }
- bool empty() const { return list == 0; }
+ bool empty() const { return list == nullptr; }
void add(AttributeList *newAttr) {
assert(newAttr);
- assert(newAttr->getNext() == 0);
+ assert(newAttr->getNext() == nullptr);
newAttr->setNext(list);
list = newAttr;
}
@@ -697,11 +697,11 @@ public:
void takeAllFrom(ParsedAttributes &attrs) {
addAll(attrs.list);
- attrs.list = 0;
+ attrs.list = nullptr;
pool.takeAllFrom(attrs.pool);
}
- void clear() { list = 0; pool.clear(); }
+ void clear() { list = nullptr; pool.clear(); }
AttributeList *getList() const { return list; }
/// Returns a reference to the attribute list. Try not to introduce
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index 11bdb761c6..92a4e9a42f 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -397,7 +397,7 @@ public:
CodeCompletionString *Optional;
};
- Chunk() : Kind(CK_Text), Text(0) { }
+ Chunk() : Kind(CK_Text), Text(nullptr) { }
explicit Chunk(ChunkKind Kind, const char *Text = "");
@@ -575,14 +575,14 @@ public:
CodeCompletionTUInfo &CCTUInfo)
: Allocator(Allocator), CCTUInfo(CCTUInfo),
Priority(0), Availability(CXAvailability_Available),
- BriefComment(NULL) { }
+ BriefComment(nullptr) { }
CodeCompletionBuilder(CodeCompletionAllocator &Allocator,
CodeCompletionTUInfo &CCTUInfo,
unsigned Priority, CXAvailabilityKind Availability)
: Allocator(Allocator), CCTUInfo(CCTUInfo),
Priority(Priority), Availability(Availability),
- BriefComment(NULL) { }
+ BriefComment(nullptr) { }
/// \brief Retrieve the allocator into which the code completion
/// strings should be allocated.
@@ -700,7 +700,7 @@ public:
/// \brief Build a result that refers to a declaration.
CodeCompletionResult(const NamedDecl *Declaration,
unsigned Priority,
- NestedNameSpecifier *Qualifier = 0,
+ NestedNameSpecifier *Qualifier = nullptr,
bool QualifierIsInformative = false,
bool Accessible = true)
: Declaration(Declaration), Priority(Priority),
@@ -714,36 +714,34 @@ public:
/// \brief Build a result that refers to a keyword or symbol.
CodeCompletionResult(const char *Keyword, unsigned Priority = CCP_Keyword)
- : Declaration(0), Keyword(Keyword), Priority(Priority), StartParameter(0),
- Kind(RK_Keyword), CursorKind(CXCursor_NotImplemented),
+ : Declaration(nullptr), Keyword(Keyword), Priority(Priority),
+ StartParameter(0), Kind(RK_Keyword), CursorKind(CXCursor_NotImplemented),
Availability(CXAvailability_Available), Hidden(false),
QualifierIsInformative(0), StartsNestedNameSpecifier(false),
- AllParametersAreInformative(false), DeclaringEntity(false), Qualifier(0)
- {
- }
+ AllParametersAreInformative(false), DeclaringEntity(false),
+ Qualifier(nullptr) {}
/// \brief Build a result that refers to a macro.
CodeCompletionResult(const IdentifierInfo *Macro,
unsigned Priority = CCP_Macro)
- : Declaration(0), Macro(Macro), Priority(Priority), StartParameter(0),
+ : Declaration(nullptr), Macro(Macro), Priority(Priority), StartParameter(0),
Kind(RK_Macro), CursorKind(CXCursor_MacroDefinition),
Availability(CXAvailability_Available), Hidden(false),
QualifierIsInformative(0), StartsNestedNameSpecifier(false),
- AllParametersAreInformative(false), DeclaringEntity(false), Qualifier(0)
- {
- }
+ AllParametersAreInformative(false), DeclaringEntity(false),
+ Qualifier(nullptr) {}
/// \brief Build a result that refers to a pattern.
CodeCompletionResult(CodeCompletionString *Pattern,
unsigned Priority = CCP_CodePattern,
CXCursorKind CursorKind = CXCursor_NotImplemented,
CXAvailabilityKind Availability = CXAvailability_Available,
- const NamedDecl *D = 0)
+ const NamedDecl *D = nullptr)
: Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0),
Kind(RK_Pattern), CursorKind(CursorKind), Availability(Availability),
Hidden(false), QualifierIsInformative(0),
StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
- DeclaringEntity(false), Qualifier(0)
+ DeclaringEntity(false), Qualifier(nullptr)
{
}
@@ -754,7 +752,8 @@ public:
: Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0),
Kind(RK_Pattern), Availability(CXAvailability_Available), Hidden(false),
QualifierIsInformative(false), StartsNestedNameSpecifier(false),
- AllParametersAreInformative(false), DeclaringEntity(false), Qualifier(0) {
+ AllParametersAreInformative(false), DeclaringEntity(false),
+ Qualifier(nullptr) {
computeCursorKindAndAvailability();
}
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 948fb9cbfd..e57754d770 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -178,9 +178,9 @@ public:
bool isNotEmpty() const { return !isEmpty(); }
/// An error occurred during parsing of the scope specifier.
- bool isInvalid() const { return isNotEmpty() && getScopeRep() == 0; }
+ bool isInvalid() const { return isNotEmpty() && getScopeRep() == nullptr; }
/// A scope specifier is present, and it refers to a real scope.
- bool isValid() const { return isNotEmpty() && getScopeRep() != 0; }
+ bool isValid() const { return isNotEmpty() && getScopeRep() != nullptr; }
/// \brief Indicate that this nested-name-specifier is invalid.
void SetInvalid(SourceRange R) {
@@ -193,7 +193,7 @@ public:
/// Deprecated. Some call sites intend isNotEmpty() while others intend
/// isValid().
- bool isSet() const { return getScopeRep() != 0; }
+ bool isSet() const { return getScopeRep() != nullptr; }
void clear() {
Range = SourceRange();
@@ -420,11 +420,11 @@ public:
Friend_specified(false),
Constexpr_specified(false),
Attrs(attrFactory),
- ProtocolQualifiers(0),
+ ProtocolQualifiers(nullptr),
NumProtocolQualifiers(0),
- ProtocolLocs(0),
+ ProtocolLocs(nullptr),
writtenBS(),
- ObjCQualifiers(0) {
+ ObjCQualifiers(nullptr) {
}
~DeclSpec() {
delete [] ProtocolQualifiers;
@@ -791,7 +791,7 @@ public:
ObjCDeclSpec()
: objcDeclQualifier(DQ_None), PropertyAttributes(DQ_PR_noattr),
- GetterName(0), SetterName(0) { }
+ GetterName(nullptr), SetterName(nullptr) { }
ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; }
void setObjCDeclQualifier(ObjCDeclQualifier DQVal) {
objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal);
@@ -905,13 +905,13 @@ public:
/// \brief The location of the last token that describes this unqualified-id.
SourceLocation EndLocation;
- UnqualifiedId() : Kind(IK_Identifier), Identifier(0) { }
+ UnqualifiedId() : Kind(IK_Identifier), Identifier(nullptr) { }
/// \brief Clear out this unqualified-id, setting it to default (invalid)
/// state.
void clear() {
Kind = IK_Identifier;
- Identifier = 0;
+ Identifier = nullptr;
StartLocation = SourceLocation();
EndLocation = SourceLocation();
}
@@ -1126,7 +1126,7 @@ struct DeclaratorChunk {
ParamInfo() {}
ParamInfo(IdentifierInfo *ident, SourceLocation iloc,
Decl *param,
- CachedTokens *DefArgTokens = 0)
+ CachedTokens *DefArgTokens = nullptr)
: Ident(ident), IdentLoc(iloc), Param(param),
DefaultArgTokens(DefArgTokens) {}
};
@@ -1380,7 +1380,7 @@ struct DeclaratorChunk {
I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding();
I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
- I.Ptr.AttrList = 0;
+ I.Ptr.AttrList = nullptr;
return I;
}
@@ -1392,7 +1392,7 @@ struct DeclaratorChunk {
I.Loc = Loc;
I.Ref.HasRestrict = (TypeQuals & DeclSpec::TQ_restrict) != 0;
I.Ref.LValueRef = lvalue;
- I.Ref.AttrList = 0;
+ I.Ref.AttrList = nullptr;
return I;
}
@@ -1404,7 +1404,7 @@ struct DeclaratorChunk {
I.Kind = Array;
I.Loc = LBLoc;
I.EndLoc = RBLoc;
- I.Arr.AttrList = 0;
+ I.Arr.AttrList = nullptr;
I.Arr.TypeQuals = TypeQuals;
I.Arr.hasStatic = isStatic;
I.Arr.isStar = isStar;
@@ -1445,7 +1445,7 @@ struct DeclaratorChunk {
I.Kind = BlockPointer;
I.Loc = Loc;
I.Cls.TypeQuals = TypeQuals;
- I.Cls.AttrList = 0;
+ I.Cls.AttrList = nullptr;
return I;
}
@@ -1456,7 +1456,7 @@ struct DeclaratorChunk {
I.Kind = MemberPointer;
I.Loc = Loc;
I.Mem.TypeQuals = TypeQuals;
- I.Mem.AttrList = 0;
+ I.Mem.AttrList = nullptr;
new (I.Mem.ScopeMem.Mem) CXXScopeSpec(SS);
return I;
}
@@ -1468,7 +1468,7 @@ struct DeclaratorChunk {
I.Kind = Paren;
I.Loc = LParenLoc;
I.EndLoc = RParenLoc;
- I.Common.AttrList = 0;
+ I.Common.AttrList = nullptr;
return I;
}
@@ -1586,7 +1586,7 @@ public:
InvalidType(DS.getTypeSpecType() == DeclSpec::TST_error),
GroupingParens(false), FunctionDefinition(FDK_Declaration),
Redeclaration(false),
- Attrs(ds.getAttributePool().getFactory()), AsmLabel(0),
+ Attrs(ds.getAttributePool().getFactory()), AsmLabel(nullptr),
InlineParamsUsed(false), Extension(false) {
}
@@ -1663,7 +1663,7 @@ public:
DeclTypeInfo[i].destroy();
DeclTypeInfo.clear();
Attrs.clear();
- AsmLabel = 0;
+ AsmLabel = nullptr;
InlineParamsUsed = false;
CommaLoc = SourceLocation();
EllipsisLoc = SourceLocation();
@@ -1836,7 +1836,7 @@ public:
if (Name.getKind() == UnqualifiedId::IK_Identifier)
return Name.Identifier;
- return 0;
+ return nullptr;
}
SourceLocation getIdentifierLoc() const { return Name.StartLocation; }
@@ -1891,7 +1891,7 @@ public:
if (!DeclTypeInfo[i].isParen())
return &DeclTypeInfo[i];
}
- return 0;
+ return nullptr;
}
/// Return the outermost (furthest from the declarator) chunk of
@@ -1902,7 +1902,7 @@ public:
if (!DeclTypeInfo[i-1].isParen())
return &DeclTypeInfo[i-1];
}
- return 0;
+ return nullptr;
}
/// isArrayOfUnknownBound - This method returns true if the declarator
@@ -2113,7 +2113,7 @@ struct FieldDeclarator {
Declarator D;
Expr *BitfieldSize;
explicit FieldDeclarator(const DeclSpec &DS)
- : D(DS, Declarator::MemberContext), BitfieldSize(0) { }
+ : D(DS, Declarator::MemberContext), BitfieldSize(nullptr) { }
};
/// \brief Represents a C++11 virt-specifier-seq.
diff --git a/include/clang/Sema/DelayedDiagnostic.h b/include/clang/Sema/DelayedDiagnostic.h
index 9a0541d877..d33a723dae 100644
--- a/include/clang/Sema/DelayedDiagnostic.h
+++ b/include/clang/Sema/DelayedDiagnostic.h
@@ -248,7 +248,7 @@ public:
/// Does this pool, or any of its ancestors, contain any diagnostics?
bool empty() const {
- return (Diagnostics.empty() && (Parent == NULL || Parent->empty()));
+ return (Diagnostics.empty() && (!Parent || Parent->empty()));
}
/// Add a diagnostic to this pool.
diff --git a/include/clang/Sema/IdentifierResolver.h b/include/clang/Sema/IdentifierResolver.h
index abe974c6f7..b2404bc14b 100644
--- a/include/clang/Sema/IdentifierResolver.h
+++ b/include/clang/Sema/IdentifierResolver.h
@@ -156,7 +156,7 @@ public:
/// template instantiation or specialization). In this case, a
/// declaration is in scope if it's in the inline namespace set of the
/// context.
- bool isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S = 0,
+ bool isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S = nullptr,
bool AllowInlineNamespace = false) const;
/// AddDecl - Link the decl to its shadowed decl chain.
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index 90618af090..64e3745dd4 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -162,15 +162,15 @@ private:
/// \brief Create the initialization entity for a variable.
InitializedEntity(VarDecl *Var)
- : Kind(EK_Variable), Parent(0), Type(Var->getType()), ManglingNumber(0),
- VariableOrMember(Var) { }
+ : Kind(EK_Variable), Parent(nullptr), Type(Var->getType()),
+ ManglingNumber(0), VariableOrMember(Var) { }
/// \brief Create the initialization entity for the result of a
/// function, throwing an object, performing an explicit cast, or
/// initializing a parameter for which there is no declaration.
InitializedEntity(EntityKind Kind, SourceLocation Loc, QualType Type,
bool NRVO = false)
- : Kind(Kind), Parent(0), Type(Type), ManglingNumber(0)
+ : Kind(Kind), Parent(nullptr), Type(Type), ManglingNumber(0)
{
LocAndNRVO.Location = Loc.getRawEncoding();
LocAndNRVO.NRVO = NRVO;
@@ -187,7 +187,8 @@ private:
/// \brief Create the initialization entity for a lambda capture.
InitializedEntity(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
- : Kind(EK_LambdaCapture), Parent(0), Type(FieldType), ManglingNumber(0)
+ : Kind(EK_LambdaCapture), Parent(nullptr), Type(FieldType),
+ ManglingNumber(0)
{
Capture.VarID = VarID;
Capture.Location = Loc.getRawEncoding();
@@ -217,7 +218,7 @@ public:
Entity.Kind = EK_Parameter;
Entity.Type =
Context.getVariableArrayDecayedType(Type.getUnqualifiedType());
- Entity.Parent = 0;
+ Entity.Parent = nullptr;
Entity.Parameter
= (static_cast<uintptr_t>(Consumed) | reinterpret_cast<uintptr_t>(Parm));
return Entity;
@@ -231,7 +232,7 @@ public:
InitializedEntity Entity;
Entity.Kind = EK_Parameter;
Entity.Type = Context.getVariableArrayDecayedType(Type);
- Entity.Parent = 0;
+ Entity.Parent = nullptr;
Entity.Parameter = (Consumed);
return Entity;
}
@@ -261,7 +262,7 @@ public:
/// \brief Create the initialization entity for a temporary.
static InitializedEntity InitializeTemporary(QualType Type) {
InitializedEntity Result(EK_Temporary, SourceLocation(), Type);
- Result.TypeInfo = 0;
+ Result.TypeInfo = nullptr;
return Result;
}
@@ -293,14 +294,16 @@ public:
}
/// \brief Create the initialization entity for a member subobject.
- static InitializedEntity InitializeMember(FieldDecl *Member,
- const InitializedEntity *Parent = 0) {
+ static InitializedEntity
+ InitializeMember(FieldDecl *Member,
+ const InitializedEntity *Parent = nullptr) {
return InitializedEntity(Member, Parent);
}
/// \brief Create the initialization entity for a member subobject.
- static InitializedEntity InitializeMember(IndirectFieldDecl *Member,
- const InitializedEntity *Parent = 0) {
+ static InitializedEntity
+ InitializeMember(IndirectFieldDecl *Member,
+ const InitializedEntity *Parent = nullptr) {
return InitializedEntity(Member->getAnonField(), Parent);
}
@@ -344,7 +347,7 @@ public:
if (Kind == EK_Temporary || Kind == EK_CompoundLiteralInit)
return TypeInfo;
- return 0;
+ return nullptr;
}
/// \brief Retrieve the name of the entity being initialized.
@@ -887,7 +890,7 @@ public:
const InitializedEntity &Entity,
const InitializationKind &Kind,
MultiExprArg Args,
- QualType *ResultType = 0);
+ QualType *ResultType = nullptr);
/// \brief Diagnose an potentially-invalid initialization sequence.
///
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h
index 03643b0f2e..00cc164d96 100644
--- a/include/clang/Sema/Lookup.h
+++ b/include/clang/Sema/Lookup.h
@@ -130,8 +130,8 @@ public:
Sema::LookupNameKind LookupKind,
Sema::RedeclarationKind Redecl = Sema::NotForRedeclaration)
: ResultKind(NotFound),
- Paths(0),
- NamingClass(0),
+ Paths(nullptr),
+ NamingClass(nullptr),
SemaRef(SemaRef),
NameInfo(NameInfo),
LookupKind(LookupKind),
@@ -152,8 +152,8 @@ public:
SourceLocation NameLoc, Sema::LookupNameKind LookupKind,
Sema::RedeclarationKind Redecl = Sema::NotForRedeclaration)
: ResultKind(NotFound),
- Paths(0),
- NamingClass(0),
+ Paths(nullptr),
+ NamingClass(nullptr),
SemaRef(SemaRef),
NameInfo(Name, NameLoc),
LookupKind(LookupKind),
@@ -172,8 +172,8 @@ public:
/// disabled.
LookupResult(TemporaryToken _, const LookupResult &Other)
: ResultKind(NotFound),
- Paths(0),
- NamingClass(0),
+ Paths(nullptr),
+ NamingClass(nullptr),
SemaRef(Other.SemaRef),
NameInfo(Other.NameInfo),
LookupKind(Other.LookupKind),
@@ -303,7 +303,7 @@ public:
/// if there is one.
NamedDecl *getAcceptableDecl(NamedDecl *D) const {
if (!D->isInIdentifierNamespace(IDNS))
- return 0;
+ return nullptr;
if (isHiddenDeclarationVisible() || isVisible(SemaRef, D))
return D;
@@ -324,7 +324,7 @@ public:
/// \brief Returns whether these results arose from performing a
/// lookup into a class.
bool isClassLookup() const {
- return NamingClass != 0;
+ return NamingClass != nullptr;
}
/// \brief Returns the 'naming class' for this lookup, i.e. the
@@ -421,7 +421,7 @@ public:
if (Paths) {
deletePaths(Paths);
- Paths = 0;
+ Paths = nullptr;
}
} else {
AmbiguityKind SavedAK = Ambiguity;
@@ -434,14 +434,14 @@ public:
Ambiguity = SavedAK;
} else if (Paths) {
deletePaths(Paths);
- Paths = 0;
+ Paths = nullptr;
}
}
}
template <class DeclClass>
DeclClass *getAsSingle() const {
- if (getResultKind() != Found) return 0;
+ if (getResultKind() != Found) return nullptr;
return dyn_cast<DeclClass>(getFoundDecl());
}
@@ -491,8 +491,8 @@ public:
ResultKind = NotFound;
Decls.clear();
if (Paths) deletePaths(Paths);
- Paths = NULL;
- NamingClass = 0;
+ Paths = nullptr;
+ NamingClass = nullptr;
Shadowed = false;
}
diff --git a/include/clang/Sema/MultiplexExternalSemaSource.h b/include/clang/Sema/MultiplexExternalSemaSource.h
index 1f517e7919..050f6c972d 100644
--- a/include/clang/Sema/MultiplexExternalSemaSource.h
+++ b/include/clang/Sema/MultiplexExternalSemaSource.h
@@ -109,7 +109,7 @@ public:
/// \return true if an error occurred
ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC,
SmallVectorImpl<Decl*> &Result) {
- return FindExternalLexicalDecls(DC, 0, Result);
+ return FindExternalLexicalDecls(DC, nullptr, Result);
}
template <typename DeclTy>
diff --git a/include/clang/Sema/ObjCMethodList.h b/include/clang/Sema/ObjCMethodList.h
index 94e380721d..20033567df 100644
--- a/include/clang/Sema/ObjCMethodList.h
+++ b/include/clang/Sema/ObjCMethodList.h
@@ -26,7 +26,7 @@ struct ObjCMethodList {
/// \brief The next list object and 2 bits for extra info.
llvm::PointerIntPair<ObjCMethodList *, 2> NextAndExtraBits;
- ObjCMethodList() : Method(0) { }
+ ObjCMethodList() : Method(nullptr) { }
ObjCMethodList(ObjCMethodDecl *M, ObjCMethodList *C)
: Method(M), NextAndExtraBits(C, 0) { }
diff --git a/include/clang/Sema/Overload.h b/include/clang/Sema/Overload.h
index 83d8677d9b..d6dbd1226a 100644
--- a/include/clang/Sema/Overload.h
+++ b/include/clang/Sema/Overload.h
@@ -364,7 +364,7 @@ namespace clang {
}
void init(FailureKind K, QualType From, QualType To) {
Kind = K;
- FromExpr = 0;
+ FromExpr = nullptr;
setFromType(From);
setToType(To);
}
diff --git a/include/clang/Sema/Ownership.h b/include/clang/Sema/Ownership.h
index 4bbefcb8fe..189c5af434 100644
--- a/include/clang/Sema/Ownership.h
+++ b/include/clang/Sema/Ownership.h
@@ -49,7 +49,7 @@ namespace clang {
typedef llvm::PointerLikeTypeTraits<PtrTy> Traits;
public:
- OpaquePtr() : Ptr(0) {}
+ OpaquePtr() : Ptr(nullptr) {}
static OpaquePtr make(PtrTy P) { OpaquePtr OP; OP.set(P); return OP; }
@@ -79,7 +79,7 @@ namespace clang {
Ptr = Traits::getAsVoidPointer(P);
}
- LLVM_EXPLICIT operator bool() const { return Ptr != 0; }
+ LLVM_EXPLICIT operator bool() const { return Ptr != nullptr; }
void *getAsOpaquePtr() const { return Ptr; }
static OpaquePtr getFromOpaquePtr(void *P) { return OpaquePtr(P); }
diff --git a/include/clang/Sema/ParsedTemplate.h b/include/clang/Sema/ParsedTemplate.h
index 94db454a85..b36425f1be 100644
--- a/include/clang/Sema/ParsedTemplate.h
+++ b/include/clang/Sema/ParsedTemplate.h
@@ -35,7 +35,7 @@ namespace clang {
/// \brief Build an empty template argument.
///
/// This template argument is invalid.
- ParsedTemplateArgument() : Kind(Type), Arg(0) { }
+ ParsedTemplateArgument() : Kind(Type), Arg(nullptr) { }
/// \brief Create a template type argument or non-type template argument.
///
@@ -61,7 +61,7 @@ namespace clang {
SS(SS), Loc(TemplateLoc), EllipsisLoc() { }
/// \brief Determine whether the given template argument is invalid.
- bool isInvalid() const { return Arg == 0; }
+ bool isInvalid() const { return Arg == nullptr; }
/// \brief Determine what kind of template argument we have.
KindType getKind() const { return Kind; }
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index 98af3715bf..63427aaa4a 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -405,7 +405,7 @@ public:
enum IsThisCapture { ThisCapture };
Capture(IsThisCapture, bool IsNested, SourceLocation Loc,
QualType CaptureType, Expr *Cpy)
- : VarAndNested(0, IsNested),
+ : VarAndNested(nullptr, IsNested),
InitExprAndCaptureKind(Cpy, Cap_This),
Loc(Loc), EllipsisLoc(), CaptureType(CaptureType) {}
@@ -663,10 +663,10 @@ public:
SourceLocation PotentialThisCaptureLocation;
LambdaScopeInfo(DiagnosticsEngine &Diag)
- : CapturingScopeInfo(Diag, ImpCap_None), Lambda(0),
- CallOperator(0), NumExplicitCaptures(0), Mutable(false),
+ : CapturingScopeInfo(Diag, ImpCap_None), Lambda(nullptr),
+ CallOperator(nullptr), NumExplicitCaptures(0), Mutable(false),
ExprNeedsCleanups(false), ContainsUnexpandedParameterPack(false),
- AutoTemplateParameterDepth(0), GLTemplateParameterList(0)
+ AutoTemplateParameterDepth(0), GLTemplateParameterList(nullptr)
{
Kind = SK_Lambda;
}
@@ -787,7 +787,7 @@ public:
};
FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy()
- : Base(0, false), Property(0) {}
+ : Base(nullptr, false), Property(nullptr) {}
FunctionScopeInfo::WeakObjectProfileTy
FunctionScopeInfo::WeakObjectProfileTy::getSentinel() {
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 9c2918b2a8..dca6a39ace 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -493,13 +493,13 @@ public:
sema::DelayedDiagnosticPool *CurPool;
public:
- DelayedDiagnostics() : CurPool(0) {}
+ DelayedDiagnostics() : CurPool(nullptr) {}
/// Adds a delayed diagnostic.
void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
/// Determines whether diagnostics should be delayed.
- bool shouldDelayDiagnostics() { return CurPool != 0; }
+ bool shouldDelayDiagnostics() { return CurPool != nullptr; }
/// Returns the current delayed-diagnostics pool.
sema::DelayedDiagnosticPool *getCurrentPool() const {
@@ -527,13 +527,13 @@ public:
DelayedDiagnosticsState pushUndelayed() {
DelayedDiagnosticsState state;
state.SavedPool = CurPool;
- CurPool = 0;
+ CurPool = nullptr;
return state;
}
/// Undo a previous pushUndelayed().
void popUndelayed(DelayedDiagnosticsState state) {
- assert(CurPool == NULL);
+ assert(CurPool == nullptr);
CurPool = state.SavedPool;
}
} DelayedDiagnostics;
@@ -563,7 +563,7 @@ public:
S.CurContext = SavedContext;
S.DelayedDiagnostics.popUndelayed(SavedContextState);
S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
- SavedContext = 0;
+ SavedContext = nullptr;
}
~ContextRAII() {
@@ -931,7 +931,7 @@ public:
public:
Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
TranslationUnitKind TUKind = TU_Complete,
- CodeCompleteConsumer *CompletionConsumer = 0);
+ CodeCompleteConsumer *CompletionConsumer = nullptr);
~Sema();
/// \brief Perform initialization that occurs after the parser has been
@@ -1053,8 +1053,10 @@ public:
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
RecordDecl *RD,
CapturedRegionKind K);
- void PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP =0,
- const Decl *D = 0, const BlockExpr *blkExpr = 0);
+ void
+ PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP = nullptr,
+ const Decl *D = nullptr,
+ const BlockExpr *blkExpr = nullptr);
sema::FunctionScopeInfo *getCurFunction() const {
return FunctionScopes.back();
@@ -1062,14 +1064,14 @@ public:
sema::FunctionScopeInfo *getEnclosingFunction() const {
if (FunctionScopes.empty())
- return 0;
+ return nullptr;
for (int e = FunctionScopes.size()-1; e >= 0; --e) {
if (isa<sema::BlockScopeInfo>(FunctionScopes[e]))
continue;
return FunctionScopes[e];
}
- return 0;
+ return nullptr;
}
template <typename ExprT>
@@ -1107,9 +1109,9 @@ public:
//
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs,
- const DeclSpec *DS = 0);
+ const DeclSpec *DS = nullptr);
QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
- const DeclSpec *DS = 0);
+ const DeclSpec *DS = nullptr);
QualType BuildPointerType(QualType T,
SourceLocation Loc, DeclarationName Entity);
QualType BuildReferenceType(QualType T, bool LValueRef,
@@ -1171,7 +1173,8 @@ public:
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo);
DeclarationNameInfo GetNameForDeclarator(Declarator &D);
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name);
- static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo = 0);
+ static QualType GetTypeFromParser(ParsedType Ty,
+ TypeSourceInfo **TInfo = nullptr);
CanThrowResult canThrow(const Expr *E);
const FunctionProtoType *ResolveExceptionSpec(SourceLocation Loc,
const FunctionProtoType *FPT);
@@ -1187,8 +1190,8 @@ public:
const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
const FunctionProtoType *Old, SourceLocation OldLoc,
const FunctionProtoType *New, SourceLocation NewLoc,
- bool *MissingExceptionSpecification = 0,
- bool *MissingEmptyExceptionSpecification = 0,
+ bool *MissingExceptionSpecification = nullptr,
+ bool *MissingEmptyExceptionSpecification = nullptr,
bool AllowNoexceptAllMatchWithNoSpec = false,
bool IsOperatorNew = false);
bool CheckExceptionSpecSubset(
@@ -1391,20 +1394,20 @@ public:
/// them into the FunctionDecl.
std::vector<NamedDecl*> DeclsInPrototypeScope;
- DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = 0);
+ DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
void DiagnoseUseOfUnimplementedSelectors();
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const;
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
- Scope *S, CXXScopeSpec *SS = 0,
+ Scope *S, CXXScopeSpec *SS = nullptr,
bool isClassName = false,
bool HasTrailingDot = false,
ParsedType ObjectType = ParsedType(),
bool IsCtorOrDtorName = false,
bool WantNontrivialTypeSourceInfo = false,
- IdentifierInfo **CorrectedII = 0);
+ IdentifierInfo **CorrectedII = nullptr);
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S);
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
bool DiagnoseUnknownTypeName(IdentifierInfo *&II,
@@ -1537,7 +1540,7 @@ public:
SourceLocation NameLoc,
const Token &NextToken,
bool IsAddressOfOperand,
- CorrectionCandidateCallback *CCC = 0);
+ CorrectionCandidateCallback *CCC = nullptr);
Decl *ActOnDeclarator(Scope *S, Declarator &D);
@@ -1631,7 +1634,7 @@ public:
SourceLocation LocAfterDecls);
void CheckForFunctionRedefinition(FunctionDecl *FD,
const FunctionDecl *EffectiveDefinition =
- 0);
+ nullptr);
Decl *ActOnStartOfFunctionDef(Scope *S, Declarator &D);
Decl *ActOnStartOfFunctionDef(Scope *S, Decl *D);
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
@@ -1802,7 +1805,7 @@ public:
InClassInitStyle InitStyle,
SourceLocation TSSL,
AccessSpecifier AS, NamedDecl *PrevDecl,
- Declarator *D = 0);
+ Declarator *D = nullptr);
bool CheckNontrivialField(FieldDecl *FD);
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
@@ -1922,7 +1925,7 @@ public:
/// \param AllowInlineNamespace If \c true, allow the declaration to be in the
/// enclosing namespace set of the context, rather than contained
/// directly within it.
- bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = 0,
+ bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
bool AllowInlineNamespace = false);
/// Finds the scope corresponding to the given decl context, if it
@@ -2053,7 +2056,7 @@ public:
QualType& ConvertedType);
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
const FunctionProtoType *NewType,
- unsigned *ArgPos = 0);
+ unsigned *ArgPos = nullptr);
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag,
QualType FromType, QualType ToType);
@@ -2223,10 +2226,10 @@ public:
bool PartialOverloading = false,
bool AllowExplicit = false);
void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
- ArrayRef<Expr *> Args,
- OverloadCandidateSet& CandidateSet,
- bool SuppressUserConversions = false,
- TemplateArgumentListInfo *ExplicitTemplateArgs = 0);
+ ArrayRef<Expr *> Args,
+ OverloadCandidateSet &CandidateSet,
+ bool SuppressUserConversions = false,
+ TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
void AddMethodCandidate(DeclAccessPair FoundDecl,
QualType ObjectType,
Expr::Classification ObjectClassification,
@@ -2317,11 +2320,12 @@ public:
QualType TargetType,
bool Complain,
DeclAccessPair &Found,
- bool *pHadMultipleCandidates = 0);
+ bool *pHadMultipleCandidates = nullptr);
- FunctionDecl *ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
- bool Complain = false,
- DeclAccessPair* Found = 0);
+ FunctionDecl *
+ ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
+ bool Complain = false,
+ DeclAccessPair *Found = nullptr);
bool ResolveAndFixSingleFunctionTemplateSpecialization(
ExprResult &SrcExpr,
@@ -2407,7 +2411,7 @@ public:
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
- bool *NoArrowOperatorFound = 0);
+ bool *NoArrowOperatorFound = nullptr);
/// CheckCallReturnType - Checks that a call expression's return type is
/// complete. Returns true on failure. The location passed in is the location
@@ -2620,9 +2624,9 @@ public:
Scope *S, CXXScopeSpec *SS,
CorrectionCandidateCallback &CCC,
CorrectTypoKind Mode,
- DeclContext *MemberContext = 0,
+ DeclContext *MemberContext = nullptr,
bool EnteringContext = false,
- const ObjCObjectPointerType *OPT = 0,
+ const ObjCObjectPointerType *OPT = nullptr,
bool RecordFailure = true);
void diagnoseTypo(const TypoCorrection &Correction,
@@ -2669,11 +2673,11 @@ public:
bool CheckRegparmAttr(const AttributeList &attr, unsigned &value);
bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC,
- const FunctionDecl *FD = 0);
+ const FunctionDecl *FD = nullptr);
bool CheckNoReturnAttr(const AttributeList &attr);
bool checkStringLiteralArgumentAttr(const AttributeList &Attr,
unsigned ArgNum, StringRef &Str,
- SourceLocation *ArgLocation = 0);
+ SourceLocation *ArgLocation = nullptr);
bool checkMSInheritanceAttrOnDefinition(
CXXRecordDecl *RD, SourceRange Range, bool BestCase,
MSInheritanceAttr::Spelling SemanticSpelling);
@@ -2787,7 +2791,7 @@ public:
const unsigned AttributesAsWritten,
TypeSourceInfo *T,
tok::ObjCKeywordKind MethodImplKind,
- DeclContext *lexicalDC = 0);
+ DeclContext *lexicalDC = nullptr);
/// AtomicPropertySetterGetterRules - This routine enforces the rule (via
/// warning) when atomic property has one but not the other user-declared
@@ -2908,7 +2912,7 @@ public:
public:
class FullExprArg {
public:
- FullExprArg(Sema &actions) : E(0) { }
+ FullExprArg(Sema &actions) : E(nullptr) { }
// FIXME: The const_cast here is ugly. RValue references would make this
// much nicer (or we could duplicate a bunch of the move semantics
@@ -3208,7 +3212,7 @@ public:
bool CanUseDecl(NamedDecl *D);
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
- const ObjCInterfaceDecl *UnknownObjCClass=0);
+ const ObjCInterfaceDecl *UnknownObjCClass=nullptr);
void NoteDeletedFunction(FunctionDecl *FD);
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
@@ -3218,7 +3222,7 @@ public:
ArrayRef<Expr *> Args);
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
- Decl *LambdaContextDecl = 0,
+ Decl *LambdaContextDecl = nullptr,
bool IsDecltype = false);
enum ReuseLambdaContextDecl_t { ReuseLambdaContextDecl };
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
@@ -3309,7 +3313,7 @@ public:
/// emitted; this may also leave the ExprResult invalid.
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
bool ForceComplain = false,
- bool (*IsPlausibleResult)(QualType) = 0);
+ bool (*IsPlausibleResult)(QualType) = nullptr);
/// \brief Figure out if an expression could be turned into a call.
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
@@ -3332,7 +3336,7 @@ public:
SourceLocation TemplateKWLoc,
UnqualifiedId &Id,
bool HasTrailingLParen, bool IsAddressOfOperand,
- CorrectionCandidateCallback *CCC = 0,
+ CorrectionCandidateCallback *CCC = nullptr,
bool IsInlineAsmIdentifier = false);
void DecomposeUnqualifiedId(const UnqualifiedId &Id,
@@ -3340,10 +3344,11 @@ public:
DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *&TemplateArgs);
- bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
- CorrectionCandidateCallback &CCC,
- TemplateArgumentListInfo *ExplicitTemplateArgs = 0,
- ArrayRef<Expr *> Args = None);
+ bool
+ DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
+ CorrectionCandidateCallback &CCC,
+ TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
+ ArrayRef<Expr *> Args = None);
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S,
IdentifierInfo *II,
@@ -3358,18 +3363,20 @@ public:
ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty,
ExprValueKind VK,
SourceLocation Loc,
- const CXXScopeSpec *SS = 0);
- ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
- const DeclarationNameInfo &NameInfo,
- const CXXScopeSpec *SS = 0, NamedDecl *FoundD = 0,
- const TemplateArgumentListInfo *TemplateArgs = 0);
+ const CXXScopeSpec *SS = nullptr);
+ ExprResult
+ BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
+ const DeclarationNameInfo &NameInfo,
+ const CXXScopeSpec *SS = nullptr,
+ NamedDecl *FoundD = nullptr,
+ const TemplateArgumentListInfo *TemplateArgs = nullptr);
ExprResult
BuildAnonymousStructUnionMemberReference(
const CXXScopeSpec &SS,
SourceLocation nameLoc,
IndirectFieldDecl *indirectField,
- DeclAccessPair FoundDecl = DeclAccessPair::make(0, AS_none),
- Expr *baseObjectExpr = 0,
+ DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
+ Expr *baseObjectExpr = nullptr,
SourceLocation opLoc = SourceLocation());
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
@@ -3398,20 +3405,22 @@ public:
bool NeedsADL);
ExprResult BuildDeclarationNameExpr(
const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
- NamedDecl *FoundD = 0, const TemplateArgumentListInfo *TemplateArgs = 0);
+ NamedDecl *FoundD = nullptr,
+ const TemplateArgumentListInfo *TemplateArgs = nullptr);
ExprResult BuildLiteralOperatorCall(LookupResult &R,
- DeclarationNameInfo &SuffixInfo,
- ArrayRef<Expr*> Args,
- SourceLocation LitEndLoc,
- TemplateArgumentListInfo *ExplicitTemplateArgs = 0);
+ DeclarationNameInfo &SuffixInfo,
+ ArrayRef<Expr *> Args,
+ SourceLocation LitEndLoc,
+ TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
ExprResult BuildPredefinedExpr(SourceLocation Loc,
PredefinedExpr::IdentType IT);
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind);
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val);
- ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = 0);
- ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope = 0);
+ ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
+ ExprResult ActOnCharacterConstant(const Token &Tok,
+ Scope *UDLScope = nullptr);
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E);
ExprResult ActOnParenListExpr(SourceLocation L,
SourceLocation R,
@@ -3420,7 +3429,7 @@ public:
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
/// fragments (e.g. "foo" "bar" L"baz").
ExprResult ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks,
- Scope *UDLScope = 0);
+ Scope *UDLScope = nullptr);
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc,
SourceLocation DefaultLoc,
@@ -3497,15 +3506,14 @@ public:
bool HasTrailingLParen;
};
- ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
- SourceLocation OpLoc, bool IsArrow,
- const CXXScopeSpec &SS,
- SourceLocation TemplateKWLoc,
- NamedDecl *FirstQualifierInScope,
- LookupResult &R,
- const TemplateArgumentListInfo *TemplateArgs,
- bool SuppressQualifierCheck = false,
- ActOnMemberAccessExtraArgs *ExtraArgs = 0);
+ ExprResult
+ BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc,
+ bool IsArrow, const CXXScopeSpec &SS,
+ SourceLocation TemplateKWLoc,
+ NamedDecl *FirstQualifierInScope, LookupResult &R,
+ const TemplateArgumentListInfo *TemplateArgs,
+ bool SuppressQualifierCheck = false,
+ ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow);
ExprResult LookupMemberExpr(LookupResult &R, ExprResult &Base,
@@ -3551,12 +3559,13 @@ public:
/// locations.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
MultiExprArg ArgExprs, SourceLocation RParenLoc,
- Expr *ExecConfig = 0, bool IsExecConfig = false);
+ Expr *ExecConfig = nullptr,
+ bool IsExecConfig = false);
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
SourceLocation LParenLoc,
ArrayRef<Expr *> Arg,
SourceLocation RParenLoc,
- Expr *Config = 0,
+ Expr *Config = nullptr,
bool IsExecConfig = false);
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc,
@@ -4222,7 +4231,7 @@ public:
/// \return returns 'true' if failed, 'false' if success.
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
bool BuildAndDiagnose = true,
- const unsigned *const FunctionScopeIndexToStopAt = 0);
+ const unsigned *const FunctionScopeIndexToStopAt = nullptr);
/// \brief Determine whether the given type is the type of *this that is used
/// outside of the body of a member function for a type that is currently
@@ -4445,7 +4454,7 @@ public:
CXXScopeSpec &SS,
NamedDecl *ScopeLookupResult,
bool ErrorRecoveryLookup,
- bool *IsCorrectedToColon = 0);
+ bool *IsCorrectedToColon = nullptr);
/// \brief The parser has parsed a nested-name-specifier 'identifier::'.
///
@@ -4484,7 +4493,7 @@ public:
bool EnteringContext,
CXXScopeSpec &SS,
bool ErrorRecoveryLookup = false,
- bool *IsCorrectedToColon = 0);
+ bool *IsCorrectedToColon = nullptr);
ExprResult ActOnDecltypeExpression(Expr *E);
@@ -4753,13 +4762,13 @@ public:
// C++ Classes
//
bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
- const CXXScopeSpec *SS = 0);
+ const CXXScopeSpec *SS = nullptr);
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS);
bool ActOnAccessSpecifier(AccessSpecifier Access,
SourceLocation ASLoc,
SourceLocation ColonLoc,
- AttributeList *Attrs = 0);
+ AttributeList *Attrs = nullptr);
NamedDecl *ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS,
Declarator &D,
@@ -4976,7 +4985,7 @@ public:
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
SourceLocation Loc, SourceRange Range,
- CXXCastPath *BasePath = 0,
+ CXXCastPath *BasePath = nullptr,
bool IgnoreAccess = false);
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base,
unsigned InaccessibleBaseID,
@@ -5967,7 +5976,7 @@ public:
unsigned NumExplicitlySpecified,
FunctionDecl *&Specialization,
sema::TemplateDeductionInfo &Info,
- SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = 0);
+ SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr);
TemplateDeductionResult
DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
@@ -6064,10 +6073,11 @@ public:
// C++ Template Instantiation
//
- MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D,
- const TemplateArgumentList *Innermost = 0,
- bool RelativeToPrimary = false,
- const FunctionDecl *Pattern = 0);
+ MultiLevelTemplateArgumentList
+ getTemplateInstantiationArgs(NamedDecl *D,
+ const TemplateArgumentList *Innermost = nullptr,
+ bool RelativeToPrimary = false,
+ const FunctionDecl *Pattern = nullptr);
/// \brief A template instantiation that is currently in progress.
struct ActiveTemplateInstantiation {
@@ -6142,8 +6152,8 @@ public:
SourceRange InstantiationRange;
ActiveTemplateInstantiation()
- : Kind(TemplateInstantiation), Template(0), Entity(0), TemplateArgs(0),
- NumTemplateArgs(0), DeductionInfo(0) {}
+ : Kind(TemplateInstantiation), Template(nullptr), Entity(nullptr),
+ TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
/// \brief Determines whether this template is an actual instantiation
/// that should be counted toward the maximum instantiation depth.
@@ -6570,7 +6580,7 @@ public:
ParmVarDecl **Params, unsigned NumParams,
const MultiLevelTemplateArgumentList &TemplateArgs,
SmallVectorImpl<QualType> &ParamTypes,
- SmallVectorImpl<ParmVarDecl *> *OutParams = 0);
+ SmallVectorImpl<ParmVarDecl *> *OutParams = nullptr);
ExprResult SubstExpr(Expr *E,
const MultiLevelTemplateArgumentList &TemplateArgs);
@@ -6634,8 +6644,8 @@ public:
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
const Decl *Pattern, Decl *Inst,
- LateInstantiatedAttrVec *LateAttrs = 0,
- LocalInstantiationScope *OuterMostScope = 0);
+ LateInstantiatedAttrVec *LateAttrs = nullptr,
+ LocalInstantiationScope *OuterMostScope = nullptr);
bool
InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation,
@@ -6680,8 +6690,8 @@ public:
const TemplateArgumentListInfo &TemplateArgsInfo,
SmallVectorImpl<TemplateArgument> &Converted,
SourceLocation PointOfInstantiation, void *InsertPos,
- LateInstantiatedAttrVec *LateAttrs = 0,
- LocalInstantiationScope *StartingScope = 0);
+ LateInstantiatedAttrVec *LateAttrs = nullptr,
+ LocalInstantiationScope *StartingScope = nullptr);
VarTemplateSpecializationDecl *CompleteVarTemplateSpecializationDecl(
VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
const MultiLevelTemplateArgumentList &TemplateArgs);
@@ -6815,8 +6825,8 @@ public:
/// \param lexicalDC Container for redeclaredProperty.
void ProcessPropertyDecl(ObjCPropertyDecl *property,
ObjCContainerDecl *CD,
- ObjCPropertyDecl *redeclaredProperty = 0,
- ObjCContainerDecl *lexicalDC = 0);
+ ObjCPropertyDecl *redeclaredProperty = nullptr,
+ ObjCContainerDecl *lexicalDC = nullptr);
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
@@ -6837,7 +6847,7 @@ public:
Selector GetterSel, Selector SetterSel,
bool *OverridingProperty,
tok::ObjCKeywordKind MethodImplKind,
- DeclContext *lexicalDC = 0);
+ DeclContext *lexicalDC = nullptr);
Decl *ActOnPropertyImplDecl(Scope *S,
SourceLocation AtLoc,
@@ -7360,7 +7370,7 @@ public:
/// If isLvalue, the result of the cast is an lvalue.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK,
ExprValueKind VK = VK_RValue,
- const CXXCastPath *BasePath = 0,
+ const CXXCastPath *BasePath = nullptr,
CheckedConversionKind CCK
= CCK_ImplicitConversion);
@@ -7535,7 +7545,7 @@ public:
SourceLocation Loc,
QualType DstType, QualType SrcType,
Expr *SrcExpr, AssignmentAction Action,
- bool *Complained = 0);
+ bool *Complained = nullptr);
/// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
/// integer not in the range of enum values.
@@ -7606,10 +7616,10 @@ public:
bool IsCompAssign = false);
QualType CheckAdditionOperands( // C99 6.5.6
ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc,
- QualType* CompLHSTy = 0);
+ QualType* CompLHSTy = nullptr);
QualType CheckSubtractionOperands( // C99 6.5.6
ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
- QualType* CompLHSTy = 0);
+ QualType* CompLHSTy = nullptr);
QualType CheckShiftOperands( // C99 6.5.7
ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, unsigned Opc,
bool IsCompAssign = false);
@@ -7642,10 +7652,10 @@ public:
ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2,
- bool *NonStandardCompositeType = 0);
+ bool *NonStandardCompositeType = nullptr);
QualType FindCompositePointerType(SourceLocation Loc,
ExprResult &E1, ExprResult &E2,
- bool *NonStandardCompositeType = 0) {
+ bool *NonStandardCompositeType = nullptr) {
Expr *E1Tmp = E1.take(), *E2Tmp = E2.take();
QualType Composite = FindCompositePointerType(Loc, E1Tmp, E2Tmp,
NonStandardCompositeType);
@@ -7855,7 +7865,8 @@ public:
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
unsigned DiagID,
bool AllowFold = true);
- ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result=0);
+ ExprResult VerifyIntegerConstantExpression(Expr *E,
+ llvm::APSInt *Result = nullptr);
/// VerifyBitField - verifies that a bit field expression is an ICE and has
/// the correct width, and that the field type is valid.
@@ -7863,7 +7874,7 @@ public:
/// Can optionally return whether the bit-field is of width 0
ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
QualType FieldTy, bool IsMsStruct,
- Expr *BitWidth, bool *ZeroWidth = 0);
+ Expr *BitWidth, bool *ZeroWidth = nullptr);
enum CUDAFunctionTarget {
CFT_Device,
@@ -7987,7 +7998,7 @@ public:
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
ArrayRef<IdentifierInfo *> SelIdents,
bool AtArgumentExpression,
- ObjCInterfaceDecl *Super = 0);
+ ObjCInterfaceDecl *Super = nullptr);
void CodeCompleteObjCForCollection(Scope *S,
DeclGroupPtrTy IterationVar);
void CodeCompleteObjCSelector(Scope *S,
@@ -8040,7 +8051,7 @@ public:
private:
void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
- const ArraySubscriptExpr *ASE=0,
+ const ArraySubscriptExpr *ASE=nullptr,
bool AllowOnePastEnd=true, bool IndexNegated=false);
void CheckArrayAccess(const Expr *E);
// Used to grab the relevant information from a FormatAttr and a
@@ -8155,8 +8166,8 @@ private:
void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
SourceLocation ReturnLoc,
bool isObjCMethod = false,
- const AttrVec *Attrs = 0,
- const FunctionDecl *FD = 0);
+ const AttrVec *Attrs = nullptr,
+ const FunctionDecl *FD = nullptr);
void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS);
void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
@@ -8267,7 +8278,7 @@ class EnterExpressionEvaluationContext {
public:
EnterExpressionEvaluationContext(Sema &Actions,
Sema::ExpressionEvaluationContext NewContext,
- Decl *LambdaContextDecl = 0,
+ Decl *LambdaContextDecl = nullptr,
bool IsDecltype = false)
: Actions(Actions) {
Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h
index 0b3d32b25c..563cc19983 100644
--- a/include/clang/Sema/SemaInternal.h
+++ b/include/clang/Sema/SemaInternal.h
@@ -29,7 +29,7 @@ inline PartialDiagnostic Sema::PDiag(unsigned DiagID) {
// This requires the variable to be non-dependent and the initializer
// to not be value dependent.
inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) {
- const VarDecl *DefVD = 0;
+ const VarDecl *DefVD = nullptr;
return !isa<ParmVarDecl>(Var) &&
Var->isUsableInConstantExpressions(Context) &&
Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE();
diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h
index 1af61d5abd..03fb523b04 100644
--- a/include/clang/Sema/Template.h
+++ b/include/clang/Sema/Template.h
@@ -246,7 +246,7 @@ namespace clang {
LocalInstantiationScope(Sema &SemaRef, bool CombineWithOuterScope = false)
: SemaRef(SemaRef), Outer(SemaRef.CurrentInstantiationScope),
Exited(false), CombineWithOuterScope(CombineWithOuterScope),
- PartiallySubstitutedPack(0)
+ PartiallySubstitutedPack(nullptr)
{
SemaRef.CurrentInstantiationScope = this;
}
@@ -276,7 +276,7 @@ namespace clang {
LocalInstantiationScope *newScope =
new LocalInstantiationScope(SemaRef, CombineWithOuterScope);
- newScope->Outer = 0;
+ newScope->Outer = nullptr;
if (Outer)
newScope->Outer = Outer->cloneScopes(Outermost);
@@ -348,17 +348,17 @@ namespace clang {
/// interest.
void ResetPartiallySubstitutedPack() {
assert(PartiallySubstitutedPack && "No partially-substituted pack");
- PartiallySubstitutedPack = 0;
- ArgsInPartiallySubstitutedPack = 0;
+ PartiallySubstitutedPack = nullptr;
+ ArgsInPartiallySubstitutedPack = nullptr;
NumArgsInPartiallySubstitutedPack = 0;
}
/// \brief Retrieve the partially-substitued template parameter pack.
///
/// If there is no partially-substituted parameter pack, returns NULL.
- NamedDecl *getPartiallySubstitutedPack(
- const TemplateArgument **ExplicitArgs = 0,
- unsigned *NumExplicitArgs = 0) const;
+ NamedDecl *
+ getPartiallySubstitutedPack(const TemplateArgument **ExplicitArgs = nullptr,
+ unsigned *NumExplicitArgs = nullptr) const;
};
class TemplateDeclInstantiator
@@ -391,8 +391,8 @@ namespace clang {
const MultiLevelTemplateArgumentList &TemplateArgs)
: SemaRef(SemaRef),
SubstIndex(SemaRef, SemaRef.ArgumentPackSubstitutionIndex),
- Owner(Owner), TemplateArgs(TemplateArgs), LateAttrs(0), StartingScope(0)
- { }
+ Owner(Owner), TemplateArgs(TemplateArgs), LateAttrs(nullptr),
+ StartingScope(nullptr) {}
// Define all the decl visitors using DeclNodes.inc
#define DECL(DERIVED, BASE) \
@@ -436,8 +436,8 @@ namespace clang {
// Disable late instantiation of attributes.
void disableLateAttributeInstantiation() {
- LateAttrs = 0;
- StartingScope = 0;
+ LateAttrs = nullptr;
+ StartingScope = nullptr;
}
LocalInstantiationScope *getStartingScope() const { return StartingScope; }
diff --git a/include/clang/Sema/TemplateDeduction.h b/include/clang/Sema/TemplateDeduction.h
index 1daa6891ed..6a51314b0b 100644
--- a/include/clang/Sema/TemplateDeduction.h
+++ b/include/clang/Sema/TemplateDeduction.h
@@ -48,7 +48,8 @@ class TemplateDeductionInfo {
public:
TemplateDeductionInfo(SourceLocation Loc)
- : Deduced(0), Loc(Loc), HasSFINAEDiagnostic(false), Expression(0) { }
+ : Deduced(nullptr), Loc(Loc), HasSFINAEDiagnostic(false),
+ Expression(nullptr) {}
/// \brief Returns the location at which template argument is
/// occurring.
@@ -59,7 +60,7 @@ public:
/// \brief Take ownership of the deduced template argument list.
TemplateArgumentList *take() {
TemplateArgumentList *Result = Deduced;
- Deduced = 0;
+ Deduced = nullptr;
return Result;
}
diff --git a/include/clang/Sema/TypoCorrection.h b/include/clang/Sema/TypoCorrection.h
index 2ef8d84fad..e5f8f4dfa2 100644
--- a/include/clang/Sema/TypoCorrection.h
+++ b/include/clang/Sema/TypoCorrection.h
@@ -39,7 +39,7 @@ public:
static const unsigned CallbackDistanceWeight = 150U;
TypoCorrection(const DeclarationName &Name, NamedDecl *NameDecl,
- NestedNameSpecifier *NNS = 0, unsigned CharDistance = 0,
+ NestedNameSpecifier *NNS = nullptr, unsigned CharDistance = 0,
unsigned QualifierDistance = 0)
: CorrectionName(Name), CorrectionNameSpec(NNS),
CharDistance(CharDistance), QualifierDistance(QualifierDistance),
@@ -49,7 +49,7 @@ public:
CorrectionDecls.push_back(NameDecl);
}
- TypoCorrection(NamedDecl *Name, NestedNameSpecifier *NNS = 0,
+ TypoCorrection(NamedDecl *Name, NestedNameSpecifier *NNS = nullptr,
unsigned CharDistance = 0)
: CorrectionName(Name->getDeclName()), CorrectionNameSpec(NNS),
CharDistance(CharDistance), QualifierDistance(0), CallbackDistance(0),
@@ -58,14 +58,14 @@ public:
CorrectionDecls.push_back(Name);
}
- TypoCorrection(DeclarationName Name, NestedNameSpecifier *NNS = 0,
+ TypoCorrection(DeclarationName Name, NestedNameSpecifier *NNS = nullptr,
unsigned CharDistance = 0)
: CorrectionName(Name), CorrectionNameSpec(NNS),
CharDistance(CharDistance), QualifierDistance(0), CallbackDistance(0),
ForceSpecifierReplacement(false), RequiresImport(false) {}
TypoCorrection()
- : CorrectionNameSpec(0), CharDistance(0), QualifierDistance(0),
+ : CorrectionNameSpec(nullptr), CharDistance(0), QualifierDistance(0),
CallbackDistance(0), ForceSpecifierReplacement(false),
RequiresImport(false) {}
@@ -81,7 +81,7 @@ public:
}
void setCorrectionSpecifier(NestedNameSpecifier* NNS) {
CorrectionNameSpec = NNS;
- ForceSpecifierReplacement = (NNS != 0);
+ ForceSpecifierReplacement = (NNS != nullptr);
}
void WillReplaceSpecifier(bool ForceReplacement) {
@@ -130,7 +130,7 @@ public:
/// \brief Gets the pointer to the declaration of the typo correction
NamedDecl *getCorrectionDecl() const {
- return hasCorrectionDecl() ? *(CorrectionDecls.begin()) : 0;
+ return hasCorrectionDecl() ? *(CorrectionDecls.begin()) : nullptr;
}
template <class DeclClass>
DeclClass *getCorrectionDeclAs() const {
@@ -172,7 +172,7 @@ public:
/// as the only element in the list to mark this TypoCorrection as a keyword.
void makeKeyword() {
CorrectionDecls.clear();
- CorrectionDecls.push_back(0);
+ CorrectionDecls.push_back(nullptr);
ForceSpecifierReplacement = true;
}
@@ -180,7 +180,7 @@ public:
// item in CorrectionDecls is NULL.
bool isKeyword() const {
return !CorrectionDecls.empty() &&
- CorrectionDecls.front() == 0;
+ CorrectionDecls.front() == nullptr;
}
// Check if this TypoCorrection is the given keyword.
@@ -306,7 +306,7 @@ class FunctionCallFilterCCC : public CorrectionCandidateCallback {
public:
FunctionCallFilterCCC(Sema &SemaRef, unsigned NumArgs,
bool HasExplicitTemplateArgs,
- MemberExpr *ME = 0);
+ MemberExpr *ME = nullptr);
bool ValidateCandidate(const TypoCorrection &candidate) override;
diff --git a/include/clang/Sema/Weak.h b/include/clang/Sema/Weak.h
index 6d1b64bd30..9c7212e0c8 100644
--- a/include/clang/Sema/Weak.h
+++ b/include/clang/Sema/Weak.h
@@ -28,7 +28,7 @@ class WeakInfo {
bool used; // identifier later declared?
public:
WeakInfo()
- : alias(0), loc(SourceLocation()), used(false) {}
+ : alias(nullptr), loc(SourceLocation()), used(false) {}
WeakInfo(IdentifierInfo *Alias, SourceLocation Loc)
: alias(Alias), loc(Loc), used(false) {}
inline IdentifierInfo * getAlias() const { return alias; }
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 807e732510..5578e90f13 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -427,7 +427,7 @@ private:
uint64_t Offset;
unsigned RawLoc;
- ReplacedDeclInfo() : Mod(0), Offset(0), RawLoc(0) {}
+ ReplacedDeclInfo() : Mod(nullptr), Offset(0), RawLoc(0) {}
ReplacedDeclInfo(ModuleFile *Mod, uint64_t Offset, unsigned RawLoc)
: Mod(Mod), Offset(Offset), RawLoc(RawLoc) {}
};
@@ -441,7 +441,7 @@ private:
ModuleFile *Mod;
ArrayRef<serialization::LocalDeclID> Decls;
- FileDeclsInfo() : Mod(0) {}
+ FileDeclsInfo() : Mod(nullptr) {}
FileDeclsInfo(ModuleFile *Mod, ArrayRef<serialization::LocalDeclID> Decls)
: Mod(Mod), Decls(Decls) {}
};
@@ -1192,7 +1192,7 @@ private:
typedef value_type& reference;
typedef value_type* pointer;
- ModuleDeclIterator() : Reader(0), Mod(0), Pos(0) { }
+ ModuleDeclIterator() : Reader(nullptr), Mod(nullptr), Pos(nullptr) { }
ModuleDeclIterator(ASTReader *Reader, ModuleFile *Mod,
const serialization::LocalDeclID *Pos)
@@ -1722,7 +1722,7 @@ public:
void InitializeSema(Sema &S) override;
/// \brief Inform the semantic consumer that Sema is no longer available.
- void ForgetSema() override { SemaObj = 0; }
+ void ForgetSema() override { SemaObj = nullptr; }
/// \brief Retrieve the IdentifierInfo for the named identifier.
///
@@ -1789,7 +1789,7 @@ public:
void SetIdentifierInfo(unsigned ID, IdentifierInfo *II);
void SetGloballyVisibleDecls(IdentifierInfo *II,
const SmallVectorImpl<uint32_t> &DeclIDs,
- SmallVectorImpl<Decl *> *Decls = 0);
+ SmallVectorImpl<Decl *> *Decls = nullptr);
/// \brief Report a diagnostic.
DiagnosticBuilder Diag(unsigned DiagID);
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index 43228efcba..80ac77c4e5 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -295,7 +295,7 @@ private:
};
public:
- DeclUpdate(unsigned Kind) : Kind(Kind), Dcl(0) {}
+ DeclUpdate(unsigned Kind) : Kind(Kind), Dcl(nullptr) {}
DeclUpdate(unsigned Kind, const Decl *Dcl) : Kind(Kind), Dcl(Dcl) {}
DeclUpdate(unsigned Kind, QualType Type)
: Kind(Kind), Type(Type.getAsOpaquePtr()) {}
diff --git a/include/clang/Serialization/ModuleManager.h b/include/clang/Serialization/ModuleManager.h
index ca643ba45f..08c1735ab0 100644
--- a/include/clang/Serialization/ModuleManager.h
+++ b/include/clang/Serialization/ModuleManager.h
@@ -65,7 +65,7 @@ class ModuleManager {
/// calls to visit().
struct VisitState {
explicit VisitState(unsigned N)
- : VisitNumber(N, 0), NextVisitNumber(1), NextState(0)
+ : VisitNumber(N, 0), NextVisitNumber(1), NextState(nullptr)
{
Stack.reserve(N);
}
@@ -230,7 +230,7 @@ public:
/// Any module that is known to both the global module index and the module
/// manager that is *not* in this set can be skipped.
void visit(bool (*Visitor)(ModuleFile &M, void *UserData), void *UserData,
- llvm::SmallPtrSet<ModuleFile *, 4> *ModuleFilesHit = 0);
+ llvm::SmallPtrSet<ModuleFile *, 4> *ModuleFilesHit = nullptr);
/// \brief Visit each of the modules with a depth-first traversal.
///
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index ccbc47f49b..5371231925 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -144,19 +144,18 @@ private:
public:
BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode)
- : BT(bt), DeclWithIssue(0), Description(desc), ErrorNode(errornode),
+ : BT(bt), DeclWithIssue(nullptr), Description(desc), ErrorNode(errornode),
ConfigurationChangeToken(0), DoNotPrunePath(false) {}
BugReport(BugType& bt, StringRef shortDesc, StringRef desc,
const ExplodedNode *errornode)
- : BT(bt), DeclWithIssue(0), ShortDescription(shortDesc), Description(desc),
- ErrorNode(errornode), ConfigurationChangeToken(0),
+ : BT(bt), DeclWithIssue(nullptr), ShortDescription(shortDesc),
+ Description(desc), ErrorNode(errornode), ConfigurationChangeToken(0),
DoNotPrunePath(false) {}
- BugReport(BugType& bt, StringRef desc, PathDiagnosticLocation l)
- : BT(bt), DeclWithIssue(0), Description(desc), Location(l), ErrorNode(0),
- ConfigurationChangeToken(0),
- DoNotPrunePath(false) {}
+ BugReport(BugType &bt, StringRef desc, PathDiagnosticLocation l)
+ : BT(bt), DeclWithIssue(nullptr), Description(desc), Location(l),
+ ErrorNode(nullptr), ConfigurationChangeToken(0), DoNotPrunePath(false) {}
/// \brief Create a BugReport with a custom uniqueing location.
///
@@ -167,7 +166,7 @@ public:
/// the allocation site, rather then the location where the bug is reported.
BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode,
PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique)
- : BT(bt), DeclWithIssue(0), Description(desc),
+ : BT(bt), DeclWithIssue(nullptr), Description(desc),
UniqueingLocation(LocationToUnique),
UniqueingDecl(DeclToUnique),
ErrorNode(errornode), ConfigurationChangeToken(0),
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
index 302e0f821a..d49b64c2b9 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
@@ -265,7 +265,7 @@ public:
const ExplodedNode *Prev,
BugReporterContext &BRC,
BugReport &BR) override {
- return 0;
+ return nullptr;
}
PathDiagnosticPiece *getEndPath(BugReporterContext &BRC,
diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
index 69ec3e3b3f..5a578d015e 100644
--- a/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ b/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -138,29 +138,29 @@ private:
PathDiagnosticLocation(SourceLocation L, const SourceManager &sm,
Kind kind)
- : K(kind), S(0), D(0), SM(&sm),
+ : K(kind), S(nullptr), D(nullptr), SM(&sm),
Loc(genLocation(L)), Range(genRange()) {
}
- FullSourceLoc
- genLocation(SourceLocation L = SourceLocation(),
- LocationOrAnalysisDeclContext LAC = (AnalysisDeclContext*)0) const;
+ FullSourceLoc genLocation(
+ SourceLocation L = SourceLocation(),
+ LocationOrAnalysisDeclContext LAC = (AnalysisDeclContext *)nullptr) const;
- PathDiagnosticRange
- genRange(LocationOrAnalysisDeclContext LAC = (AnalysisDeclContext*)0) const;
+ PathDiagnosticRange genRange(
+ LocationOrAnalysisDeclContext LAC = (AnalysisDeclContext *)nullptr) const;
public:
/// Create an invalid location.
PathDiagnosticLocation()
- : K(SingleLocK), S(0), D(0), SM(0) {}
+ : K(SingleLocK), S(nullptr), D(nullptr), SM(nullptr) {}
/// Create a location corresponding to the given statement.
PathDiagnosticLocation(const Stmt *s,
const SourceManager &sm,
LocationOrAnalysisDeclContext lac)
: K(s->getLocStart().isValid() ? StmtK : SingleLocK),
- S(K == StmtK ? s : 0),
- D(0), SM(&sm),
+ S(K == StmtK ? s : nullptr),
+ D(nullptr), SM(&sm),
Loc(genLocation(SourceLocation(), lac)),
Range(genRange(lac)) {
assert(K == SingleLocK || S);
@@ -170,7 +170,7 @@ public:
/// Create a location corresponding to the given declaration.
PathDiagnosticLocation(const Decl *d, const SourceManager &sm)
- : K(DeclK), S(0), D(d), SM(&sm),
+ : K(DeclK), S(nullptr), D(d), SM(&sm),
Loc(genLocation()), Range(genRange()) {
assert(D);
assert(Loc.isValid());
@@ -181,7 +181,8 @@ public:
///
/// This should only be used if there are no more appropriate constructors.
PathDiagnosticLocation(SourceLocation loc, const SourceManager &sm)
- : K(SingleLocK), S(0), D(0), SM(&sm), Loc(loc, sm), Range(genRange()) {
+ : K(SingleLocK), S(nullptr), D(nullptr), SM(&sm), Loc(loc, sm),
+ Range(genRange()) {
assert(Loc.isValid());
assert(Range.isValid());
}
@@ -264,7 +265,7 @@ public:
}
bool isValid() const {
- return SM != 0;
+ return SM != nullptr;
}
FullSourceLoc asLocation() const {
@@ -506,7 +507,7 @@ class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
public:
PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
StringRef s, bool addPosRange = true,
- StackHintGenerator *stackHint = 0)
+ StackHintGenerator *stackHint = nullptr)
: PathDiagnosticSpotPiece(pos, s, Event, addPosRange),
CallStackHint(stackHint) {}
@@ -546,11 +547,11 @@ public:
class PathDiagnosticCallPiece : public PathDiagnosticPiece {
PathDiagnosticCallPiece(const Decl *callerD,
const PathDiagnosticLocation &callReturnPos)
- : PathDiagnosticPiece(Call), Caller(callerD), Callee(0),
+ : PathDiagnosticPiece(Call), Caller(callerD), Callee(nullptr),
NoExit(false), callReturn(callReturnPos) {}
PathDiagnosticCallPiece(PathPieces &oldPath, const Decl *caller)
- : PathDiagnosticPiece(Call), Caller(caller), Callee(0),
+ : PathDiagnosticPiece(Call), Caller(caller), Callee(nullptr),
NoExit(true), path(oldPath) {}
const Decl *Caller;
diff --git a/include/clang/StaticAnalyzer/Core/Checker.h b/include/clang/StaticAnalyzer/Core/Checker.h
index be1e9cf02f..b9a5b8a27f 100644
--- a/include/clang/StaticAnalyzer/Core/Checker.h
+++ b/include/clang/StaticAnalyzer/Core/Checker.h
@@ -526,7 +526,7 @@ template <typename EVENT>
class EventDispatcher {
CheckerManager *Mgr;
public:
- EventDispatcher() : Mgr(0) { }
+ EventDispatcher() : Mgr(nullptr) { }
template <typename CHECKER>
static void _register(CHECKER *checker, CheckerManager &mgr) {
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
index 2c799c0db4..08905fdf07 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -79,9 +79,9 @@ class BasicValueFactory {
const llvm::APSInt& getValue(uint64_t X, unsigned BitWidth, bool isUnsigned);
public:
- BasicValueFactory(ASTContext &ctx, llvm::BumpPtrAllocator& Alloc)
- : Ctx(ctx), BPAlloc(Alloc), PersistentSVals(0), PersistentSValPairs(0),
- SValListFactory(Alloc) {}
+ BasicValueFactory(ASTContext &ctx, llvm::BumpPtrAllocator &Alloc)
+ : Ctx(ctx), BPAlloc(Alloc), PersistentSVals(nullptr),
+ PersistentSValPairs(nullptr), SValListFactory(Alloc) {}
~BasicValueFactory();
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
index abb9519d11..0408070e49 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
@@ -33,7 +33,7 @@ class BlockCounter {
BlockCounter(void *D) : Data(D) {}
public:
- BlockCounter() : Data(0) {}
+ BlockCounter() : Data(nullptr) {}
unsigned getNumVisited(const StackFrameContext *CallSite,
unsigned BlockID) const;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index d347be0955..028875d327 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -86,15 +86,15 @@ class RuntimeDefinition {
const MemRegion *R;
public:
- RuntimeDefinition(): D(0), R(0) {}
- RuntimeDefinition(const Decl *InD): D(InD), R(0) {}
+ RuntimeDefinition(): D(nullptr), R(nullptr) {}
+ RuntimeDefinition(const Decl *InD): D(InD), R(nullptr) {}
RuntimeDefinition(const Decl *InD, const MemRegion *InR): D(InD), R(InR) {}
const Decl *getDecl() { return D; }
/// \brief Check if the definition we have is precise.
/// If not, it is possible that the call dispatches to another definition at
/// execution time.
- bool mayHaveOtherDefinitions() { return R != 0; }
+ bool mayHaveOtherDefinitions() { return R != nullptr; }
/// When other definitions are possible, returns the region whose runtime type
/// determines the method definition.
@@ -237,7 +237,7 @@ public:
/// \brief Returns the expression associated with a given argument.
/// May be null if this expression does not appear in the source.
- virtual const Expr *getArgExpr(unsigned Index) const { return 0; }
+ virtual const Expr *getArgExpr(unsigned Index) const { return nullptr; }
/// \brief Returns the source range for errors associated with this argument.
///
@@ -293,20 +293,20 @@ public:
const IdentifierInfo *getCalleeIdentifier() const {
const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(getDecl());
if (!ND)
- return 0;
+ return nullptr;
return ND->getIdentifier();
}
/// \brief Returns an appropriate ProgramPoint for this call.
ProgramPoint getProgramPoint(bool IsPreVisit = false,
- const ProgramPointTag *Tag = 0) const;
+ const ProgramPointTag *Tag = nullptr) const;
/// \brief Returns a new state with all argument regions invalidated.
///
/// This accepts an alternate state in case some processing has already
/// occurred.
ProgramStateRef invalidateRegions(unsigned BlockCount,
- ProgramStateRef Orig = 0) const;
+ ProgramStateRef Orig = nullptr) const;
typedef std::pair<Loc, SVal> FrameBindingTy;
typedef SmallVectorImpl<FrameBindingTy> BindingsTy;
@@ -493,7 +493,7 @@ public:
const BlockDecl *getDecl() const override {
const BlockDataRegion *BR = getBlockRegion();
if (!BR)
- return 0;
+ return nullptr;
return BR->getDecl();
}
@@ -535,7 +535,7 @@ protected:
public:
/// \brief Returns the expression representing the implicit 'this' object.
- virtual const Expr *getCXXThisExpr() const { return 0; }
+ virtual const Expr *getCXXThisExpr() const { return nullptr; }
/// \brief Returns the value of the implicit 'this' object.
virtual SVal getCXXThisVal() const;
@@ -764,7 +764,7 @@ public:
const Expr *getArgExpr(unsigned Index) const override {
// The first argument of an allocator call is the size of the allocation.
if (Index == 0)
- return 0;
+ return nullptr;
return getOriginExpr()->getPlacementArg(Index - 1);
}
@@ -797,7 +797,7 @@ protected:
ObjCMethodCall(const ObjCMessageExpr *Msg, ProgramStateRef St,
const LocationContext *LCtx)
: CallEvent(Msg, St, LCtx) {
- Data = 0;
+ Data = nullptr;
}
ObjCMethodCall(const ObjCMethodCall &Other) : CallEvent(Other) {}
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index 0b9762ac42..143eb95aaa 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -183,7 +183,7 @@ public:
ProgramPoint L = N->getLocation();
if (Optional<PostStore> PSL = L.getAs<PostStore>())
return reinterpret_cast<const MemRegion*>(PSL->getLocationValue());
- return 0;
+ return nullptr;
}
/// \brief Get the value of arbitrary expressions at this point in the path.
@@ -200,9 +200,9 @@ public:
/// tag is specified, a default tag, unique to the given checker,
/// will be used. Tags are used to prevent states generated at
/// different sites from caching out.
- ExplodedNode *addTransition(ProgramStateRef State = 0,
- const ProgramPointTag *Tag = 0) {
- return addTransitionImpl(State ? State : getState(), false, 0, Tag);
+ ExplodedNode *addTransition(ProgramStateRef State = nullptr,
+ const ProgramPointTag *Tag = nullptr) {
+ return addTransitionImpl(State ? State : getState(), false, nullptr, Tag);
}
/// \brief Generates a new transition with the given predecessor.
@@ -214,15 +214,15 @@ public:
/// @param Tag The tag to uniquely identify the creation site.
ExplodedNode *addTransition(ProgramStateRef State,
ExplodedNode *Pred,
- const ProgramPointTag *Tag = 0) {
+ const ProgramPointTag *Tag = nullptr) {
return addTransitionImpl(State, false, Pred, Tag);
}
/// \brief Generate a sink node. Generating a sink stops exploration of the
/// given path.
- ExplodedNode *generateSink(ProgramStateRef State = 0,
- ExplodedNode *Pred = 0,
- const ProgramPointTag *Tag = 0) {
+ ExplodedNode *generateSink(ProgramStateRef State = nullptr,
+ ExplodedNode *Pred = nullptr,
+ const ProgramPointTag *Tag = nullptr) {
return addTransitionImpl(State ? State : getState(), true, Pred, Tag);
}
@@ -244,7 +244,7 @@ public:
if (FunDecl)
return FunDecl->getIdentifier();
else
- return 0;
+ return nullptr;
}
/// \brief Get the name of the called function (path-sensitive).
@@ -280,8 +280,8 @@ public:
private:
ExplodedNode *addTransitionImpl(ProgramStateRef State,
bool MarkAsSink,
- ExplodedNode *P = 0,
- const ProgramPointTag *Tag = 0) {
+ ExplodedNode *P = nullptr,
+ const ProgramPointTag *Tag = nullptr) {
if (!State || (State == Pred->getState() && !Tag && !MarkAsSink))
return Pred;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
index 1e76ea6ed6..51bb89b9e1 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
@@ -85,7 +85,7 @@ public:
// does not. Is there a good equivalent there?
assert(assume(State, Cond, false) && "System is over constrained.");
#endif
- return ProgramStatePair((ProgramStateRef)NULL, State);
+ return ProgramStatePair((ProgramStateRef)nullptr, State);
}
ProgramStateRef StFalse = assume(State, Cond, false);
@@ -93,7 +93,7 @@ public:
// We are careful to return the original state, /not/ StTrue,
// because we want to avoid having callers generate a new node
// in the ExplodedGraph.
- return ProgramStatePair(State, (ProgramStateRef)NULL);
+ return ProgramStatePair(State, (ProgramStateRef)nullptr);
}
return ProgramStatePair(StTrue, StFalse);
@@ -106,7 +106,7 @@ public:
/// value for a symbol, even if it is perfectly constrained.
virtual const llvm::APSInt* getSymVal(ProgramStateRef state,
SymbolRef sym) const {
- return 0;
+ return nullptr;
}
virtual ProgramStateRef removeDeadBindings(ProgramStateRef state,
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 14a0417b7e..76ace6d7cc 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -324,13 +324,13 @@ public:
ExplodedNode *generateNode(ProgramStateRef State,
ExplodedNode *Pred,
- const ProgramPointTag *Tag = 0) {
+ const ProgramPointTag *Tag = nullptr) {
const ProgramPoint &LocalLoc = (Tag ? Location.withTag(Tag) : Location);
return NodeBuilder::generateNode(LocalLoc, State, Pred);
}
ExplodedNode *generateSink(ProgramStateRef State, ExplodedNode *Pred,
- const ProgramPointTag *Tag = 0) {
+ const ProgramPointTag *Tag = nullptr) {
const ProgramPoint &LocalLoc = (Tag ? Location.withTag(Tag) : Location);
ExplodedNode *N = NodeBuilder::generateSink(LocalLoc, State, Pred);
if (N && N->isSink())
@@ -355,14 +355,16 @@ public:
/// nodes currently owned by another builder(with larger scope), use
/// Enclosing builder to transfer ownership.
StmtNodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet,
- const NodeBuilderContext &Ctx, NodeBuilder *Enclosing = 0)
+ const NodeBuilderContext &Ctx,
+ NodeBuilder *Enclosing = nullptr)
: NodeBuilder(SrcNode, DstSet, Ctx), EnclosingBldr(Enclosing) {
if (EnclosingBldr)
EnclosingBldr->takeNodes(SrcNode);
}
StmtNodeBuilder(ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet,
- const NodeBuilderContext &Ctx, NodeBuilder *Enclosing = 0)
+ const NodeBuilderContext &Ctx,
+ NodeBuilder *Enclosing = nullptr)
: NodeBuilder(SrcSet, DstSet, Ctx), EnclosingBldr(Enclosing) {
if (EnclosingBldr)
for (ExplodedNodeSet::iterator I = SrcSet.begin(),
@@ -378,7 +380,7 @@ public:
ExplodedNode *generateNode(const Stmt *S,
ExplodedNode *Pred,
ProgramStateRef St,
- const ProgramPointTag *tag = 0,
+ const ProgramPointTag *tag = nullptr,
ProgramPoint::Kind K = ProgramPoint::PostStmtKind){
const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
Pred->getLocationContext(), tag);
@@ -388,7 +390,7 @@ public:
ExplodedNode *generateSink(const Stmt *S,
ExplodedNode *Pred,
ProgramStateRef St,
- const ProgramPointTag *tag = 0,
+ const ProgramPointTag *tag = nullptr,
ProgramPoint::Kind K = ProgramPoint::PostStmtKind){
const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
Pred->getLocationContext(), tag);
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
index 706081ea13..d0a2780d25 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -189,7 +189,7 @@ public:
}
ExplodedNode *getFirstPred() {
- return pred_empty() ? NULL : *(pred_begin());
+ return pred_empty() ? nullptr : *(pred_begin());
}
const ExplodedNode *getFirstPred() const {
@@ -197,7 +197,7 @@ public:
}
const ExplodedNode *getFirstSucc() const {
- return succ_empty() ? NULL : *(succ_begin());
+ return succ_empty() ? nullptr : *(succ_begin());
}
// Iterators over successor and predecessor vertices.
@@ -295,7 +295,7 @@ public:
/// the node was freshly created.
ExplodedNode *getNode(const ProgramPoint &L, ProgramStateRef State,
bool IsSink = false,
- bool* IsNew = 0);
+ bool* IsNew = nullptr);
ExplodedGraph* MakeEmptyGraph() const {
return new ExplodedGraph();
@@ -373,8 +373,8 @@ public:
/// nodes in this graph.
/// \returns The trimmed graph
ExplodedGraph *trim(ArrayRef<const NodeTy *> Nodes,
- InterExplodedGraphMap *ForwardMap = 0,
- InterExplodedGraphMap *InverseMap = 0) const;
+ InterExplodedGraphMap *ForwardMap = nullptr,
+ InterExplodedGraphMap *InverseMap = nullptr) const;
/// Enable tracking of recently allocated nodes for potential reclamation
/// when calling reclaimRecentlyAllocatedNodes().
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
index 2fbe565730..0fb4a24591 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -106,7 +106,7 @@ public:
/// Returns true if there is still simulation state on the worklist.
bool ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) {
- return Engine.ExecuteWorkList(L, Steps, 0);
+ return Engine.ExecuteWorkList(L, Steps, nullptr);
}
/// Execute the work list with an initial state. Nodes that reaches the exit
@@ -186,7 +186,7 @@ public:
/// and \p ReferenceStmt must be valid (non-null).
void removeDead(ExplodedNode *Node, ExplodedNodeSet &Out,
const Stmt *ReferenceStmt, const LocationContext *LC,
- const Stmt *DiagnosticStmt = 0,
+ const Stmt *DiagnosticStmt = nullptr,
ProgramPoint::Kind K = ProgramPoint::PreStmtPurgeDeadSymbolsKind);
/// processCFGElement - Called by CoreEngine. Used to generate new successor
@@ -477,7 +477,7 @@ protected:
/// This method is used by evalStore, VisitDeclStmt, and others.
void evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred,
SVal location, SVal Val, bool atDeclInit = false,
- const ProgramPoint *PP = 0);
+ const ProgramPoint *PP = nullptr);
/// Call PointerEscape callback when a value escapes as a result of bind.
ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State,
@@ -506,14 +506,14 @@ public:
ExplodedNode *Pred,
ProgramStateRef St,
SVal location,
- const ProgramPointTag *tag = 0,
+ const ProgramPointTag *tag = nullptr,
QualType LoadTy = QualType());
// FIXME: 'tag' should be removed, and a LocationContext should be used
// instead.
void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE,
ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val,
- const ProgramPointTag *tag = 0);
+ const ProgramPointTag *tag = nullptr);
/// \brief Create a new state in which the call return value is binded to the
/// call origin expression.
@@ -586,7 +586,7 @@ private:
ProgramStateRef createTemporaryRegionIfNeeded(ProgramStateRef State,
const LocationContext *LC,
const Expr *E,
- const Expr *ResultE = 0);
+ const Expr *ResultE = nullptr);
};
/// Traits for storing the call processing policy inside GDM.
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
index e3173a08d9..92b082d521 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -54,7 +54,7 @@ public:
// Visual Studio will only create enumerations of size int, not long long.
static const int64_t Symbolic = INT64_MAX;
- RegionOffset() : R(0) {}
+ RegionOffset() : R(nullptr) {}
RegionOffset(const MemRegion *r, int64_t off) : R(r), Offset(off) {}
const MemRegion *getRegion() const { return R; }
@@ -640,7 +640,7 @@ class BlockDataRegion : public TypedRegion {
unsigned count, const MemRegion *sreg)
: TypedRegion(sreg, BlockDataRegionKind), BC(bc), LC(lc),
BlockCount(count),
- ReferencedVars(0), OriginalVars(0) {}
+ ReferencedVars(nullptr), OriginalVars(nullptr) {}
public:
const BlockTextRegion *getCodeRegion() const { return BC; }
@@ -665,11 +665,11 @@ public:
}
bool operator==(const referenced_vars_iterator &I) const {
- assert((R == 0) == (I.R == 0));
+ assert((R == nullptr) == (I.R == nullptr));
return I.R == R;
}
bool operator!=(const referenced_vars_iterator &I) const {
- assert((R == 0) == (I.R == 0));
+ assert((R == nullptr) == (I.R == nullptr));
return I.R != R;
}
referenced_vars_iterator &operator++() {
@@ -1111,7 +1111,7 @@ const RegionTy* MemRegion::getAs() const {
if (const RegionTy* RT = dyn_cast<RegionTy>(this))
return RT;
- return NULL;
+ return nullptr;
}
//===----------------------------------------------------------------------===//
@@ -1140,9 +1140,10 @@ class MemRegionManager {
MemSpaceRegion *code;
public:
- MemRegionManager(ASTContext &c, llvm::BumpPtrAllocator& a)
- : C(c), A(a), InternalGlobals(0), SystemGlobals(0), ImmutableGlobals(0),
- heap(0), unknown(0), code(0) {}
+ MemRegionManager(ASTContext &c, llvm::BumpPtrAllocator &a)
+ : C(c), A(a), InternalGlobals(nullptr), SystemGlobals(nullptr),
+ ImmutableGlobals(nullptr), heap(nullptr), unknown(nullptr),
+ code(nullptr) {}
~MemRegionManager();
@@ -1164,7 +1165,7 @@ public:
/// global variables.
const GlobalsSpaceRegion *getGlobalsRegion(
MemRegion::Kind K = MemRegion::GlobalInternalSpaceRegionKind,
- const CodeTextRegion *R = 0);
+ const CodeTextRegion *R = nullptr);
/// getHeapRegion - Retrieve the memory region associated with the
/// generic "heap".
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
index 4d345eba98..4902ef50c7 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
@@ -237,16 +237,16 @@ public:
ProgramStateRef
invalidateRegions(ArrayRef<const MemRegion *> Regions, const Expr *E,
unsigned BlockCount, const LocationContext *LCtx,
- bool CausesPointerEscape, InvalidatedSymbols *IS = 0,
- const CallEvent *Call = 0,
- RegionAndSymbolInvalidationTraits *ITraits = 0) const;
+ bool CausesPointerEscape, InvalidatedSymbols *IS = nullptr,
+ const CallEvent *Call = nullptr,
+ RegionAndSymbolInvalidationTraits *ITraits = nullptr) const;
ProgramStateRef
invalidateRegions(ArrayRef<SVal> Regions, const Expr *E,
unsigned BlockCount, const LocationContext *LCtx,
- bool CausesPointerEscape, InvalidatedSymbols *IS = 0,
- const CallEvent *Call = 0,
- RegionAndSymbolInvalidationTraits *ITraits = 0) const;
+ bool CausesPointerEscape, InvalidatedSymbols *IS = nullptr,
+ const CallEvent *Call = nullptr,
+ RegionAndSymbolInvalidationTraits *ITraits = nullptr) const;
/// enterStackFrame - Returns the state for entry to the given stack frame,
/// preserving the current state.
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
index 88098eee8a..823bde798e 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
@@ -64,7 +64,8 @@ namespace ento {
typedef const value_type* lookup_type;
static inline data_type MakeData(void *const* p) {
- return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
+ return p ? data_type((typename data_type::TreeTy*) *p)
+ : data_type(nullptr);
}
static inline void *MakeVoidPtr(data_type B) {
return B.getRoot();
@@ -112,7 +113,8 @@ namespace ento {
typedef Key key_type;
static inline data_type MakeData(void *const* p) {
- return p ? data_type((typename data_type::TreeTy*) *p) : data_type(0);
+ return p ? data_type((typename data_type::TreeTy*) *p)
+ : data_type(nullptr);
}
static inline void *MakeVoidPtr(data_type B) {
@@ -163,7 +165,7 @@ namespace ento {
static inline data_type MakeData(void *const* p) {
return p ? data_type((const llvm::ImmutableListImpl<T>*) *p)
- : data_type(0);
+ : data_type(nullptr);
}
static inline void *MakeVoidPtr(data_type D) {
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
index 5da1dd9e77..29fb413d1c 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -146,14 +146,14 @@ public:
const LocationContext *LCtx,
QualType type,
unsigned visitCount,
- const void *symbolTag = 0) {
+ const void *symbolTag = nullptr) {
return SymMgr.conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
}
const SymbolConjured* conjureSymbol(const Expr *expr,
const LocationContext *LCtx,
unsigned visitCount,
- const void *symbolTag = 0) {
+ const void *symbolTag = nullptr) {
return SymMgr.conjureSymbol(expr, LCtx, visitCount, symbolTag);
}
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index 5a426ef001..d50c3be4bf 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -63,11 +63,11 @@ protected:
explicit SVal(const void *d, bool isLoc, unsigned ValKind)
: Data(d), Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {}
- explicit SVal(BaseKind k, const void *D = NULL)
+ explicit SVal(BaseKind k, const void *D = nullptr)
: Data(D), Kind(k) {}
public:
- explicit SVal() : Data(0), Kind(0) {}
+ explicit SVal() : Data(nullptr), Kind(0) {}
/// \brief Convert to the specified SVal type, asserting that this SVal is of
/// the desired type.
@@ -211,7 +211,7 @@ protected:
explicit DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind)
: SVal(d, isLoc, ValKind) {}
- explicit DefinedOrUnknownSVal(BaseKind k, void *D = NULL)
+ explicit DefinedOrUnknownSVal(BaseKind k, void *D = nullptr)
: SVal(k, D) {}
private:
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
index a6da2e1e34..84c3166121 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
@@ -220,7 +220,8 @@ public:
bool First;
public:
- FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {}
+ FindUniqueBinding(SymbolRef sym)
+ : Sym(sym), Binding(nullptr), First(true) {}
bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
SVal val) override;
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
index f653c70a30..3482e8d27d 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
@@ -122,7 +122,7 @@ public:
inline ProgramStateRef
processRegionChange(ProgramStateRef state,
const MemRegion* MR) {
- return processRegionChanges(state, 0, MR, MR, 0);
+ return processRegionChanges(state, nullptr, MR, MR, nullptr);
}
virtual ProgramStateRef
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
index e491fb0328..2b5cc18c9a 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
@@ -498,12 +498,12 @@ public:
const LocationContext *LCtx,
QualType T,
unsigned VisitCount,
- const void *SymbolTag = 0);
+ const void *SymbolTag = nullptr);
const SymbolConjured* conjureSymbol(const Expr *E,
const LocationContext *LCtx,
unsigned VisitCount,
- const void *SymbolTag = 0) {
+ const void *SymbolTag = nullptr) {
return conjureSymbol(E, LCtx, E->getType(), VisitCount, SymbolTag);
}
@@ -516,9 +516,9 @@ public:
///
/// VisitCount can be used to differentiate regions corresponding to
/// different loop iterations, thus, making the symbol path-dependent.
- const SymbolMetadata* getMetadataSymbol(const MemRegion* R, const Stmt *S,
+ const SymbolMetadata *getMetadataSymbol(const MemRegion *R, const Stmt *S,
QualType T, unsigned VisitCount,
- const void *SymbolTag = 0);
+ const void *SymbolTag = nullptr);
const SymbolCast* getCastSymbol(const SymExpr *Operand,
QualType From, QualType To);
@@ -587,7 +587,7 @@ public:
SymbolReaper(const StackFrameContext *Ctx, const Stmt *s, SymbolManager& symmgr,
StoreManager &storeMgr)
: LCtx(Ctx), Loc(s), SymMgr(symmgr),
- reapedStore(0, storeMgr) {}
+ reapedStore(nullptr, storeMgr) {}
~SymbolReaper() {}
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
index d12a151489..3ed145dbd2 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
@@ -42,7 +42,7 @@ public:
explicit WorkListUnit(ExplodedNode *N, BlockCounter C)
: node(N),
counter(C),
- block(NULL),
+ block(nullptr),
blockIdx(0) {}
/// Returns the node associated with the worklist unit.
diff --git a/include/clang/Tooling/CommonOptionsParser.h b/include/clang/Tooling/CommonOptionsParser.h
index 1f32cd82cf..cc4f8df136 100644
--- a/include/clang/Tooling/CommonOptionsParser.h
+++ b/include/clang/Tooling/CommonOptionsParser.h
@@ -72,7 +72,7 @@ public:
/// This constructor exits program in case of error.
CommonOptionsParser(int &argc, const char **argv,
llvm::cl::OptionCategory &Category,
- const char *Overview = 0);
+ const char *Overview = nullptr);
/// Returns a reference to the loaded compilations database.
CompilationDatabase &getCompilations() {
diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h
index a0d6cb789c..769acd3253 100644
--- a/include/clang/Tooling/Tooling.h
+++ b/include/clang/Tooling/Tooling.h
@@ -130,7 +130,7 @@ public:
/// newFrontendActionFactory(&Factory));
template <typename FactoryT>
inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
- FactoryT *ConsumerFactory, SourceFileCallbacks *Callbacks = NULL);
+ FactoryT *ConsumerFactory, SourceFileCallbacks *Callbacks = nullptr);
/// \brief Runs (and deletes) the tool on 'Code' with the -fsyntax-only flag.
///
@@ -345,12 +345,12 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
StringRef Filename) override {
if (!clang::ASTFrontendAction::BeginSourceFileAction(CI, Filename))
return false;
- if (Callbacks != NULL)
+ if (Callbacks)
return Callbacks->handleBeginSource(CI, Filename);
return true;
}
void EndSourceFileAction() override {
- if (Callbacks != NULL)
+ if (Callbacks)
Callbacks->handleEndSource();
clang::ASTFrontendAction::EndSourceFileAction();
}