r209275 - [C++11] Use 'nullptr'. Parser edition.
Craig Topper
craig.topper at gmail.com
Tue May 20 23:02:53 PDT 2014
Author: ctopper
Date: Wed May 21 01:02:52 2014
New Revision: 209275
URL: http://llvm.org/viewvc/llvm-project?rev=209275&view=rev
Log:
[C++11] Use 'nullptr'. Parser edition.
Modified:
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseInit.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Parse/RAIIObjectsForParser.h
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Wed May 21 01:02:52 2014
@@ -35,7 +35,8 @@ NamedDecl *Parser::ParseCXXInlineMethodD
"Current token not a '{', ':', '=', or 'try'!");
MultiTemplateParamsArg TemplateParams(
- TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data() : 0,
+ TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data()
+ : nullptr,
TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
NamedDecl *FnD;
@@ -45,7 +46,7 @@ NamedDecl *Parser::ParseCXXInlineMethodD
TemplateParams);
else {
FnD = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, D,
- TemplateParams, 0,
+ TemplateParams, nullptr,
VS, ICIS_NoInit);
if (FnD) {
Actions.ProcessDeclAttributeList(getCurScope(), FnD, AccessAttrs);
@@ -65,7 +66,7 @@ NamedDecl *Parser::ParseCXXInlineMethodD
if (TryConsumeToken(tok::equal)) {
if (!FnD) {
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
bool Delete = false;
@@ -360,7 +361,7 @@ void Parser::ParseLexedMethodDeclaration
ConsumeAnyToken();
delete Toks;
- LM.DefaultArgs[I].Toks = 0;
+ LM.DefaultArgs[I].Toks = nullptr;
}
}
@@ -434,7 +435,7 @@ void Parser::ParseLexedMethodDef(LexedMe
// Error recovery.
if (!Tok.is(tok::l_brace)) {
FnScope.Exit();
- Actions.ActOnFinishFunctionBody(LM.D, 0);
+ Actions.ActOnFinishFunctionBody(LM.D, nullptr);
while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
ConsumeAnyToken();
return;
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed May 21 01:02:52 2014
@@ -53,7 +53,7 @@ TypeResult Parser::ParseTypeName(SourceR
DS.addAttributes(Attrs->getList());
ParseSpecifierQualifierList(DS, AS, DSC);
if (OwnedType)
- *OwnedType = DS.isTypeSpecOwned() ? DS.getRepAsDecl() : 0;
+ *OwnedType = DS.isTypeSpecOwned() ? DS.getRepAsDecl() : nullptr;
// Parse the abstract-declarator, if present.
Declarator DeclaratorInfo(DS, Context);
@@ -150,14 +150,14 @@ void Parser::ParseGNUAttributes(ParsedAt
SourceLocation AttrNameLoc = ConsumeToken();
if (Tok.isNot(tok::l_paren)) {
- attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_GNU);
continue;
}
// Handle "parameterized" attributes
if (!LateAttrs || !isAttributeLateParsed(*AttrName)) {
- ParseGNUAttributeArgs(AttrName, AttrNameLoc, attrs, endLoc, 0,
+ ParseGNUAttributeArgs(AttrName, AttrNameLoc, attrs, endLoc, nullptr,
SourceLocation(), AttributeList::AS_GNU, D);
continue;
}
@@ -254,11 +254,11 @@ void Parser::ParseAttributeWithTypeArg(I
if (T.isUsable())
Attrs.addNewTypeAttr(&AttrName,
- SourceRange(AttrNameLoc, Parens.getCloseLocation()), 0,
- AttrNameLoc, T.get(), AttributeList::AS_GNU);
+ SourceRange(AttrNameLoc, Parens.getCloseLocation()),
+ nullptr, AttrNameLoc, T.get(), AttributeList::AS_GNU);
else
Attrs.addNew(&AttrName, SourceRange(AttrNameLoc, Parens.getCloseLocation()),
- 0, AttrNameLoc, 0, 0, AttributeList::AS_GNU);
+ nullptr, AttrNameLoc, nullptr, 0, AttributeList::AS_GNU);
}
unsigned Parser::ParseAttributeArgsCommon(
@@ -410,7 +410,7 @@ bool Parser::ParseMicrosoftDeclSpecArgs(
AK_Put = 0,
AK_Get = 1 // indices into AccessorNames
};
- IdentifierInfo *AccessorNames[] = {0, 0};
+ IdentifierInfo *AccessorNames[] = {nullptr, nullptr};
bool HasInvalidAccessor = false;
// Parse the accessor specifications.
@@ -419,7 +419,8 @@ bool Parser::ParseMicrosoftDeclSpecArgs(
if (!Tok.is(tok::identifier)) {
// If the user wrote a completely empty list, use a special diagnostic.
if (Tok.is(tok::r_paren) && !HasInvalidAccessor &&
- AccessorNames[AK_Put] == 0 && AccessorNames[AK_Get] == 0) {
+ AccessorNames[AK_Put] == nullptr &&
+ AccessorNames[AK_Get] == nullptr) {
Diag(AttrNameLoc, diag::err_ms_property_no_getter_or_putter);
break;
}
@@ -479,7 +480,7 @@ bool Parser::ParseMicrosoftDeclSpecArgs(
if (Kind == AK_Invalid) {
// Just drop invalid accessors.
- } else if (AccessorNames[Kind] != NULL) {
+ } else if (AccessorNames[Kind] != nullptr) {
// Complain about the repeated accessor, ignore it, and keep parsing.
Diag(KindLoc, diag::err_ms_property_duplicate_accessor) << KindStr;
} else {
@@ -502,7 +503,7 @@ bool Parser::ParseMicrosoftDeclSpecArgs(
// Only add the property attribute if it was well-formed.
if (!HasInvalidAccessor)
- Attrs.addNewPropertyAttr(AttrName, AttrNameLoc, 0, SourceLocation(),
+ Attrs.addNewPropertyAttr(AttrName, AttrNameLoc, nullptr, SourceLocation(),
AccessorNames[AK_Get], AccessorNames[AK_Put],
AttributeList::AS_Declspec);
T.skipToEnd();
@@ -583,7 +584,7 @@ void Parser::ParseMicrosoftDeclSpec(Pars
<< AttrName->getName();
if (!AttrHandled)
- Attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ Attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Declspec);
}
T.consumeClose();
@@ -598,7 +599,7 @@ void Parser::ParseMicrosoftTypeAttribute
Tok.is(tok::kw___sptr) || Tok.is(tok::kw___uptr)) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
- attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Keyword);
}
}
@@ -608,7 +609,7 @@ void Parser::ParseBorlandTypeAttributes(
while (Tok.is(tok::kw___pascal)) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
- attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Keyword);
}
}
@@ -618,7 +619,7 @@ void Parser::ParseOpenCLAttributes(Parse
while (Tok.is(tok::kw___kernel)) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
- attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Keyword);
}
}
@@ -626,7 +627,7 @@ void Parser::ParseOpenCLAttributes(Parse
void Parser::ParseOpenCLQualifiers(ParsedAttributes &Attrs) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = Tok.getLocation();
- Attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ Attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Keyword);
}
@@ -900,7 +901,7 @@ void Parser::ParseAvailabilityAttribute(
// Record this attribute
attrs.addNew(&Availability,
SourceRange(AvailabilityLoc, T.getCloseLocation()),
- 0, AvailabilityLoc,
+ nullptr, AvailabilityLoc,
Platform,
Changes[Introduced],
Changes[Deprecated],
@@ -944,7 +945,7 @@ void Parser::ParseObjCBridgeRelatedAttri
}
// Parse optional class method name.
- IdentifierLoc *ClassMethod = 0;
+ IdentifierLoc *ClassMethod = nullptr;
if (Tok.is(tok::identifier)) {
ClassMethod = ParseIdentifierLoc();
if (!TryConsumeToken(tok::colon)) {
@@ -963,7 +964,7 @@ void Parser::ParseObjCBridgeRelatedAttri
}
// Parse optional instance method name.
- IdentifierLoc *InstanceMethod = 0;
+ IdentifierLoc *InstanceMethod = nullptr;
if (Tok.is(tok::identifier))
InstanceMethod = ParseIdentifierLoc();
else if (Tok.isNot(tok::r_paren)) {
@@ -982,12 +983,11 @@ void Parser::ParseObjCBridgeRelatedAttri
// Record this attribute
attrs.addNew(&ObjCBridgeRelated,
SourceRange(ObjCBridgeRelatedLoc, T.getCloseLocation()),
- 0, ObjCBridgeRelatedLoc,
+ nullptr, ObjCBridgeRelatedLoc,
RelatedClass,
ClassMethod,
InstanceMethod,
AttributeList::AS_GNU);
-
}
// Late Parsed Attributes:
@@ -1094,7 +1094,8 @@ void Parser::ParseLexedAttribute(LatePar
Actions.ActOnReenterFunctionContext(Actions.CurScope, D);
ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc,
- 0, SourceLocation(), AttributeList::AS_GNU, 0);
+ nullptr, SourceLocation(), AttributeList::AS_GNU,
+ nullptr);
if (HasFunScope) {
Actions.ActOnExitFunctionContext();
@@ -1107,7 +1108,8 @@ void Parser::ParseLexedAttribute(LatePar
// If there are multiple decls, then the decl cannot be within the
// function scope.
ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc,
- 0, SourceLocation(), AttributeList::AS_GNU, 0);
+ nullptr, SourceLocation(), AttributeList::AS_GNU,
+ nullptr);
}
} else {
Diag(Tok, diag::warn_attribute_no_decl) << LA.AttrName.getName();
@@ -1184,7 +1186,7 @@ void Parser::ParseTypeTagForDatatypeAttr
}
if (!T.consumeClose()) {
- Attrs.addNewTypeTagForDatatype(&AttrName, AttrNameLoc, 0, AttrNameLoc,
+ Attrs.addNewTypeTagForDatatype(&AttrName, AttrNameLoc, nullptr, AttrNameLoc,
ArgumentKind, MatchingCType.release(),
LayoutCompatible, MustBeNull,
AttributeList::AS_GNU);
@@ -1289,8 +1291,8 @@ Parser::DeclGroupPtrTy Parser::ParseDecl
// parsing c none objective-c decls.
ObjCDeclContextSwitch ObjCDC(*this);
- Decl *SingleDecl = 0;
- Decl *OwnedType = 0;
+ Decl *SingleDecl = nullptr;
+ Decl *OwnedType = nullptr;
switch (Tok.getKind()) {
case tok::kw_template:
case tok::kw_export:
@@ -1730,7 +1732,7 @@ bool Parser::ParseAsmAttributesAfterDecl
Decl *Parser::ParseDeclarationAfterDeclarator(
Declarator &D, const ParsedTemplateInfo &TemplateInfo) {
if (ParseAsmAttributesAfterDeclarator(D))
- return 0;
+ return nullptr;
return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo);
}
@@ -1738,7 +1740,7 @@ Decl *Parser::ParseDeclarationAfterDecla
Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
Declarator &D, const ParsedTemplateInfo &TemplateInfo, ForRangeInit *FRI) {
// Inform the current actions module that we just parsed this declarator.
- Decl *ThisDecl = 0;
+ Decl *ThisDecl = nullptr;
switch (TemplateInfo.Kind) {
case ParsedTemplateInfo::NonTemplate:
ThisDecl = Actions.ActOnDeclarator(getCurScope(), D);
@@ -1761,7 +1763,7 @@ Decl *Parser::ParseDeclarationAfterDecla
getCurScope(), TemplateInfo.ExternLoc, TemplateInfo.TemplateLoc, D);
if (ThisRes.isInvalid()) {
SkipUntil(tok::semi, StopBeforeMatch);
- return 0;
+ return nullptr;
}
ThisDecl = ThisRes.get();
} else {
@@ -1785,8 +1787,8 @@ Decl *Parser::ParseDeclarationAfterDecla
// Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, 0,
- LAngleLoc));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, nullptr,
+ 0, LAngleLoc));
ThisDecl =
Actions.ActOnTemplateDeclarator(getCurScope(), FakedParamLists, D);
@@ -1825,7 +1827,7 @@ Decl *Parser::ParseDeclarationAfterDecla
Actions.CodeCompleteInitializer(getCurScope(), ThisDecl);
Actions.FinalizeDeclaration(ThisDecl);
cutOffParsing();
- return 0;
+ return nullptr;
}
ExprResult Init(ParseInitializer());
@@ -2065,8 +2067,8 @@ bool Parser::ParseImplicitInt(DeclSpec &
// This is a common problem in C (saying 'foo' instead of 'struct foo').
//
// C++ doesn't need this, and isTagName doesn't take SS.
- if (SS == 0) {
- const char *TagName = 0, *FixitTagName = 0;
+ if (SS == nullptr) {
+ const char *TagName = nullptr, *FixitTagName = nullptr;
tok::TokenKind TagKind = tok::unknown;
switch (Actions.isTagName(*Tok.getIdentifierInfo(), getCurScope())) {
@@ -2293,7 +2295,7 @@ void Parser::ParseAlignmentSpecifier(Par
ArgsVector ArgExprs;
ArgExprs.push_back(ArgExpr.release());
- Attrs.addNew(KWName, KWLoc, 0, KWLoc, ArgExprs.data(), 1,
+ Attrs.addNew(KWName, KWLoc, nullptr, KWLoc, ArgExprs.data(), 1,
AttributeList::AS_Keyword, EllipsisLoc);
}
@@ -2449,7 +2451,7 @@ void Parser::ParseDeclarationSpecifiers(
const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy();
while (1) {
bool isInvalid = false;
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID = 0;
SourceLocation Loc = Tok.getLocation();
@@ -2755,7 +2757,7 @@ void Parser::ParseDeclarationSpecifiers(
// it must be an implicit int or an error.
if (!TypeRep) {
ParsedAttributesWithRange Attrs(AttrFactory);
- if (ParseImplicitInt(DS, 0, TemplateInfo, AS, DSContext, Attrs)) {
+ if (ParseImplicitInt(DS, nullptr, TemplateInfo, AS, DSContext, Attrs)) {
if (!Attrs.empty()) {
AttrsLastTime = true;
attrs.takeAllFrom(Attrs);
@@ -2816,7 +2818,7 @@ void Parser::ParseDeclarationSpecifiers(
// GNU attributes support.
case tok::kw___attribute:
- ParseGNUAttributes(DS.getAttributes(), 0, LateAttrs);
+ ParseGNUAttributes(DS.getAttributes(), nullptr, LateAttrs);
continue;
// Microsoft declspec support.
@@ -2829,8 +2831,8 @@ void Parser::ParseDeclarationSpecifiers(
isInvalid = DS.setFunctionSpecForceInline(Loc, PrevSpec, DiagID);
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = Tok.getLocation();
- DS.getAttributes().addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
- AttributeList::AS_Keyword);
+ DS.getAttributes().addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc,
+ nullptr, 0, AttributeList::AS_Keyword);
break;
}
@@ -3524,7 +3526,7 @@ void Parser::ParseEnumSpecifier(SourceLo
}
// If an identifier is present, consume and remember it.
- IdentifierInfo *Name = 0;
+ IdentifierInfo *Name = nullptr;
SourceLocation NameLoc;
if (Tok.is(tok::identifier)) {
Name = Tok.getIdentifierInfo();
@@ -3698,7 +3700,7 @@ void Parser::ParseEnumSpecifier(SourceLo
bool Owned = false;
bool IsDependent = false;
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
Decl *TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
StartLoc, SS, Name, NameLoc, attrs.getList(),
@@ -3778,7 +3780,7 @@ void Parser::ParseEnumBody(SourceLocatio
SmallVector<Decl *, 32> EnumConstantDecls;
- Decl *LastEnumConstDecl = 0;
+ Decl *LastEnumConstDecl = nullptr;
// Parse the enumerator-list.
while (Tok.isNot(tok::r_brace)) {
@@ -4378,7 +4380,7 @@ void Parser::ParseTypeQualifierListOpt(D
while (1) {
bool isInvalid = false;
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID = 0;
SourceLocation Loc = Tok.getLocation();
@@ -4786,7 +4788,7 @@ void Parser::ParseDirectDeclarator(Decla
// Once we're past the identifier, if the scope was bad, mark the
// whole declarator bad.
D.getCXXScopeSpec().isInvalid()) {
- D.SetIdentifier(0, Tok.getLocation());
+ D.SetIdentifier(nullptr, Tok.getLocation());
D.setInvalidType(true);
} else {
// Parsed the unqualified-id; update range information and move along.
@@ -4811,7 +4813,7 @@ void Parser::ParseDirectDeclarator(Decla
!isCXX11VirtSpecifier(Tok)) {
Diag(Tok.getLocation(), diag::err_unexpected_unqualified_id)
<< FixItHint::CreateRemoval(Tok.getLocation());
- D.SetIdentifier(0, Tok.getLocation());
+ D.SetIdentifier(nullptr, Tok.getLocation());
ConsumeToken();
goto PastIdentifier;
}
@@ -4838,7 +4840,7 @@ void Parser::ParseDirectDeclarator(Decla
} else if (D.mayOmitIdentifier()) {
// This could be something simple like "int" (in which case the declarator
// portion is empty), if an abstract-declarator is allowed.
- D.SetIdentifier(0, Tok.getLocation());
+ D.SetIdentifier(nullptr, Tok.getLocation());
// The grammar for abstract-pack-declarator does not allow grouping parens.
// FIXME: Revisit this once core issue 1488 is resolved.
@@ -4866,7 +4868,7 @@ void Parser::ParseDirectDeclarator(Decla
}
} else
Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_paren;
- D.SetIdentifier(0, Tok.getLocation());
+ D.SetIdentifier(nullptr, Tok.getLocation());
D.setInvalidType(true);
}
@@ -5011,7 +5013,7 @@ void Parser::ParseParenDeclarator(Declar
// argument list. Recognize that this declarator will never have an
// identifier (and remember where it would have been), then call into
// ParseFunctionDeclarator to handle of argument list.
- D.SetIdentifier(0, Tok.getLocation());
+ D.SetIdentifier(nullptr, Tok.getLocation());
// Enter function-declaration scope, limiting any declarators to the
// function prototype scope, including parameter declarators.
@@ -5197,7 +5199,7 @@ void Parser::ParseFunctionDeclarator(Dec
DynamicExceptionRanges.data(),
DynamicExceptions.size(),
NoexceptExpr.isUsable() ?
- NoexceptExpr.get() : 0,
+ NoexceptExpr.get() : nullptr,
StartLoc, LocalEndLoc, D,
TrailingReturnType),
FnAttrs, EndLoc);
@@ -5275,7 +5277,7 @@ void Parser::ParseFunctionDeclaratorIden
// Remember this identifier in ParamInfo.
ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
Tok.getLocation(),
- 0));
+ nullptr));
}
// Eat the identifier.
@@ -5365,11 +5367,11 @@ void Parser::ParseParameterDeclarationCl
// DefArgToks is used when the parsing of default arguments needs
// to be delayed.
- CachedTokens *DefArgToks = 0;
+ CachedTokens *DefArgToks = nullptr;
// If no parameter was specified, verify that *something* was specified,
// otherwise we have a missing type and identifier.
- if (DS.isEmpty() && ParmDeclarator.getIdentifier() == 0 &&
+ if (DS.isEmpty() && ParmDeclarator.getIdentifier() == nullptr &&
ParmDeclarator.getNumTypeObjects() == 0) {
// Completely missing, emit error.
Diag(DSStart, diag::err_missing_param);
@@ -5398,7 +5400,7 @@ void Parser::ParseParameterDeclarationCl
if (!ConsumeAndStoreInitializer(*DefArgToks, CIK_DefaultArgument)) {
delete DefArgToks;
- DefArgToks = 0;
+ DefArgToks = nullptr;
Actions.ActOnParamDefaultArgumentError(Param);
} else {
// Mark the end of the default argument so that we know when to
@@ -5478,7 +5480,7 @@ void Parser::ParseBracketDeclarator(Decl
MaybeParseCXX11Attributes(attrs);
// Remember that we parsed the empty array type.
- D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, 0,
+ D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, nullptr,
T.getOpenLocation(),
T.getCloseLocation()),
attrs, T.getCloseLocation());
@@ -5606,7 +5608,7 @@ void Parser::ParseTypeofSpecifier(DeclSp
return;
}
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
// Check for duplicate type specifiers (e.g. "int typeof(int)").
if (DS.SetTypeSpecType(DeclSpec::TST_typeofType, StartLoc, PrevSpec,
@@ -5629,7 +5631,7 @@ void Parser::ParseTypeofSpecifier(DeclSp
return;
}
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
// Check for duplicate type specifiers (e.g. "int typeof(int)").
if (DS.SetTypeSpecType(DeclSpec::TST_typeofExpr, StartLoc, PrevSpec,
@@ -5665,7 +5667,7 @@ void Parser::ParseAtomicSpecifier(DeclSp
DS.setTypeofParensRange(T.getRange());
DS.SetRangeEnd(T.getCloseLocation());
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
if (DS.SetTypeSpecType(DeclSpec::TST_atomic, StartLoc, PrevSpec,
DiagID, Result.release(),
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed May 21 01:02:52 2014
@@ -64,11 +64,11 @@ Decl *Parser::ParseNamespace(unsigned Co
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteNamespaceDecl(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
SourceLocation IdentLoc;
- IdentifierInfo *Ident = 0;
+ IdentifierInfo *Ident = nullptr;
std::vector<SourceLocation> ExtraIdentLoc;
std::vector<IdentifierInfo*> ExtraIdent;
std::vector<SourceLocation> ExtraNamespaceLoc;
@@ -93,11 +93,11 @@ Decl *Parser::ParseNamespace(unsigned Co
}
if (Tok.is(tok::equal)) {
- if (Ident == 0) {
+ if (!Ident) {
Diag(Tok, diag::err_expected) << tok::identifier;
// Skip to end of the definition and eat the ';'.
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
if (!attrs.empty())
Diag(attrTok, diag::err_unexpected_namespace_attributes_alias);
@@ -120,7 +120,7 @@ Decl *Parser::ParseNamespace(unsigned Co
else
Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;
- return 0;
+ return nullptr;
}
if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||
@@ -132,7 +132,7 @@ Decl *Parser::ParseNamespace(unsigned Co
}
Diag(T.getOpenLocation(), diag::err_namespace_nonnamespace_scope);
SkipUntil(tok::r_brace);
- return 0;
+ return nullptr;
}
if (!ExtraIdent.empty()) {
@@ -246,7 +246,7 @@ Decl *Parser::ParseNamespaceAlias(Source
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteNamespaceAliasDecl(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
CXXScopeSpec SS;
@@ -257,7 +257,7 @@ Decl *Parser::ParseNamespaceAlias(Source
Diag(Tok, diag::err_expected_namespace_name);
// Skip to end of the definition and eat the ';'.
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
// Parse identifier.
@@ -287,7 +287,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSp
ParseScope LinkageScope(this, Scope::DeclScope);
Decl *LinkageSpec =
Lang.isInvalid()
- ? 0
+ ? nullptr
: Actions.ActOnStartLinkageSpecification(
getCurScope(), DS.getSourceRange().getBegin(), Lang.take(),
Tok.is(tok::l_brace) ? Tok.getLocation() : SourceLocation());
@@ -306,7 +306,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSp
ParseExternalDeclaration(attrs, &DS);
return LinkageSpec ? Actions.ActOnFinishLinkageSpecification(
getCurScope(), LinkageSpec, SourceLocation())
- : 0;
+ : nullptr;
}
DS.abort();
@@ -356,7 +356,7 @@ Decl *Parser::ParseLinkage(ParsingDeclSp
T.consumeClose();
return LinkageSpec ? Actions.ActOnFinishLinkageSpecification(
getCurScope(), LinkageSpec, T.getCloseLocation())
- : 0;
+ : nullptr;
}
/// ParseUsingDirectiveOrDeclaration - Parse C++ using using-declaration or
@@ -375,7 +375,7 @@ Decl *Parser::ParseUsingDirectiveOrDecla
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteUsing(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
// 'using namespace' means this is a using-directive.
@@ -421,14 +421,14 @@ Decl *Parser::ParseUsingDirective(unsign
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteUsingDirective(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
CXXScopeSpec SS;
// Parse (optional) nested-name-specifier.
ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false);
- IdentifierInfo *NamespcName = 0;
+ IdentifierInfo *NamespcName = nullptr;
SourceLocation IdentLoc = SourceLocation();
// Parse namespace-name.
@@ -437,7 +437,7 @@ Decl *Parser::ParseUsingDirective(unsign
// If there was invalid namespace name, skip to end of decl, and eat ';'.
SkipUntil(tok::semi);
// FIXME: Are there cases, when we would like to call ActOnUsingDirective?
- return 0;
+ return nullptr;
}
// Parse identifier.
@@ -494,15 +494,16 @@ Decl *Parser::ParseUsingDeclaration(unsi
HasTypenameKeyword = true;
// Parse nested-name-specifier.
- IdentifierInfo *LastII = 0;
+ IdentifierInfo *LastII = nullptr;
ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false,
- /*MayBePseudoDtor=*/0, /*IsTypename=*/false,
+ /*MayBePseudoDtor=*/nullptr,
+ /*IsTypename=*/false,
/*LastII=*/&LastII);
// Check nested-name specifier.
if (SS.isInvalid()) {
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
SourceLocation TemplateKWLoc;
@@ -531,7 +532,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
/*AllowConstructorName=*/ true, ParsedType(),
TemplateKWLoc, Name)) {
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
ParsedAttributesWithRange Attrs(AttrFactory);
@@ -578,7 +579,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
Diag(Range.getBegin(), diag::err_alias_declaration_specialization)
<< SpecKind << Range;
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
// Name must be an identifier.
@@ -586,7 +587,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
Diag(Name.StartLocation, diag::err_alias_declaration_not_identifier);
// No removal fixit: can't recover from this.
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
} else if (HasTypenameKeyword)
Diag(TypenameLoc, diag::err_alias_declaration_not_identifier)
<< FixItHint::CreateRemoval(SourceRange(TypenameLoc,
@@ -595,7 +596,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
Diag(SS.getBeginLoc(), diag::err_alias_declaration_not_identifier)
<< FixItHint::CreateRemoval(SS.getRange());
- TypeAlias = ParseTypeName(0, TemplateInfo.Kind ?
+ TypeAlias = ParseTypeName(nullptr, TemplateInfo.Kind ?
Declarator::AliasTemplateContext :
Declarator::AliasDeclContext, AS, OwnedType,
&Attrs);
@@ -628,7 +629,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
// Unfortunately, we have to bail out instead of recovering by
// ignoring the parameters, just in case the nested name specifier
// depends on the parameters.
- return 0;
+ return nullptr;
}
// "typename" keyword is allowed for identifiers only,
@@ -643,7 +644,7 @@ Decl *Parser::ParseUsingDeclaration(unsi
if (IsAliasDecl) {
TemplateParameterLists *TemplateParams = TemplateInfo.TemplateParams;
MultiTemplateParamsArg TemplateParamsArg(
- TemplateParams ? TemplateParams->data() : 0,
+ TemplateParams ? TemplateParams->data() : nullptr,
TemplateParams ? TemplateParams->size() : 0);
return Actions.ActOnAliasDeclaration(getCurScope(), AS, TemplateParamsArg,
UsingLoc, Name, Attrs.getList(),
@@ -679,31 +680,31 @@ Decl *Parser::ParseStaticAssertDeclarati
if (T.consumeOpen()) {
Diag(Tok, diag::err_expected) << tok::l_paren;
SkipMalformedDecl();
- return 0;
+ return nullptr;
}
ExprResult AssertExpr(ParseConstantExpression());
if (AssertExpr.isInvalid()) {
SkipMalformedDecl();
- return 0;
+ return nullptr;
}
if (ExpectAndConsume(tok::comma)) {
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
if (!isTokenStringLiteral()) {
Diag(Tok, diag::err_expected_string_literal)
<< /*Source='static_assert'*/1;
SkipMalformedDecl();
- return 0;
+ return nullptr;
}
ExprResult AssertMessage(ParseStringLiteralExpression());
if (AssertMessage.isInvalid()) {
SkipMalformedDecl();
- return 0;
+ return nullptr;
}
T.consumeClose();
@@ -768,7 +769,7 @@ SourceLocation Parser::ParseDecltypeSpec
// C++11 [dcl.type.simple]p4:
// The operand of the decltype specifier is an unevaluated operand.
EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated,
- 0, /*IsDecltype=*/true);
+ nullptr,/*IsDecltype=*/true);
Result = ParseExpression();
if (Result.isInvalid()) {
DS.SetTypeSpecError();
@@ -809,7 +810,7 @@ SourceLocation Parser::ParseDecltypeSpec
}
assert(!Result.isInvalid());
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy();
// Check for duplicate type specifiers (e.g. "int decltype(a)").
@@ -865,7 +866,7 @@ void Parser::ParseUnderlyingTypeSpecifie
if (T.getCloseLocation().isInvalid())
return;
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
if (DS.SetTypeSpecType(DeclSpec::TST_underlyingType, StartLoc, PrevSpec,
DiagID, Result.release(),
@@ -995,7 +996,7 @@ Parser::TypeResult Parser::ParseBaseType
}
// We have an identifier; check whether it is actually a type.
- IdentifierInfo *CorrectedII = 0;
+ IdentifierInfo *CorrectedII = nullptr;
ParsedType Type = Actions.getTypeName(*Id, IdLoc, getCurScope(), &SS, true,
false, ParsedType(),
/*IsCtorOrDtorName=*/false,
@@ -1015,7 +1016,7 @@ Parser::TypeResult Parser::ParseBaseType
DS.SetRangeEnd(EndLocation);
DS.getTypeSpecScope() = SS;
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
DS.SetTypeSpecType(TST_typename, IdLoc, PrevSpec, DiagID, Type,
Actions.getASTContext().getPrintingPolicy());
@@ -1030,7 +1031,7 @@ void Parser::ParseMicrosoftInheritanceCl
Tok.is(tok::kw___virtual_inheritance)) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
- attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
AttributeList::AS_Keyword);
}
}
@@ -1241,9 +1242,9 @@ void Parser::ParseClassSpecifier(tok::To
TemplateParameterLists *TemplateParams = TemplateInfo.TemplateParams;
// Parse the (optional) class name or simple-template-id.
- IdentifierInfo *Name = 0;
+ IdentifierInfo *Name = nullptr;
SourceLocation NameLoc;
- TemplateIdAnnotation *TemplateId = 0;
+ TemplateIdAnnotation *TemplateId = nullptr;
if (Tok.is(tok::identifier)) {
Name = Tok.getIdentifierInfo();
NameLoc = ConsumeToken();
@@ -1272,14 +1273,14 @@ void Parser::ParseClassSpecifier(tok::To
if (TemplateParams && TemplateParams->size() > 1) {
TemplateParams->pop_back();
} else {
- TemplateParams = 0;
+ TemplateParams = nullptr;
const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
= ParsedTemplateInfo::NonTemplate;
}
} else if (TemplateInfo.Kind
== ParsedTemplateInfo::ExplicitInstantiation) {
// Pretend this is just a forward declaration.
- TemplateParams = 0;
+ TemplateParams = nullptr;
const_cast<ParsedTemplateInfo&>(TemplateInfo).Kind
= ParsedTemplateInfo::NonTemplate;
const_cast<ParsedTemplateInfo&>(TemplateInfo).TemplateLoc
@@ -1521,7 +1522,7 @@ void Parser::ParseClassSpecifier(tok::To
if (TUK == Sema::TUK_Friend) {
Diag(DS.getFriendSpecLoc(), diag::err_friend_explicit_instantiation);
- TemplateParams = 0;
+ TemplateParams = nullptr;
} else {
SourceLocation LAngleLoc =
PP.getLocForEndOfToken(TemplateInfo.TemplateLoc);
@@ -1534,8 +1535,8 @@ void Parser::ParseClassSpecifier(tok::To
// "template<>", so that we treat this construct as a class
// template specialization.
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, 0,
- LAngleLoc));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, nullptr,
+ 0, LAngleLoc));
TemplateParams = &FakedParamLists;
}
}
@@ -1544,7 +1545,8 @@ void Parser::ParseClassSpecifier(tok::To
TagOrTempResult = Actions.ActOnClassTemplateSpecialization(
getCurScope(), TagType, TUK, StartLoc, DS.getModulePrivateSpecLoc(),
*TemplateId, attrs.getList(),
- MultiTemplateParamsArg(TemplateParams ? &(*TemplateParams)[0] : 0,
+ MultiTemplateParamsArg(TemplateParams ? &(*TemplateParams)[0]
+ : nullptr,
TemplateParams ? TemplateParams->size() : 0));
}
} else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
@@ -1571,7 +1573,8 @@ void Parser::ParseClassSpecifier(tok::To
TagType, StartLoc, SS,
Name, NameLoc, attrs.getList(),
MultiTemplateParamsArg(
- TemplateParams? &(*TemplateParams)[0] : 0,
+ TemplateParams? &(*TemplateParams)[0]
+ : nullptr,
TemplateParams? TemplateParams->size() : 0));
} else {
if (TUK != Sema::TUK_Declaration && TUK != Sema::TUK_Definition)
@@ -1583,7 +1586,7 @@ void Parser::ParseClassSpecifier(tok::To
// recover by ignoring the 'template' keyword.
Diag(Tok, diag::err_template_defn_explicit_instantiation)
<< 1 << FixItHint::CreateRemoval(TemplateInfo.TemplateLoc);
- TemplateParams = 0;
+ TemplateParams = nullptr;
}
bool IsDependent = false;
@@ -1626,7 +1629,7 @@ void Parser::ParseClassSpecifier(tok::To
ParseStructUnionBody(StartLoc, TagType, TagOrTempResult.get());
}
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
bool Result;
if (!TypeResult.isInvalid()) {
@@ -1798,7 +1801,7 @@ void Parser::HandleMemberFunctionDeclDel
Decl *ThisDecl) {
// We just declared a member function. If this member function
// has any default arguments, we'll need to parse them later.
- LateParsedMethodDeclaration *LateMethod = 0;
+ LateParsedMethodDeclaration *LateMethod = nullptr;
DeclaratorChunk::FunctionTypeInfo &FTI
= DeclaratorInfo.getFunctionTypeInfo();
@@ -1873,7 +1876,7 @@ void Parser::ParseOptionalCXX11VirtSpeci
// C++ [class.mem]p8:
// A virt-specifier-seq shall contain at most one of each virt-specifier.
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
if (VS.SetSpecifier(Specifier, Tok.getLocation(), PrevSpec))
Diag(Tok.getLocation(), diag::err_duplicate_virt_specifier)
<< PrevSpec
@@ -2043,7 +2046,7 @@ void Parser::ParseCXXClassMemberDeclarat
/* HasUsingKeyword */ false,
SourceLocation(),
SS, Name,
- /* AttrList */ 0,
+ /* AttrList */ nullptr,
/* HasTypenameKeyword */ false,
SourceLocation());
return;
@@ -2132,7 +2135,8 @@ void Parser::ParseCXXClassMemberDeclarat
return;
MultiTemplateParamsArg TemplateParams(
- TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() : 0,
+ TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data()
+ : nullptr,
TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->size() : 0);
if (TryConsumeToken(tok::semi)) {
@@ -2281,7 +2285,7 @@ void Parser::ParseCXXClassMemberDeclarat
// this call will *not* return the created decl; It will return null.
// See Sema::ActOnCXXMemberDeclarator for details.
- NamedDecl *ThisDecl = 0;
+ NamedDecl *ThisDecl = nullptr;
if (DS.isFriendSpecified()) {
// C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains
// to a friend declaration, that declaration shall be a definition.
@@ -2305,7 +2309,7 @@ void Parser::ParseCXXClassMemberDeclarat
VS, HasInClassInit);
if (VarTemplateDecl *VT =
- ThisDecl ? dyn_cast<VarTemplateDecl>(ThisDecl) : 0)
+ ThisDecl ? dyn_cast<VarTemplateDecl>(ThisDecl) : nullptr)
// Re-direct this decl to refer to the templated decl so that we can
// initialize it.
ThisDecl = VT->getTemplatedDecl();
@@ -2861,7 +2865,7 @@ Parser::MemInitResult Parser::ParseMemIn
return true;
}
- IdentifierInfo *II = 0;
+ IdentifierInfo *II = nullptr;
DeclSpec DS(AttrFactory);
SourceLocation IdLoc = Tok.getLocation();
if (Tok.is(tok::annot_decltype)) {
@@ -3157,7 +3161,7 @@ IdentifierInfo *Parser::TryParseCXX11Att
Loc = ConsumeToken();
return II;
}
- return 0;
+ return nullptr;
case tok::ampamp: // 'and'
case tok::pipe: // 'bitor'
@@ -3178,7 +3182,7 @@ IdentifierInfo *Parser::TryParseCXX11Att
Loc = ConsumeToken();
return &PP.getIdentifierTable().get(Spelling);
}
- return 0;
+ return nullptr;
}
}
@@ -3235,7 +3239,7 @@ bool Parser::ParseCXX11AttributeArgs(Ide
// GNU-scoped attributes have some special cases to handle GNU-specific
// behaviors.
ParseGNUAttributeArgs(AttrName, AttrNameLoc, Attrs, EndLoc, ScopeName,
- ScopeLoc, AttributeList::AS_CXX11, 0);
+ ScopeLoc, AttributeList::AS_CXX11, nullptr);
else {
unsigned NumArgs =
ParseAttributeArgsCommon(AttrName, AttrNameLoc, Attrs, EndLoc,
@@ -3314,7 +3318,7 @@ void Parser::ParseCXX11AttributeSpecifie
continue;
SourceLocation ScopeLoc, AttrLoc;
- IdentifierInfo *ScopeName = 0, *AttrName = 0;
+ IdentifierInfo *ScopeName = nullptr, *AttrName = nullptr;
AttrName = TryParseCXX11AttributeIdentifier(AttrLoc);
if (!AttrName)
@@ -3351,7 +3355,7 @@ void Parser::ParseCXX11AttributeSpecifie
attrs.addNew(AttrName,
SourceRange(ScopeLoc.isValid() ? ScopeLoc : AttrLoc,
AttrLoc),
- ScopeName, ScopeLoc, 0, 0, AttributeList::AS_CXX11);
+ ScopeName, ScopeLoc, nullptr, 0, AttributeList::AS_CXX11);
if (TryConsumeToken(tok::ellipsis))
Diag(Tok, diag::err_cxx11_attribute_forbids_ellipsis)
@@ -3492,7 +3496,7 @@ void Parser::ParseMicrosoftIfExistsClass
}
// Parse all the comma separated declarators.
- ParseCXXClassMemberDeclaration(CurAS, 0);
+ ParseCXXClassMemberDeclaration(CurAS, nullptr);
}
Braces.consumeClose();
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Wed May 21 01:02:52 2014
@@ -261,12 +261,12 @@ Parser::ParseRHSOfBinaryExpression(ExprR
TernaryMiddle = ParseExpression();
if (TernaryMiddle.isInvalid()) {
LHS = ExprError();
- TernaryMiddle = 0;
+ TernaryMiddle = nullptr;
}
} else {
// Special case handling of "X ? Y : Z" where Y is empty:
// logical-OR-expression '?' ':' conditional-expression [GNU]
- TernaryMiddle = 0;
+ TernaryMiddle = nullptr;
Diag(Tok, diag::ext_gnu_conditional_expr);
}
@@ -682,7 +682,7 @@ ExprResult Parser::ParseCastExpression(b
return Actions.ActOnCXXNullPtrLiteral(ConsumeToken());
case tok::annot_primary_expr:
- assert(Res.get() == 0 && "Stray primary-expression annotation?");
+ assert(Res.get() == nullptr && "Stray primary-expression annotation?");
Res = getExprAnnotation(Tok);
ConsumeToken();
break;
@@ -761,8 +761,8 @@ ExprResult Parser::ParseCastExpression(b
((Tok.is(tok::identifier) &&
(NextToken().is(tok::colon) || NextToken().is(tok::r_square))) ||
Tok.is(tok::code_completion))) {
- Res = ParseObjCMessageExpressionBody(SourceLocation(), ILoc, ParsedType(),
- 0);
+ Res = ParseObjCMessageExpressionBody(SourceLocation(), ILoc, ParsedType(),
+ nullptr);
break;
}
@@ -783,7 +783,7 @@ ExprResult Parser::ParseCastExpression(b
DeclSpec DS(AttrFactory);
DS.SetRangeStart(ILoc);
DS.SetRangeEnd(ILoc);
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
DS.SetTypeSpecType(TST_typename, ILoc, PrevSpec, DiagID, Typ,
Actions.getASTContext().getPrintingPolicy());
@@ -793,10 +793,10 @@ ExprResult Parser::ParseCastExpression(b
DeclaratorInfo);
if (Ty.isInvalid())
break;
-
+
Res = ParseObjCMessageExpressionBody(SourceLocation(),
SourceLocation(),
- Ty.get(), 0);
+ Ty.get(), nullptr);
break;
}
}
@@ -914,7 +914,7 @@ ExprResult Parser::ParseCastExpression(b
if (Tok.isNot(tok::identifier))
return ExprError(Diag(Tok, diag::err_expected) << tok::identifier);
- if (getCurScope()->getFnParent() == 0)
+ if (getCurScope()->getFnParent() == nullptr)
return ExprError(Diag(Tok, diag::err_address_of_label_outside_fn));
Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
@@ -949,7 +949,7 @@ ExprResult Parser::ParseCastExpression(b
DS.SetRangeStart(Tok.getLocation());
DS.SetRangeEnd(Tok.getLastLoc());
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
DS.SetTypeSpecType(TST_typename, Tok.getAnnotationEndLoc(),
PrevSpec, DiagID, Type,
@@ -962,7 +962,7 @@ ExprResult Parser::ParseCastExpression(b
ConsumeToken();
Res = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(),
- Ty.get(), 0);
+ Ty.get(), nullptr);
break;
}
// Fall through
@@ -1267,8 +1267,8 @@ Parser::ParsePostfixExpressionSuffix(Exp
// '(' argument-expression-list[opt] ')'
tok::TokenKind OpKind = Tok.getKind();
InMessageExpressionRAIIObject InMessage(*this, false);
-
- Expr *ExecConfig = 0;
+
+ Expr *ExecConfig = nullptr;
BalancedDelimiterTracker PT(*this, tok::l_paren);
@@ -1432,7 +1432,8 @@ Parser::ParsePostfixExpressionSuffix(Exp
if (!LHS.isInvalid())
LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.take(), OpLoc,
OpKind, SS, TemplateKWLoc, Name,
- CurParsedObjCImpl ? CurParsedObjCImpl->Dcl : 0,
+ CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
+ : nullptr,
Tok.is(tok::l_paren));
break;
}
@@ -1574,7 +1575,7 @@ ExprResult Parser::ParseUnaryExprOrTypeT
if (Tok.is(tok::ellipsis) && OpTok.is(tok::kw_sizeof)) {
SourceLocation EllipsisLoc = ConsumeToken();
SourceLocation LParenLoc, RParenLoc;
- IdentifierInfo *Name = 0;
+ IdentifierInfo *Name = nullptr;
SourceLocation NameLoc;
if (Tok.is(tok::l_paren)) {
BalancedDelimiterTracker T(*this, tok::l_paren);
@@ -2043,7 +2044,7 @@ Parser::ParseParenExpression(ParenParseO
}
Result = ParseObjCMessageExpressionBody(SourceLocation(),
SourceLocation(),
- Ty.get(), 0);
+ Ty.get(), nullptr);
} else {
// Match the ')'.
T.consumeClose();
@@ -2181,7 +2182,8 @@ ExprResult Parser::ParseStringLiteralExp
// Pass the set of string tokens, ready for concatenation, to the actions.
return Actions.ActOnStringLiteral(&StringToks[0], StringToks.size(),
- AllowUserDefinedLiteral ? getCurScope() : 0);
+ AllowUserDefinedLiteral ? getCurScope()
+ : nullptr);
}
/// ParseGenericSelectionExpression - Parse a C11 generic-selection
@@ -2433,7 +2435,7 @@ ExprResult Parser::ParseBlockLiteralExpr
// SetIdentifier sets the source range end, but in this case we're past
// that location.
SourceLocation Tmp = ParamInfo.getSourceRange().getEnd();
- ParamInfo.SetIdentifier(0, CaretLoc);
+ ParamInfo.SetIdentifier(nullptr, CaretLoc);
ParamInfo.SetRangeEnd(Tmp);
if (ParamInfo.isInvalidType()) {
// If there was an error parsing the arguments, they may have
@@ -2456,7 +2458,7 @@ ExprResult Parser::ParseBlockLiteralExpr
ParamInfo.AddTypeInfo(DeclaratorChunk::getFunction(/*HasProto=*/true,
/*IsAmbiguous=*/false,
/*RParenLoc=*/NoLoc,
- /*ArgInfo=*/0,
+ /*ArgInfo=*/nullptr,
/*NumArgs=*/0,
/*EllipsisLoc=*/NoLoc,
/*RParenLoc=*/NoLoc,
@@ -2468,10 +2470,10 @@ ExprResult Parser::ParseBlockLiteralExpr
/*MutableLoc=*/NoLoc,
EST_None,
/*ESpecLoc=*/NoLoc,
- /*Exceptions=*/0,
- /*ExceptionRanges=*/0,
+ /*Exceptions=*/nullptr,
+ /*ExceptionRanges=*/nullptr,
/*NumExceptions=*/0,
- /*NoexceptExpr=*/0,
+ /*NoexceptExpr=*/nullptr,
CaretLoc, CaretLoc,
ParamInfo),
attrs, CaretLoc);
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Wed May 21 01:02:52 2014
@@ -207,7 +207,7 @@ bool Parser::ParseOptionalCXXScopeSpecif
}
if (LastII)
- *LastII = 0;
+ *LastII = nullptr;
bool HasScopeSpecifier = false;
@@ -462,7 +462,7 @@ bool Parser::ParseOptionalCXXScopeSpecif
CheckForLParenAfterColonColon();
bool IsCorrectedToColon = false;
- bool *CorrectionFlagPtr = ColonIsSacred ? &IsCorrectedToColon : 0;
+ bool *CorrectionFlagPtr = ColonIsSacred ? &IsCorrectedToColon : nullptr;
if (Actions.ActOnCXXNestedNameSpecifier(getCurScope(), II, IdLoc, CCLoc,
ObjectType, EnteringContext, SS,
false, CorrectionFlagPtr)) {
@@ -793,7 +793,7 @@ Optional<unsigned> Parser::ParseLambdaIn
// Parse capture.
LambdaCaptureKind Kind = LCK_ByCopy;
SourceLocation Loc;
- IdentifierInfo* Id = 0;
+ IdentifierInfo *Id = nullptr;
SourceLocation EllipsisLoc;
ExprResult Init;
@@ -1092,7 +1092,7 @@ ExprResult Parser::ParseLambdaExpression
DynamicExceptionRanges.data(),
DynamicExceptions.size(),
NoexceptExpr.isUsable() ?
- NoexceptExpr.get() : 0,
+ NoexceptExpr.get() : nullptr,
LParenLoc, FunLocalRangeEnd, D,
TrailingReturnType),
Attr, DeclEndLoc);
@@ -1144,7 +1144,7 @@ ExprResult Parser::ParseLambdaExpression
D.AddTypeInfo(DeclaratorChunk::getFunction(/*hasProto=*/true,
/*isAmbiguous=*/false,
/*LParenLoc=*/NoLoc,
- /*Params=*/0,
+ /*Params=*/nullptr,
/*NumParams=*/0,
/*EllipsisLoc=*/NoLoc,
/*RParenLoc=*/NoLoc,
@@ -1156,10 +1156,10 @@ ExprResult Parser::ParseLambdaExpression
MutableLoc,
EST_None,
/*ESpecLoc=*/NoLoc,
- /*Exceptions=*/0,
- /*ExceptionRanges=*/0,
+ /*Exceptions=*/nullptr,
+ /*ExceptionRanges=*/nullptr,
/*NumExceptions=*/0,
- /*NoexceptExpr=*/0,
+ /*NoexceptExpr=*/nullptr,
DeclLoc, DeclEndLoc, D,
TrailingReturnType),
Attr, DeclEndLoc);
@@ -1201,7 +1201,7 @@ ExprResult Parser::ParseLambdaExpression
///
ExprResult Parser::ParseCXXCasts() {
tok::TokenKind Kind = Tok.getKind();
- const char *CastName = 0; // For error messages
+ const char *CastName = nullptr; // For error messages
switch (Kind) {
default: llvm_unreachable("Unknown C++ cast!");
@@ -1417,7 +1417,7 @@ Parser::ParseCXXPseudoDestructor(ExprArg
assert(Tok.is(tok::coloncolon) &&"ParseOptionalCXXScopeSpecifier fail");
CCLoc = ConsumeToken();
} else {
- FirstTypeName.setIdentifier(0, SourceLocation());
+ FirstTypeName.setIdentifier(nullptr, SourceLocation());
}
// Parse the tilde.
@@ -1489,7 +1489,7 @@ ExprResult Parser::ParseThrowExpression(
case tok::r_brace:
case tok::colon:
case tok::comma:
- return Actions.ActOnCXXThrow(getCurScope(), ThrowLoc, 0);
+ return Actions.ActOnCXXThrow(getCurScope(), ThrowLoc, nullptr);
default:
ExprResult Expr(ParseAssignmentExpression());
@@ -1608,7 +1608,7 @@ bool Parser::ParseCXXCondition(ExprResul
// Parse the expression.
ExprOut = ParseExpression(); // expression
- DeclOut = 0;
+ DeclOut = nullptr;
if (ExprOut.isInvalid())
return true;
@@ -1996,7 +1996,7 @@ bool Parser::ParseUnqualifiedIdTemplateI
TemplateId->Operator = OO_None;
TemplateId->TemplateNameLoc = Id.StartLocation;
} else {
- TemplateId->Name = 0;
+ TemplateId->Name = nullptr;
TemplateId->Operator = Id.OperatorFunctionId.Operator;
TemplateId->TemplateNameLoc = Id.StartLocation;
}
@@ -2201,7 +2201,7 @@ bool Parser::ParseUnqualifiedIdOperator(
// Grab the literal operator's suffix, which will be either the next token
// or a ud-suffix from the string literal.
- IdentifierInfo *II = 0;
+ IdentifierInfo *II = nullptr;
SourceLocation SuffixLoc;
if (!Literal.getUDSuffix().empty()) {
II = &PP.getIdentifierTable().get(Literal.getUDSuffix());
@@ -2262,8 +2262,8 @@ bool Parser::ParseUnqualifiedIdOperator(
// Parse the conversion-declarator, which is merely a sequence of
// ptr-operators.
Declarator D(DS, Declarator::ConversionIdContext);
- ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
-
+ ParseDeclaratorInternal(D, /*DirectDeclParser=*/nullptr);
+
// Finish up the type.
TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
if (Ty.isInvalid())
@@ -2419,10 +2419,10 @@ bool Parser::ParseUnqualifiedId(CXXScope
Result.getKind() == UnqualifiedId::IK_LiteralOperatorId) &&
(TemplateSpecified || Tok.is(tok::less)))
return ParseUnqualifiedIdTemplateId(SS, TemplateKWLoc,
- 0, SourceLocation(),
+ nullptr, SourceLocation(),
EnteringContext, ObjectType,
Result, TemplateSpecified);
-
+
return false;
}
@@ -2861,7 +2861,7 @@ ExprResult Parser::ParseArrayTypeTrait()
switch (ATT) {
case ATT_ArrayRank: {
T.consumeClose();
- return Actions.ActOnArrayTypeTrait(ATT, Loc, Ty.get(), NULL,
+ return Actions.ActOnArrayTypeTrait(ATT, Loc, Ty.get(), nullptr,
T.getCloseLocation());
}
case ATT_ArrayExtent: {
Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Wed May 21 01:02:52 2014
@@ -219,7 +219,7 @@ ExprResult Parser::ParseInitializerWithP
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
ConsumeToken(),
ParsedType(),
- 0);
+ nullptr);
}
// Parse the receiver, which is either a type or an expression.
@@ -237,7 +237,7 @@ ExprResult Parser::ParseInitializerWithP
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
ParsedType::getFromOpaquePtr(TypeOrExpr),
- 0);
+ nullptr);
}
// If the receiver was an expression, we still don't know
@@ -264,7 +264,7 @@ ExprResult Parser::ParseInitializerWithP
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
ConsumeToken(),
ParsedType(),
- 0);
+ nullptr);
ConsumeToken(); // the identifier
if (!ReceiverType) {
SkipUntil(tok::r_square, StopAtSemi);
@@ -274,7 +274,7 @@ ExprResult Parser::ParseInitializerWithP
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
SourceLocation(),
ReceiverType,
- 0);
+ nullptr);
case Sema::ObjCInstanceMessage:
// Fall through; we'll just parse the expression and
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed May 21 01:02:52 2014
@@ -51,8 +51,8 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
cutOffParsing();
return DeclGroupPtrTy();
}
-
- Decl *SingleDecl = 0;
+
+ Decl *SingleDecl = nullptr;
switch (Tok.getObjCKeywordID()) {
case tok::objc_class:
return ParseObjCAtClassDeclaration(AtLoc);
@@ -83,11 +83,11 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
return ParseModuleImport(AtLoc);
Diag(AtLoc, diag::err_atimport);
SkipUntil(tok::semi);
- return Actions.ConvertDeclToDeclGroup(0);
+ return Actions.ConvertDeclToDeclGroup(nullptr);
default:
Diag(AtLoc, diag::err_unexpected_at);
SkipUntil(tok::semi);
- SingleDecl = 0;
+ SingleDecl = nullptr;
break;
}
return Actions.ConvertDeclToDeclGroup(SingleDecl);
@@ -109,7 +109,7 @@ Parser::ParseObjCAtClassDeclaration(Sour
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
SkipUntil(tok::semi);
- return Actions.ConvertDeclToDeclGroup(0);
+ return Actions.ConvertDeclToDeclGroup(nullptr);
}
ClassNames.push_back(Tok.getIdentifierInfo());
ClassLocs.push_back(Tok.getLocation());
@@ -121,7 +121,7 @@ Parser::ParseObjCAtClassDeclaration(Sour
// Consume the ';'.
if (ExpectAndConsume(tok::semi, diag::err_expected_after, "@class"))
- return Actions.ConvertDeclToDeclGroup(0);
+ return Actions.ConvertDeclToDeclGroup(nullptr);
return Actions.ActOnForwardClassDeclaration(atLoc, ClassNames.data(),
ClassLocs.data(),
@@ -187,7 +187,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCInterfaceDecl(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
MaybeSkipAttributes(tok::objc_interface);
@@ -195,7 +195,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing class or category name.
- return 0;
+ return nullptr;
}
// We have a class or category name - consume it.
@@ -208,11 +208,11 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
T.consumeOpen();
SourceLocation categoryLoc;
- IdentifierInfo *categoryId = 0;
+ IdentifierInfo *categoryId = nullptr;
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCInterfaceCategory(getCurScope(), nameId, nameLoc);
cutOffParsing();
- return 0;
+ return nullptr;
}
// For ObjC2, the category name is optional (not an error).
@@ -223,13 +223,13 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
else if (!getLangOpts().ObjC2) {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing category name.
- return 0;
+ return nullptr;
}
T.consumeClose();
if (T.getCloseLocation().isInvalid())
- return 0;
-
+ return nullptr;
+
if (!attrs.empty()) { // categories don't support attributes.
Diag(nameLoc, diag::err_objc_no_attributes_on_category);
attrs.clear();
@@ -242,7 +242,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::less) &&
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true,
LAngleLoc, EndProtoLoc))
- return 0;
+ return nullptr;
Decl *CategoryType =
Actions.ActOnStartCategoryInterface(AtLoc,
@@ -260,7 +260,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
return CategoryType;
}
// Parse a class interface.
- IdentifierInfo *superClassId = 0;
+ IdentifierInfo *superClassId = nullptr;
SourceLocation superClassLoc;
if (Tok.is(tok::colon)) { // a super class is specified.
@@ -270,13 +270,13 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCSuperclass(getCurScope(), nameId, nameLoc);
cutOffParsing();
- return 0;
+ return nullptr;
}
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected)
<< tok::identifier; // missing super class name.
- return 0;
+ return nullptr;
}
superClassId = Tok.getIdentifierInfo();
superClassLoc = ConsumeToken();
@@ -288,7 +288,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::less) &&
ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs, true,
LAngleLoc, EndProtoLoc))
- return 0;
+ return nullptr;
if (Tok.isNot(tok::less))
Actions.ActOnTypedefedProtocols(ProtocolRefs, superClassId, superClassLoc);
@@ -330,7 +330,7 @@ public:
}
void invoke(ParsingFieldDeclarator &FD) override {
- if (FD.D.getIdentifier() == 0) {
+ if (FD.D.getIdentifier() == nullptr) {
P.Diag(AtLoc, diag::err_objc_property_requires_field_name)
<< FD.D.getSourceRange();
return;
@@ -577,7 +577,7 @@ void Parser::ParseObjCPropertyAttribute(
const IdentifierInfo *II = Tok.getIdentifierInfo();
// If this is not an identifier at all, bail out early.
- if (II == 0) {
+ if (!II) {
T.consumeClose();
return;
}
@@ -698,7 +698,7 @@ IdentifierInfo *Parser::ParseObjCSelecto
switch (Tok.getKind()) {
default:
- return 0;
+ return nullptr;
case tok::ampamp:
case tok::ampequal:
case tok::amp:
@@ -717,7 +717,7 @@ IdentifierInfo *Parser::ParseObjCSelecto
SelectorLoc = ConsumeToken();
return II;
}
- return 0;
+ return nullptr;
}
case tok::identifier:
@@ -845,7 +845,7 @@ void Parser::ParseObjCTypeQualifierList(
}
DS.setObjCDeclQualifier(Qual);
ConsumeToken();
- II = 0;
+ II = nullptr;
break;
}
@@ -866,7 +866,7 @@ static void takeDeclAttributes(ParsedAtt
// Clear out the next pointer. We're really completely
// destroying the internal invariants of the declarator here,
// but it doesn't matter because we're done with it.
- cur->setNext(0);
+ cur->setNext(nullptr);
attrs.add(cur);
}
}
@@ -897,7 +897,8 @@ ParsedType Parser::ParseObjCTypeName(Obj
ParsedAttributes *paramAttrs) {
assert(context == Declarator::ObjCParameterContext ||
context == Declarator::ObjCResultContext);
- assert((paramAttrs != 0) == (context == Declarator::ObjCParameterContext));
+ assert((paramAttrs != nullptr) ==
+ (context == Declarator::ObjCParameterContext));
assert(Tok.is(tok::l_paren) && "expected (");
@@ -994,14 +995,15 @@ Decl *Parser::ParseObjCMethodDecl(Source
Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
/*ReturnType=*/ ParsedType());
cutOffParsing();
- return 0;
+ return nullptr;
}
// Parse the return type if present.
ParsedType ReturnType;
ObjCDeclSpec DSRet;
if (Tok.is(tok::l_paren))
- ReturnType = ParseObjCTypeName(DSRet, Declarator::ObjCResultContext, 0);
+ ReturnType = ParseObjCTypeName(DSRet, Declarator::ObjCResultContext,
+ nullptr);
// If attributes exist before the method, parse them.
ParsedAttributes methodAttrs(AttrFactory);
@@ -1012,7 +1014,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
ReturnType);
cutOffParsing();
- return 0;
+ return nullptr;
}
// Now parse the selector.
@@ -1025,7 +1027,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
<< SourceRange(mLoc, Tok.getLocation());
// Skip until we get a ; or @.
SkipUntil(tok::at, StopAtSemi | StopBeforeMatch);
- return 0;
+ return nullptr;
}
SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo;
@@ -1038,7 +1040,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
Decl *Result
= Actions.ActOnMethodDeclaration(getCurScope(), mLoc, Tok.getLocation(),
mType, DSRet, ReturnType,
- selLoc, Sel, 0,
+ selLoc, Sel, nullptr,
CParamInfo.data(), CParamInfo.size(),
methodAttrs.getList(), MethodImplKind,
false, MethodDefinition);
@@ -1069,7 +1071,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
// If attributes exist before the argument name, parse them.
// Regardless, collect all the attributes we've parsed so far.
- ArgInfo.ArgAttrs = 0;
+ ArgInfo.ArgAttrs = nullptr;
if (getLangOpts().ObjC2) {
MaybeParseGNUAttributes(paramAttrs);
ArgInfo.ArgAttrs = paramAttrs.getList();
@@ -1083,7 +1085,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
/*AtParameterName=*/true,
ReturnType, KeyIdents);
cutOffParsing();
- return 0;
+ return nullptr;
}
if (Tok.isNot(tok::identifier)) {
@@ -1110,7 +1112,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
/*AtParameterName=*/false,
ReturnType, KeyIdents);
cutOffParsing();
- return 0;
+ return nullptr;
}
// Check for another keyword selector.
@@ -1152,7 +1154,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
CParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
ParmDecl.getIdentifierLoc(),
Param,
- 0));
+ nullptr));
}
// FIXME: Add support for optional parameter list...
@@ -1161,8 +1163,8 @@ Decl *Parser::ParseObjCMethodDecl(Source
MaybeParseGNUAttributes(methodAttrs);
if (KeyIdents.size() == 0)
- return 0;
-
+ return nullptr;
+
Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
&KeyIdents[0]);
Decl *Result
@@ -1255,7 +1257,7 @@ void Parser::HelperActionsForIvarDeclara
// for code rewriting tools that need to be aware of the empty list.
Actions.ActOnFields(getCurScope(), atLoc, interfaceDecl,
AllIvarDecls,
- T.getOpenLocation(), T.getCloseLocation(), 0);
+ T.getOpenLocation(), T.getCloseLocation(), nullptr);
}
/// objc-class-instance-variables:
@@ -1510,13 +1512,13 @@ Parser::ParseObjCAtImplementationDeclara
// We have a class or category name - consume it.
IdentifierInfo *nameId = Tok.getIdentifierInfo();
SourceLocation nameLoc = ConsumeToken(); // consume class or category name
- Decl *ObjCImpDecl = 0;
+ Decl *ObjCImpDecl = nullptr;
if (Tok.is(tok::l_paren)) {
// we have a category implementation.
ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
- IdentifierInfo *categoryId = 0;
+ IdentifierInfo *categoryId = nullptr;
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCImplementationCategory(getCurScope(), nameId, nameLoc);
@@ -1551,7 +1553,7 @@ Parser::ParseObjCAtImplementationDeclara
} else {
// We have a class implementation
SourceLocation superClassLoc;
- IdentifierInfo *superClassId = 0;
+ IdentifierInfo *superClassId = nullptr;
if (TryConsumeToken(tok::colon)) {
// We have a super class
if (Tok.isNot(tok::identifier)) {
@@ -1619,7 +1621,7 @@ Parser::ObjCImplParsingDataRAII::~ObjCIm
<< Sema::OCK_Implementation;
}
}
- P.CurParsedObjCImpl = 0;
+ P.CurParsedObjCImpl = nullptr;
assert(LateParsedObjCMethods.empty());
}
@@ -1656,13 +1658,13 @@ Decl *Parser::ParseObjCAtAliasDeclaratio
ConsumeToken(); // consume compatibility_alias
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
- return 0;
+ return nullptr;
}
IdentifierInfo *aliasId = Tok.getIdentifierInfo();
SourceLocation aliasLoc = ConsumeToken(); // consume alias-name
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
- return 0;
+ return nullptr;
}
IdentifierInfo *classId = Tok.getIdentifierInfo();
SourceLocation classLoc = ConsumeToken(); // consume class-name;
@@ -1691,16 +1693,16 @@ Decl *Parser::ParseObjCPropertySynthesiz
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCPropertyDefinition(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_synthesized_property_name);
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
-
- IdentifierInfo *propertyIvar = 0;
+
+ IdentifierInfo *propertyIvar = nullptr;
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
SourceLocation propertyLoc = ConsumeToken(); // consume property name
SourceLocation propertyIvarLoc;
@@ -1709,7 +1711,7 @@ Decl *Parser::ParseObjCPropertySynthesiz
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCPropertySynthesizeIvar(getCurScope(), propertyId);
cutOffParsing();
- return 0;
+ return nullptr;
}
if (Tok.isNot(tok::identifier)) {
@@ -1726,7 +1728,7 @@ Decl *Parser::ParseObjCPropertySynthesiz
ConsumeToken(); // consume ','
}
ExpectAndConsume(tok::semi, diag::err_expected_after, "@synthesize");
- return 0;
+ return nullptr;
}
/// property-dynamic:
@@ -1744,26 +1746,26 @@ Decl *Parser::ParseObjCPropertyDynamic(S
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCPropertyDefinition(getCurScope());
cutOffParsing();
- return 0;
+ return nullptr;
}
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected) << tok::identifier;
SkipUntil(tok::semi);
- return 0;
+ return nullptr;
}
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
SourceLocation propertyLoc = ConsumeToken(); // consume property name
Actions.ActOnPropertyImplDecl(getCurScope(), atLoc, propertyLoc, false,
- propertyId, 0, SourceLocation());
+ propertyId, nullptr, SourceLocation());
if (Tok.isNot(tok::comma))
break;
ConsumeToken(); // consume ','
}
ExpectAndConsume(tok::semi, diag::err_expected_after, "@dynamic");
- return 0;
+ return nullptr;
}
/// objc-throw-statement:
@@ -1874,7 +1876,7 @@ StmtResult Parser::ParseObjCTryStmt(Sour
SourceLocation AtCatchFinallyLoc = ConsumeToken();
if (Tok.isObjCAtKeyword(tok::objc_catch)) {
- Decl *FirstPart = 0;
+ Decl *FirstPart = nullptr;
ConsumeToken(); // consume catch
if (Tok.is(tok::l_paren)) {
ConsumeParen();
@@ -2033,13 +2035,13 @@ Decl *Parser::ParseObjCMethodDefinition(
// If we didn't find the '{', bail out.
if (Tok.isNot(tok::l_brace))
- return 0;
+ return nullptr;
}
if (!MDecl) {
ConsumeBrace();
SkipUntil(tok::r_brace);
- return 0;
+ return nullptr;
}
// Allow the rest of sema to find private method decl implementations.
@@ -2097,7 +2099,7 @@ ExprResult Parser::ParseObjCAtExpression
SourceLocation OpLoc = ConsumeToken();
if (!Tok.is(tok::numeric_constant)) {
- const char *Symbol = 0;
+ const char *Symbol = nullptr;
switch (Kind) {
case tok::minus: Symbol = "-"; break;
case tok::plus: Symbol = "+"; break;
@@ -2152,7 +2154,7 @@ ExprResult Parser::ParseObjCAtExpression
return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
default:
- if (Tok.getIdentifierInfo() == 0)
+ if (Tok.getIdentifierInfo() == nullptr)
return ExprError(Diag(AtLoc, diag::err_unexpected_at));
switch (Tok.getIdentifierInfo()->getObjCKeywordID()) {
@@ -2163,13 +2165,13 @@ ExprResult Parser::ParseObjCAtExpression
case tok::objc_selector:
return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
default: {
- const char *str = 0;
+ const char *str = nullptr;
if (GetLookAheadToken(1).is(tok::l_brace)) {
char ch = Tok.getIdentifierInfo()->getNameStart()[0];
str =
ch == 't' ? "try"
: (ch == 'f' ? "finally"
- : (ch == 'a' ? "autoreleasepool" : 0));
+ : (ch == 'a' ? "autoreleasepool" : nullptr));
}
if (str) {
SourceLocation kwLoc = Tok.getLocation();
@@ -2342,11 +2344,11 @@ ExprResult Parser::ParseObjCMessageExpre
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope())
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(),
- ParsedType(), 0);
+ ParsedType(), nullptr);
// Parse the receiver, which is either a type or an expression.
bool IsExpr;
- void *TypeOrExpr = NULL;
+ void *TypeOrExpr = nullptr;
if (ParseObjCXXMessageReceiver(IsExpr, TypeOrExpr)) {
SkipUntil(tok::r_square, StopAtSemi);
return ExprError();
@@ -2359,7 +2361,7 @@ ExprResult Parser::ParseObjCMessageExpre
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
ParsedType::getFromOpaquePtr(TypeOrExpr),
- 0);
+ nullptr);
}
if (Tok.is(tok::identifier)) {
@@ -2372,7 +2374,7 @@ ExprResult Parser::ParseObjCMessageExpre
ReceiverType)) {
case Sema::ObjCSuperMessage:
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(),
- ParsedType(), 0);
+ ParsedType(), nullptr);
case Sema::ObjCClassMessage:
if (!ReceiverType) {
@@ -2383,8 +2385,8 @@ ExprResult Parser::ParseObjCMessageExpre
ConsumeToken(); // the type name
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
- ReceiverType, 0);
-
+ ReceiverType, nullptr);
+
case Sema::ObjCInstanceMessage:
// Fall through to parse an expression.
break;
@@ -2867,7 +2869,7 @@ ExprResult Parser::ParseObjCSelectorExpr
while (1) {
if (TryConsumeToken(tok::coloncolon)) { // Handle :: in C++.
++nColons;
- KeyIdents.push_back(0);
+ KeyIdents.push_back(nullptr);
} else if (ExpectAndConsume(tok::colon)) // Otherwise expect ':'.
return ExprError();
++nColons;
Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Wed May 21 01:02:52 2014
@@ -261,7 +261,7 @@ bool Parser::ParseOpenMPSimpleVarList(Op
///
OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OpenMPClauseKind CKind, bool FirstClause) {
- OMPClause *Clause = 0;
+ OMPClause *Clause = nullptr;
bool ErrorFound = false;
// Check if clause is allowed for the given directive.
if (CKind != OMPC_unknown && !isAllowedClauseForDirective(DKind, CKind)) {
@@ -318,7 +318,7 @@ OMPClause *Parser::ParseOpenMPClause(Ope
SkipUntil(tok::comma, tok::annot_pragma_openmp_end, StopBeforeMatch);
break;
}
- return ErrorFound ? 0 : Clause;
+ return ErrorFound ? nullptr : Clause;
}
/// \brief Parsing of OpenMP clauses with single expressions like 'if',
@@ -340,7 +340,7 @@ OMPClause *Parser::ParseOpenMPSingleExpr
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(diag::err_expected_lparen_after,
getOpenMPClauseName(Kind)))
- return 0;
+ return nullptr;
ExprResult LHS(ParseCastExpression(false, false, NotTypeCast));
ExprResult Val(ParseRHSOfBinaryExpression(LHS, prec::Conditional));
@@ -349,7 +349,7 @@ OMPClause *Parser::ParseOpenMPSingleExpr
T.consumeClose();
if (Val.isInvalid())
- return 0;
+ return nullptr;
return Actions.ActOnOpenMPSingleExprClause(Kind, Val.take(), Loc,
T.getOpenLocation(),
@@ -371,7 +371,7 @@ OMPClause *Parser::ParseOpenMPSimpleClau
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(diag::err_expected_lparen_after,
getOpenMPClauseName(Kind)))
- return 0;
+ return nullptr;
unsigned Type =
getOpenMPSimpleClauseType(Kind,
@@ -408,7 +408,7 @@ OMPClause *Parser::ParseOpenMPVarListCla
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(diag::err_expected_lparen_after,
getOpenMPClauseName(Kind)))
- return 0;
+ return nullptr;
SmallVector<Expr *, 5> Vars;
bool IsComma = true;
@@ -435,7 +435,7 @@ OMPClause *Parser::ParseOpenMPVarListCla
}
// Parse ':' linear-step
- Expr *TailExpr = 0;
+ Expr *TailExpr = nullptr;
const bool MustHaveTail = MayHaveTail && Tok.is(tok::colon);
if (MustHaveTail) {
ColonLoc = Tok.getLocation();
@@ -451,7 +451,7 @@ OMPClause *Parser::ParseOpenMPVarListCla
// Parse ')'.
T.consumeClose();
if (Vars.empty() || (MustHaveTail && !TailExpr))
- return 0;
+ return nullptr;
return Actions.ActOnOpenMPVarListClause(Kind, Vars, TailExpr, Loc, LOpen,
ColonLoc, Tok.getLocation());
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Wed May 21 01:02:52 2014
@@ -585,7 +585,7 @@ void PragmaGCCVisibilityHandler::HandleP
const IdentifierInfo *VisType;
if (PushPop && PushPop->isStr("pop")) {
- VisType = 0;
+ VisType = nullptr;
} else if (PushPop && PushPop->isStr("push")) {
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::l_paren)) {
@@ -645,7 +645,7 @@ void PragmaPackHandler::HandlePragma(Pre
}
Sema::PragmaPackKind Kind = Sema::PPK_Default;
- IdentifierInfo *Name = 0;
+ IdentifierInfo *Name = nullptr;
Token Alignment;
Alignment.startToken();
SourceLocation LParenLoc = Tok.getLocation();
@@ -1233,7 +1233,7 @@ void PragmaMSPointersToMembers::HandlePr
} else if (Tok.is(tok::r_paren)) {
// #pragma pointers_to_members(full_generality) implicitly specifies
// virtual_inheritance.
- Arg = 0;
+ Arg = nullptr;
RepresentationMethod = LangOptions::PPTMK_FullGeneralityVirtualInheritance;
} else {
PP.Diag(Tok.getLocation(), diag::err_expected_punc)
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Wed May 21 01:02:52 2014
@@ -115,7 +115,7 @@ Parser::ParseStatementOrDeclaration(Stmt
ParenBraceBracketBalancer BalancerRAIIObj(*this);
ParsedAttributesWithRange Attrs(AttrFactory);
- MaybeParseCXX11Attributes(Attrs, 0, /*MightBeObjCMessageSend*/ true);
+ MaybeParseCXX11Attributes(Attrs, nullptr, /*MightBeObjCMessageSend*/ true);
StmtResult Res = ParseStatementOrDeclarationAfterAttributes(Stmts,
OnlyStatement, TrailingElseLoc, Attrs);
@@ -165,7 +165,7 @@ StmtResult
Parser::ParseStatementOrDeclarationAfterAttributes(StmtVector &Stmts,
bool OnlyStatement, SourceLocation *TrailingElseLoc,
ParsedAttributesWithRange &Attrs) {
- const char *SemiError = 0;
+ const char *SemiError = nullptr;
StmtResult Res;
// Cases in this switch statement should fall through if the parser expects
@@ -548,7 +548,7 @@ StmtResult Parser::ParseLabeledStatement
// can't handle GNU attributes), so only call it in the one case where
// GNU attributes are allowed.
SubStmt = ParseStatementOrDeclarationAfterAttributes(
- Stmts, /*OnlyStmts*/ true, 0, TempAttrs);
+ Stmts, /*OnlyStmts*/ true, nullptr, TempAttrs);
if (!TempAttrs.empty() && !SubStmt.isInvalid())
SubStmt = Actions.ProcessStmtAttributes(
SubStmt.get(), TempAttrs.getList(), TempAttrs.Range);
@@ -605,7 +605,7 @@ StmtResult Parser::ParseCaseStatement(bo
// DeepestParsedCaseStmt - This is the deepest statement we have parsed, which
// gets updated each time a new case is parsed, and whose body is unset so
// far. When parsing 'case 4', this is the 'case 3' node.
- Stmt *DeepestParsedCaseStmt = 0;
+ Stmt *DeepestParsedCaseStmt = nullptr;
// While we have case statements, eat and stack them.
SourceLocation ColonLoc;
@@ -927,7 +927,8 @@ StmtResult Parser::ParseCompoundStatemen
ConsumeToken();
ParsedAttributesWithRange attrs(AttrFactory);
- MaybeParseCXX11Attributes(attrs, 0, /*MightBeObjCMessageSend*/ true);
+ MaybeParseCXX11Attributes(attrs, nullptr,
+ /*MightBeObjCMessageSend*/ true);
// If this is the start of a declaration, parse it as such.
if (isDeclarationStatement()) {
@@ -995,7 +996,7 @@ bool Parser::ParseParenExprOrCondition(E
ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean);
else {
ExprResult = ParseExpression();
- DeclResult = 0;
+ DeclResult = nullptr;
// If required, convert to a boolean value.
if (!ExprResult.isInvalid() && ConvertToBoolean)
@@ -1065,7 +1066,7 @@ StmtResult Parser::ParseIfStatement(Sour
// Parse the condition.
ExprResult CondExp;
- Decl *CondVar = 0;
+ Decl *CondVar = nullptr;
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
return StmtError();
@@ -1141,8 +1142,8 @@ StmtResult Parser::ParseIfStatement(Sour
// make turn the invalid one into a null stmt to avoid dropping the other
// part. If both are invalid, return error.
if ((ThenStmt.isInvalid() && ElseStmt.isInvalid()) ||
- (ThenStmt.isInvalid() && ElseStmt.get() == 0) ||
- (ThenStmt.get() == 0 && ElseStmt.isInvalid())) {
+ (ThenStmt.isInvalid() && ElseStmt.get() == nullptr) ||
+ (ThenStmt.get() == nullptr && ElseStmt.isInvalid())) {
// Both invalid, or one is invalid and other is non-present: return error.
return StmtError();
}
@@ -1192,7 +1193,7 @@ StmtResult Parser::ParseSwitchStatement(
// Parse the condition.
ExprResult Cond;
- Decl *CondVar = 0;
+ Decl *CondVar = nullptr;
if (ParseParenExprOrCondition(Cond, CondVar, SwitchLoc, false))
return StmtError();
@@ -1284,7 +1285,7 @@ StmtResult Parser::ParseWhileStatement(S
// Parse the condition.
ExprResult Cond;
- Decl *CondVar = 0;
+ Decl *CondVar = nullptr;
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
@@ -1450,7 +1451,7 @@ StmtResult Parser::ParseForStatement(Sou
ExprResult Collection;
ForRangeInit ForRangeInit;
FullExprArg ThirdPart(Actions);
- Decl *SecondVar = 0;
+ Decl *SecondVar = nullptr;
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(),
@@ -1778,7 +1779,7 @@ namespace {
bool IsUnevaluatedContext) override {
// Collect the desired tokens.
SmallVector<Token, 16> LineToks;
- const Token *FirstOrigToken = 0;
+ const Token *FirstOrigToken = nullptr;
findTokensForString(LineBuf, LineToks, FirstOrigToken);
unsigned NumConsumedToks;
@@ -2146,7 +2147,7 @@ StmtResult Parser::ParseMicrosoftAsmStat
const llvm::Triple &TheTriple = Actions.Context.getTargetInfo().getTriple();
llvm::Triple::ArchType ArchTy = TheTriple.getArch();
const std::string &TT = TheTriple.getTriple();
- const llvm::Target *TheTarget = 0;
+ const llvm::Target *TheTarget = nullptr;
bool UnsupportedArch = (ArchTy != llvm::Triple::x86 &&
ArchTy != llvm::Triple::x86_64);
if (UnsupportedArch) {
@@ -2325,7 +2326,7 @@ StmtResult Parser::ParseAsmStatement(boo
// We have a simple asm expression like 'asm("foo")'.
T.consumeClose();
return Actions.ActOnGCCAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile,
- /*NumOutputs*/ 0, /*NumInputs*/ 0, 0,
+ /*NumOutputs*/ 0, /*NumInputs*/ 0, nullptr,
Constraints, Exprs, AsmString.take(),
Clobbers, T.getCloseLocation());
}
@@ -2432,7 +2433,7 @@ bool Parser::ParseAsmOperandsOpt(SmallVe
Names.push_back(II);
T.consumeClose();
} else
- Names.push_back(0);
+ Names.push_back(nullptr);
ExprResult Constraint(ParseAsmStringLiteral());
if (Constraint.isInvalid()) {
@@ -2664,7 +2665,7 @@ StmtResult Parser::ParseCXXCatchBlock(bo
// exception-declaration is equivalent to '...' or a parameter-declaration
// without default arguments.
- Decl *ExceptionDecl = 0;
+ Decl *ExceptionDecl = nullptr;
if (Tok.isNot(tok::ellipsis)) {
ParsedAttributesWithRange Attributes(AttrFactory);
MaybeParseCXX11Attributes(Attributes);
Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Wed May 21 01:02:52 2014
@@ -107,7 +107,7 @@ Parser::ParseTemplateDeclarationOrSpecia
SourceLocation TemplateLoc;
if (!TryConsumeToken(tok::kw_template, TemplateLoc)) {
Diag(Tok.getLocation(), diag::err_expected_template);
- return 0;
+ return nullptr;
}
// Parse the '<' template-parameter-list '>'
@@ -118,7 +118,7 @@ Parser::ParseTemplateDeclarationOrSpecia
// Skip until the semi-colon or a }.
SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
TryConsumeToken(tok::semi);
- return 0;
+ return nullptr;
}
ParamLists.push_back(
@@ -170,7 +170,7 @@ Parser::ParseSingleDeclarationAfterTempl
// We are parsing a member template.
ParseCXXClassMemberDeclaration(AS, AccessAttrs, TemplateInfo,
&DiagsFromTParams);
- return 0;
+ return nullptr;
}
ParsedAttributesWithRange prefixAttrs(AttrFactory);
@@ -214,7 +214,7 @@ Parser::ParseSingleDeclarationAfterTempl
SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
if (Tok.is(tok::semi))
ConsumeToken();
- return 0;
+ return nullptr;
}
LateParsedAttrList LateParsedAttrs(true);
@@ -250,8 +250,8 @@ Parser::ParseSingleDeclarationAfterTempl
// Recover as if it were an explicit specialization.
TemplateParameterLists FakedParamLists;
FakedParamLists.push_back(Actions.ActOnTemplateParameterList(
- 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, 0, 0,
- LAngleLoc));
+ 0, SourceLocation(), TemplateInfo.TemplateLoc, LAngleLoc, nullptr,
+ 0, LAngleLoc));
return ParseFunctionDefinition(
DeclaratorInfo, ParsedTemplateInfo(&FakedParamLists,
@@ -485,7 +485,7 @@ Decl *Parser::ParseTypeParameter(unsigne
// Grab the template parameter name (if given)
SourceLocation NameLoc;
- IdentifierInfo* ParamName = 0;
+ IdentifierInfo *ParamName = nullptr;
if (Tok.is(tok::identifier)) {
ParamName = Tok.getIdentifierInfo();
NameLoc = ConsumeToken();
@@ -495,7 +495,7 @@ Decl *Parser::ParseTypeParameter(unsigne
// don't consume this token.
} else {
Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
- return 0;
+ return nullptr;
}
// Grab a default argument (if available).
@@ -504,7 +504,7 @@ Decl *Parser::ParseTypeParameter(unsigne
SourceLocation EqualLoc;
ParsedType DefaultArg;
if (TryConsumeToken(tok::equal, EqualLoc))
- DefaultArg = ParseTypeName(/*Range=*/0,
+ DefaultArg = ParseTypeName(/*Range=*/nullptr,
Declarator::TemplateTypeArgContext).get();
return Actions.ActOnTypeParameter(getCurScope(), TypenameKeyword, Ellipsis,
@@ -532,7 +532,7 @@ Parser::ParseTemplateTemplateParameter(u
ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
if (ParseTemplateParameters(Depth + 1, TemplateParams, LAngleLoc,
RAngleLoc)) {
- return 0;
+ return nullptr;
}
}
@@ -566,7 +566,7 @@ Parser::ParseTemplateTemplateParameter(u
// Get the identifier, if given.
SourceLocation NameLoc;
- IdentifierInfo* ParamName = 0;
+ IdentifierInfo *ParamName = nullptr;
if (Tok.is(tok::identifier)) {
ParamName = Tok.getIdentifierInfo();
NameLoc = ConsumeToken();
@@ -576,7 +576,7 @@ Parser::ParseTemplateTemplateParameter(u
// don't consume this token.
} else {
Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
- return 0;
+ return nullptr;
}
TemplateParameterList *ParamList =
@@ -626,7 +626,7 @@ Parser::ParseNonTypeTemplateParameter(un
ParseDeclarator(ParamDecl);
if (DS.getTypeSpecType() == DeclSpec::TST_unspecified) {
Diag(Tok.getLocation(), diag::err_expected_template_parameter);
- return 0;
+ return nullptr;
}
// If there is a default value, parse it.
@@ -919,7 +919,7 @@ bool Parser::AnnotateTemplateIdToken(Tem
TemplateId->Name = TemplateName.Identifier;
TemplateId->Operator = OO_None;
} else {
- TemplateId->Name = 0;
+ TemplateId->Name = nullptr;
TemplateId->Operator = TemplateName.OperatorFunctionId.Operator;
}
TemplateId->SS = SS;
@@ -1086,7 +1086,7 @@ ParsedTemplateArgument Parser::ParseTemp
// Therefore, we initially try to parse a type-id.
if (isCXXTypeId(TypeIdAsTemplateArgument)) {
SourceLocation Loc = Tok.getLocation();
- TypeResult TypeArg = ParseTypeName(/*Range=*/0,
+ TypeResult TypeArg = ParseTypeName(/*Range=*/nullptr,
Declarator::TemplateTypeArgContext);
if (TypeArg.isInvalid())
return ParsedTemplateArgument();
@@ -1299,7 +1299,7 @@ void Parser::ParseLateTemplatedFuncDef(L
ParseFunctionStatementBody(LPT.D, FnScope);
Actions.UnmarkAsLateParsedTemplate(FunD);
} else
- Actions.ActOnFinishFunctionBody(LPT.D, 0);
+ Actions.ActOnFinishFunctionBody(LPT.D, nullptr);
}
// Exit scopes.
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Wed May 21 01:02:52 2014
@@ -56,10 +56,10 @@ Parser::Parser(Preprocessor &pp, Sema &a
SkipFunctionBodies = pp.isCodeCompletionEnabled() || skipFunctionBodies;
Tok.startToken();
Tok.setKind(tok::eof);
- Actions.CurScope = 0;
+ Actions.CurScope = nullptr;
NumCachedScopes = 0;
ParenCount = BracketCount = BraceCount = 0;
- CurParsedObjCImpl = 0;
+ CurParsedObjCImpl = nullptr;
// Add #pragma handlers. These are removed and destroyed in the
// destructor.
@@ -136,7 +136,7 @@ bool Parser::ExpectAndConsume(tok::Token
}
SourceLocation EndLoc = PP.getLocForEndOfToken(PrevTokLocation);
- const char *Spelling = 0;
+ const char *Spelling = nullptr;
if (EndLoc.isValid())
Spelling = tok::getPunctuatorSpelling(ExpectedTok);
@@ -380,7 +380,7 @@ void Parser::ExitScope() {
/// this object does nothing.
Parser::ParseScopeFlags::ParseScopeFlags(Parser *Self, unsigned ScopeFlags,
bool ManageFlags)
- : CurScope(ManageFlags ? Self->getCurScope() : 0) {
+ : CurScope(ManageFlags ? Self->getCurScope() : nullptr) {
if (CurScope) {
OldFlags = CurScope->getFlags();
CurScope->setFlags(ScopeFlags);
@@ -402,8 +402,8 @@ Parser::ParseScopeFlags::~ParseScopeFlag
Parser::~Parser() {
// If we still have scopes active, delete the scope tree.
delete getCurScope();
- Actions.CurScope = 0;
-
+ Actions.CurScope = nullptr;
+
// Free the scope cache.
for (unsigned i = 0, e = NumCachedScopes; i != e; ++i)
delete ScopeCache[i];
@@ -421,7 +421,7 @@ Parser::~Parser() {
///
void Parser::Initialize() {
// Create the translation unit scope. Install it as the current scope.
- assert(getCurScope() == 0 && "A scope is already active?");
+ assert(getCurScope() == nullptr && "A scope is already active?");
EnterScope(Scope::DeclScope);
Actions.ActOnTranslationUnitScope(getCurScope());
@@ -436,10 +436,10 @@ void Parser::Initialize() {
ObjCTypeQuals[objc_byref] = &PP.getIdentifierTable().get("byref");
}
- Ident_instancetype = 0;
- Ident_final = 0;
- Ident_sealed = 0;
- Ident_override = 0;
+ Ident_instancetype = nullptr;
+ Ident_final = nullptr;
+ Ident_sealed = nullptr;
+ Ident_override = nullptr;
Ident_super = &PP.getIdentifierTable().get("super");
@@ -449,16 +449,18 @@ void Parser::Initialize() {
Ident_bool = &PP.getIdentifierTable().get("bool");
}
- Ident_introduced = 0;
- Ident_deprecated = 0;
- Ident_obsoleted = 0;
- Ident_unavailable = 0;
-
- Ident__except = 0;
-
- Ident__exception_code = Ident__exception_info = Ident__abnormal_termination = 0;
- Ident___exception_code = Ident___exception_info = Ident___abnormal_termination = 0;
- Ident_GetExceptionCode = Ident_GetExceptionInfo = Ident_AbnormalTermination = 0;
+ Ident_introduced = nullptr;
+ Ident_deprecated = nullptr;
+ Ident_obsoleted = nullptr;
+ Ident_unavailable = nullptr;
+
+ Ident__except = nullptr;
+
+ Ident__exception_code = Ident__exception_info = nullptr;
+ Ident__abnormal_termination = Ident___exception_code = nullptr;
+ Ident___exception_info = Ident___abnormal_termination = nullptr;
+ Ident_GetExceptionCode = Ident_GetExceptionInfo = nullptr;
+ Ident_AbnormalTermination = nullptr;
if(getLangOpts().Borland) {
Ident__exception_info = PP.getIdentifierInfo("_exception_info");
@@ -592,7 +594,7 @@ Parser::ParseExternalDeclaration(ParsedA
return DeclGroupPtrTy();
}
- Decl *SingleDecl = 0;
+ Decl *SingleDecl = nullptr;
switch (Tok.getKind()) {
case tok::annot_pragma_vis:
HandlePragmaVisibility();
@@ -860,7 +862,7 @@ Parser::ParseDeclOrFunctionDefInternal(P
DS.abort();
- const char *PrevSpec = 0;
+ const char *PrevSpec = nullptr;
unsigned DiagID;
if (DS.SetTypeSpecType(DeclSpec::TST_unspecified, AtLoc, PrevSpec, DiagID,
Actions.getASTContext().getPrintingPolicy()))
@@ -957,7 +959,7 @@ Decl *Parser::ParseFunctionDefinition(Pa
// If we didn't find the '{', bail out.
if (Tok.isNot(tok::l_brace))
- return 0;
+ return nullptr;
}
// Check to make sure that any normal attributes are allowed to be on
@@ -1041,8 +1043,8 @@ Decl *Parser::ParseFunctionDefinition(Pa
if (TryConsumeToken(tok::equal)) {
assert(getLangOpts().CPlusPlus && "Only C++ function definitions have '='");
- Actions.ActOnFinishFunctionBody(Res, 0, false);
-
+ Actions.ActOnFinishFunctionBody(Res, nullptr, false);
+
bool Delete = false;
SourceLocation KWLoc;
if (TryConsumeToken(tok::kw_delete, KWLoc)) {
@@ -1083,7 +1085,7 @@ Decl *Parser::ParseFunctionDefinition(Pa
// Recover from error.
if (!Tok.is(tok::l_brace)) {
BodyScope.Exit();
- Actions.ActOnFinishFunctionBody(Res, 0);
+ Actions.ActOnFinishFunctionBody(Res, nullptr);
return Res;
}
} else
@@ -1359,7 +1361,7 @@ Parser::TryAnnotateName(bool IsAddressOf
// jump back into scope specifier parsing).
Sema::NameClassification Classification
= Actions.ClassifyName(getCurScope(), SS, Name, NameLoc, Next,
- IsAddressOfOperand, SS.isEmpty() ? CCC : 0);
+ IsAddressOfOperand, SS.isEmpty() ? CCC : nullptr);
switch (Classification.getKind()) {
case Sema::NC_Error:
@@ -1513,7 +1515,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
CXXScopeSpec SS;
if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/ParsedType(),
/*EnteringContext=*/false,
- 0, /*IsTypename*/true))
+ nullptr, /*IsTypename*/ true))
return true;
if (!SS.isSet()) {
if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id) ||
@@ -1596,7 +1598,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
CXXScopeSpec &SS,
bool IsNewScope) {
if (Tok.is(tok::identifier)) {
- IdentifierInfo *CorrectedII = 0;
+ IdentifierInfo *CorrectedII = nullptr;
// Determine whether the identifier is a type name.
if (ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
Tok.getLocation(), getCurScope(),
@@ -1604,8 +1606,9 @@ bool Parser::TryAnnotateTypeOrScopeToken
NextToken().is(tok::period),
ParsedType(),
/*IsCtorOrDtorName=*/false,
- /*NonTrivialTypeSourceInfo*/true,
- NeedType ? &CorrectedII : NULL)) {
+ /*NonTrivialTypeSourceInfo*/ true,
+ NeedType ? &CorrectedII
+ : nullptr)) {
// A FixIt was applied as a result of typo correction
if (CorrectedII)
Tok.setIdentifierInfo(CorrectedII);
Modified: cfe/trunk/lib/Parse/RAIIObjectsForParser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/RAIIObjectsForParser.h?rev=209275&r1=209274&r2=209275&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/RAIIObjectsForParser.h (original)
+++ cfe/trunk/lib/Parse/RAIIObjectsForParser.h Wed May 21 01:02:52 2014
@@ -50,7 +50,7 @@ namespace clang {
public:
/// Begin suppressing access-like checks
SuppressAccessChecks(Parser &P, bool activate = true)
- : S(P.getActions()), DiagnosticPool(NULL) {
+ : S(P.getActions()), DiagnosticPool(nullptr) {
if (activate) {
State = S.PushParsingDeclaration(DiagnosticPool);
Active = true;
@@ -61,7 +61,7 @@ namespace clang {
void done() {
assert(Active && "trying to end an inactive suppression");
- S.PopParsingDeclaration(State, NULL);
+ S.PopParsingDeclaration(State, nullptr);
Active = false;
}
@@ -93,7 +93,7 @@ namespace clang {
public:
enum NoParent_t { NoParent };
ParsingDeclRAIIObject(Parser &P, NoParent_t _)
- : Actions(P.getActions()), DiagnosticPool(NULL) {
+ : Actions(P.getActions()), DiagnosticPool(nullptr) {
push();
}
@@ -109,7 +109,7 @@ namespace clang {
/// RAII object (which is assumed to be the current top pool).
ParsingDeclRAIIObject(Parser &P, ParsingDeclRAIIObject *other)
: Actions(P.getActions()),
- DiagnosticPool(other ? other->DiagnosticPool.getParent() : NULL) {
+ DiagnosticPool(other ? other->DiagnosticPool.getParent() : nullptr) {
if (other) {
DiagnosticPool.steal(other->DiagnosticPool);
other->abort();
@@ -137,7 +137,7 @@ namespace clang {
/// Signals that the context was completed without an appropriate
/// declaration being parsed.
void abort() {
- pop(0);
+ pop(nullptr);
}
void complete(Decl *D) {
@@ -148,7 +148,7 @@ namespace clang {
/// Unregister this object from Sema, but remember all the
/// diagnostics that were emitted into it.
void abortAndRemember() {
- pop(0);
+ pop(nullptr);
}
private:
More information about the cfe-commits
mailing list