r210448 - [C++11] Use 'nullptr'.
Craig Topper
craig.topper at gmail.com
Sun Jun 8 19:04:03 PDT 2014
Author: ctopper
Date: Sun Jun 8 21:04:02 2014
New Revision: 210448
URL: http://llvm.org/viewvc/llvm-project?rev=210448&view=rev
Log:
[C++11] Use 'nullptr'.
Modified:
cfe/trunk/include/clang/Sema/SemaInternal.h
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/MicrosoftRTTI.cpp
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/include/clang/Sema/SemaInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/SemaInternal.h?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/SemaInternal.h (original)
+++ cfe/trunk/include/clang/Sema/SemaInternal.h Sun Jun 8 21:04:02 2014
@@ -27,8 +27,8 @@ inline PartialDiagnostic Sema::PDiag(uns
inline bool
FTIHasSingleVoidParameter(const DeclaratorChunk::FunctionTypeInfo &FTI) {
- return FTI.NumParams == 1 && !FTI.isVariadic && FTI.Params[0].Ident == 0 &&
- FTI.Params[0].Param &&
+ return FTI.NumParams == 1 && !FTI.isVariadic &&
+ FTI.Params[0].Ident == nullptr && FTI.Params[0].Param &&
cast<ParmVarDecl>(FTI.Params[0].Param)->getType()->isVoidType();
}
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sun Jun 8 21:04:02 2014
@@ -2276,7 +2276,7 @@ static const Expr *isSimpleArrayDecayOpe
// If this isn't just an array->pointer decay, bail out.
const auto *CE = dyn_cast<CastExpr>(E);
if (!CE || CE->getCastKind() != CK_ArrayToPointerDecay)
- return 0;
+ return nullptr;
// If this is a decay from variable width array, bail out.
const Expr *SubExpr = CE->getSubExpr();
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Jun 8 21:04:02 2014
@@ -563,7 +563,7 @@ void CodeGenModule::AddGlobalCtor(llvm::
/// when the module is unloaded.
void CodeGenModule::AddGlobalDtor(llvm::Function *Dtor, int Priority) {
// FIXME: Type coercion of void()* types.
- GlobalDtors.push_back(Structor(Priority, Dtor, 0));
+ GlobalDtors.push_back(Structor(Priority, Dtor, nullptr));
}
void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
Modified: cfe/trunk/lib/CodeGen/MicrosoftRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftRTTI.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftRTTI.cpp Sun Jun 8 21:04:02 2014
@@ -117,7 +117,7 @@ static llvm::GlobalVariable *getTypeInfo
return new llvm::GlobalVariable(CGM.getModule(), CGM.Int8PtrTy,
/*Constant=*/true,
llvm::GlobalVariable::ExternalLinkage,
- /*Initializer=*/0, MangledName);
+ /*Initializer=*/nullptr, MangledName);
}
namespace {
@@ -154,7 +154,7 @@ uint32_t MSRTTIClass::initialize(const M
const CXXBaseSpecifier *Specifier) {
Flags = HasHierarchyDescriptor;
if (!Parent) {
- VirtualRoot = 0;
+ VirtualRoot = nullptr;
OffsetInVBase = 0;
} else {
if (Specifier->getAccessSpecifier() != AS_public)
@@ -259,7 +259,7 @@ llvm::GlobalVariable *MSRTTIBuilder::get
// Serialize the class hierarchy and initialize the CHD Fields.
SmallVector<MSRTTIClass, 8> Classes;
serializeClassHierarchy(Classes, RD);
- Classes.front().initialize(/*Parent=*/0, /*Specifier=*/0);
+ Classes.front().initialize(/*Parent=*/nullptr, /*Specifier=*/nullptr);
detectAmbiguousBases(Classes);
int Flags = 0;
for (auto Class : Classes) {
@@ -280,7 +280,8 @@ llvm::GlobalVariable *MSRTTIBuilder::get
// Forward-declare the class hierarchy descriptor
auto Type = getClassHierarchyDescriptorType(CGM);
auto CHD = new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage,
- /*Initializer=*/0, MangledName.c_str());
+ /*Initializer=*/nullptr,
+ MangledName.c_str());
// Initialize the base class ClassHierarchyDescriptor.
llvm::Constant *Fields[] = {
@@ -310,7 +311,7 @@ MSRTTIBuilder::getBaseClassArray(SmallVe
auto PtrType = getBaseClassDescriptorType(CGM)->getPointerTo();
auto ArrayType = llvm::ArrayType::get(PtrType, Classes.size() + 1);
auto BCA = new llvm::GlobalVariable(Module, ArrayType,
- /*Constant=*/true, Linkage, /*Initializer=*/0, MangledName.c_str());
+ /*Constant=*/true, Linkage, /*Initializer=*/nullptr, MangledName.c_str());
// Initialize the BaseClassArray.
SmallVector<llvm::Constant *, 8> BaseClassArrayData;
@@ -348,7 +349,8 @@ MSRTTIBuilder::getBaseClassDescriptor(co
// Forward-declare the base class descriptor.
auto Type = getBaseClassDescriptorType(CGM);
auto BCD = new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage,
- /*Initializer=*/0, MangledName.c_str());
+ /*Initializer=*/nullptr,
+ MangledName.c_str());
// Initialize the BaseClassDescriptor.
llvm::Constant *Fields[] = {
@@ -389,7 +391,7 @@ MSRTTIBuilder::getCompleteObjectLocator(
// Forward-declare the complete object locator.
llvm::StructType *Type = getCompleteObjectLocatorType(CGM);
auto COL = new llvm::GlobalVariable(Module, Type, /*Constant=*/true, Linkage,
- /*Initializer=*/0, MangledName.c_str());
+ /*Initializer=*/nullptr, MangledName.c_str());
// Initialize the CompleteObjectLocator.
llvm::Constant *Fields[] = {
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Sun Jun 8 21:04:02 2014
@@ -835,7 +835,7 @@ private:
/// \brief Determine whether ')' is ending a cast.
bool rParenEndsCast(const FormatToken &Tok) {
- FormatToken *LeftOfParens = NULL;
+ FormatToken *LeftOfParens = nullptr;
if (Tok.MatchingParen)
LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
bool IsCast = false;
@@ -858,8 +858,9 @@ private:
IsCast = true;
// If there is an identifier after the (), it is likely a cast, unless
// there is also an identifier before the ().
- else if (LeftOfParens && (LeftOfParens->Tok.getIdentifierInfo() == NULL ||
- LeftOfParens->is(tok::kw_return)) &&
+ else if (LeftOfParens &&
+ (LeftOfParens->Tok.getIdentifierInfo() == nullptr ||
+ LeftOfParens->is(tok::kw_return)) &&
LeftOfParens->Type != TT_OverloadedOperator &&
LeftOfParens->isNot(tok::at) &&
LeftOfParens->Type != TT_TemplateCloser && Tok.Next) {
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Sun Jun 8 21:04:02 2014
@@ -60,7 +60,7 @@ Preprocessor::Preprocessor(IntrusiveRefC
ModuleLoader &TheModuleLoader,
IdentifierInfoLookup *IILookup, bool OwnsHeaders,
TranslationUnitKind TUKind)
- : PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(0),
+ : PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(nullptr),
FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers),
TheModuleLoader(TheModuleLoader), ExternalSource(nullptr),
Identifiers(opts, IILookup), IncrementalProcessing(false), TUKind(TUKind),
@@ -70,7 +70,7 @@ Preprocessor::Preprocessor(IntrusiveRefC
SkipMainFilePreamble(0, true), CurPPLexer(nullptr),
CurDirLookup(nullptr), CurLexerKind(CLK_Lexer), CurSubmodule(nullptr),
Callbacks(nullptr), MacroArgCache(nullptr), Record(nullptr),
- MIChainHead(nullptr), MICache(nullptr), DeserialMIChainHead(0) {
+ MIChainHead(nullptr), MICache(nullptr), DeserialMIChainHead(nullptr) {
OwnsHeaderSearch = OwnsHeaders;
ScratchBuf = new ScratchBuffer(SourceMgr);
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Sun Jun 8 21:04:02 2014
@@ -1766,8 +1766,8 @@ StmtResult Parser::ParsePragmaLoopHint(S
ArgsUnion ArgHints[] = {Hint.OptionLoc, Hint.ValueLoc,
ArgsUnion(Hint.ValueExpr)};
// FIXME: Replace AS_Keyword with Pragma spelling AS_Pragma.
- TempAttrs.addNew(Hint.LoopLoc->Ident, Hint.Range, 0, Hint.LoopLoc->Loc,
- ArgHints, 3, AttributeList::AS_Keyword);
+ TempAttrs.addNew(Hint.LoopLoc->Ident, Hint.Range, nullptr,
+ Hint.LoopLoc->Loc, ArgHints, 3, AttributeList::AS_Keyword);
}
// Get the next statement.
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Sun Jun 8 21:04:02 2014
@@ -178,7 +178,7 @@ DeclaratorChunk DeclaratorChunk::getFunc
I.Kind = Function;
I.Loc = LocalRangeBegin;
I.EndLoc = LocalRangeEnd;
- I.Fun.AttrList = 0;
+ I.Fun.AttrList = nullptr;
I.Fun.hasPrototype = hasProto;
I.Fun.isVariadic = EllipsisLoc.isValid();
I.Fun.isAmbiguous = isAmbiguous;
@@ -188,7 +188,7 @@ DeclaratorChunk DeclaratorChunk::getFunc
I.Fun.DeleteParams = false;
I.Fun.TypeQuals = TypeQuals;
I.Fun.NumParams = NumParams;
- I.Fun.Params = 0;
+ I.Fun.Params = nullptr;
I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
I.Fun.ConstQualifierLoc = ConstQualifierLoc.getRawEncoding();
@@ -197,8 +197,8 @@ DeclaratorChunk DeclaratorChunk::getFunc
I.Fun.ExceptionSpecType = ESpecType;
I.Fun.ExceptionSpecLoc = ESpecLoc.getRawEncoding();
I.Fun.NumExceptions = 0;
- I.Fun.Exceptions = 0;
- I.Fun.NoexceptExpr = 0;
+ I.Fun.Exceptions = nullptr;
+ I.Fun.NoexceptExpr = nullptr;
I.Fun.HasTrailingReturnType = TrailingReturnType.isUsable() ||
TrailingReturnType.isInvalid();
I.Fun.TrailingReturnType = TrailingReturnType.get();
@@ -657,7 +657,7 @@ bool DeclSpec::SetTypeSpecType(TST T, So
DeclRep = Rep;
TSTLoc = TagKwLoc;
TSTNameLoc = TagNameLoc;
- TypeSpecOwned = Owned && Rep != 0;
+ TypeSpecOwned = Owned && Rep != nullptr;
return false;
}
@@ -1169,7 +1169,7 @@ void DeclSpec::Finish(DiagnosticsEngine
bool DeclSpec::isMissingDeclaratorOk() {
TST tst = getTypeSpecType();
- return isDeclRep(tst) && getRepAsDecl() != 0 &&
+ return isDeclRep(tst) && getRepAsDecl() != nullptr &&
StorageClassSpec != DeclSpec::SCS_typedef;
}
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Sun Jun 8 21:04:02 2014
@@ -1032,7 +1032,7 @@ bool OpenMPIterationSpaceChecker::CheckI
/// variable (which may be the loop variable) if possible.
static const VarDecl *GetInitVarDecl(const Expr *E) {
if (!E)
- return 0;
+ return nullptr;
E = E->IgnoreParenImpCasts();
if (auto *CE = dyn_cast_or_null<CXXConstructExpr>(E))
if (const CXXConstructorDecl *Ctor = CE->getConstructor())
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=210448&r1=210447&r2=210448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sun Jun 8 21:04:02 2014
@@ -5127,7 +5127,7 @@ static bool hasVisibleDefinition(Sema &S
ED = NewED;
if (ED->isFixed()) {
// If the enum has a fixed underlying type, any declaration of it will do.
- *Suggested = 0;
+ *Suggested = nullptr;
for (auto *Redecl : ED->redecls()) {
if (LookupResult::isVisible(S, Redecl))
return true;
@@ -5162,7 +5162,7 @@ bool Sema::RequireCompleteTypeImpl(Sourc
NamedDecl *Def = nullptr;
if (!T->isIncompleteType(&Def)) {
// If we know about the definition but it is not visible, complain.
- NamedDecl *SuggestedDef = 0;
+ NamedDecl *SuggestedDef = nullptr;
if (!Diagnoser.Suppressed && Def &&
!hasVisibleDefinition(*this, Def, &SuggestedDef)) {
// Suppress this error outside of a SFINAE context if we've already
More information about the cfe-commits
mailing list