diff options
Diffstat (limited to 'include/clang/Parse/Parser.h')
-rw-r--r-- | include/clang/Parse/Parser.h | 120 |
1 files changed, 61 insertions, 59 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 1c6c5bd0bb..0b15eb6841 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -584,7 +584,7 @@ private: ANK_Success }; AnnotatedNameKind TryAnnotateName(bool IsAddressOfOperand, - CorrectionCandidateCallback *CCC = 0); + CorrectionCandidateCallback *CCC = nullptr); /// Push a tok::annot_cxxscope token onto the token stream. void AnnotateScopeToken(CXXScopeSpec &SS, bool IsNewAnnotation); @@ -697,7 +697,7 @@ private: public: explicit ObjCDeclContextSwitch(Parser &p) : P(p), DC(p.getObjCDeclContext()), - WithinObjCContainer(P.ParsingInObjCContainer, DC != 0) { + WithinObjCContainer(P.ParsingInObjCContainer, DC != nullptr) { if (DC) P.Actions.ActOnObjCTemporaryExitContainerContext(cast<DeclContext>(DC)); } @@ -765,7 +765,7 @@ public: if (BeforeCompoundStmt) Self->incrementMSLocalManglingNumber(); - this->Self = 0; + this->Self = nullptr; } } @@ -774,7 +774,7 @@ public: void Exit() { if (Self) { Self->ExitScope(); - Self = 0; + Self = nullptr; } } @@ -961,7 +961,7 @@ private: /// (C++ [class.mem]p2). struct LateParsedDefaultArgument { explicit LateParsedDefaultArgument(Decl *P, - CachedTokens *Toks = 0) + CachedTokens *Toks = nullptr) : Param(P), Toks(Toks) { } /// Param - The parameter declaration for this parameter. @@ -980,7 +980,8 @@ private: /// argument (C++ [class.mem]p2). struct LateParsedMethodDeclaration : public LateParsedDeclaration { explicit LateParsedMethodDeclaration(Parser *P, Decl *M) - : Self(P), Method(M), TemplateScope(false), ExceptionSpecTokens(0) { } + : Self(P), Method(M), TemplateScope(false), + ExceptionSpecTokens(nullptr) {} void ParseLexedMethodDeclarations() override; @@ -1103,7 +1104,7 @@ private: /// specifiers. struct ParsedTemplateInfo { ParsedTemplateInfo() - : Kind(NonTemplate), TemplateParams(0), TemplateLoc() { } + : Kind(NonTemplate), TemplateParams(nullptr), TemplateLoc() { } ParsedTemplateInfo(TemplateParameterLists *TemplateParams, bool isSpecialization, @@ -1114,7 +1115,7 @@ private: explicit ParsedTemplateInfo(SourceLocation ExternLoc, SourceLocation TemplateLoc) - : Kind(ExplicitInstantiation), TemplateParams(0), + : Kind(ExplicitInstantiation), TemplateParams(nullptr), ExternLoc(ExternLoc), TemplateLoc(TemplateLoc), LastParameterListWasEmpty(false){ } @@ -1207,12 +1208,12 @@ private: }; DeclGroupPtrTy ParseExternalDeclaration(ParsedAttributesWithRange &attrs, - ParsingDeclSpec *DS = 0); + ParsingDeclSpec *DS = nullptr); bool isDeclarationAfterDeclarator(); bool isStartOfFunctionDefinition(const ParsingDeclarator &Declarator); DeclGroupPtrTy ParseDeclarationOrFunctionDefinition( ParsedAttributesWithRange &attrs, - ParsingDeclSpec *DS = 0, + ParsingDeclSpec *DS = nullptr, AccessSpecifier AS = AS_none); DeclGroupPtrTy ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs, ParsingDeclSpec &DS, @@ -1220,11 +1221,11 @@ private: Decl *ParseFunctionDefinition(ParsingDeclarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), - LateParsedAttrList *LateParsedAttrs = 0); + LateParsedAttrList *LateParsedAttrs = nullptr); void ParseKNRParamDeclarations(Declarator &D); // EndLoc, if non-NULL, is filled with the location of the last token of // the simple-asm. - ExprResult ParseSimpleAsm(SourceLocation *EndLoc = 0); + ExprResult ParseSimpleAsm(SourceLocation *EndLoc = nullptr); ExprResult ParseAsmStringLiteral(); // Objective-C External Declarations @@ -1364,12 +1365,12 @@ private: typedef SmallVector<SourceLocation, 20> CommaLocsTy; /// ParseExpressionList - Used for C/C++ (argument-)expression-list. - bool ParseExpressionList(SmallVectorImpl<Expr*> &Exprs, - SmallVectorImpl<SourceLocation> &CommaLocs, - void (Sema::*Completer)(Scope *S, - Expr *Data, - ArrayRef<Expr *> Args) = 0, - Expr *Data = 0); + bool + ParseExpressionList(SmallVectorImpl<Expr *> &Exprs, + SmallVectorImpl<SourceLocation> &CommaLocs, + void (Sema::*Completer)(Scope *S, Expr *Data, + ArrayRef<Expr *> Args) = nullptr, + Expr *Data = nullptr); /// ParseSimpleExpressionList - A simple comma-separated list of expressions, /// used for misc language extensions. @@ -1416,9 +1417,9 @@ private: bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext, - bool *MayBePseudoDestructor = 0, + bool *MayBePseudoDestructor = nullptr, bool IsTypename = false, - IdentifierInfo **LastII = 0); + IdentifierInfo **LastII = nullptr); void CheckForLParenAfterColonColon(); @@ -1429,7 +1430,7 @@ private: ExprResult ParseLambdaExpression(); ExprResult TryParseLambdaExpression(); Optional<unsigned> ParseLambdaIntroducer(LambdaIntroducer &Intro, - bool *SkippedInits = 0); + bool *SkippedInits = nullptr); bool TryParseLambdaIntroducer(LambdaIntroducer &Intro); ExprResult ParseLambdaExpressionAfterIntroducer( LambdaIntroducer &Intro); @@ -1565,10 +1566,10 @@ private: /// A SmallVector of types. typedef SmallVector<ParsedType, 12> TypeVector; - StmtResult ParseStatement(SourceLocation *TrailingElseLoc = 0); - StmtResult ParseStatementOrDeclaration(StmtVector &Stmts, - bool OnlyStatement, - SourceLocation *TrailingElseLoc = 0); + StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr); + StmtResult + ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement, + SourceLocation *TrailingElseLoc = nullptr); StmtResult ParseStatementOrDeclarationAfterAttributes( StmtVector &Stmts, bool OnlyStatement, @@ -1717,12 +1718,12 @@ private: SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs, bool RequireSemi, - ForRangeInit *FRI = 0); + ForRangeInit *FRI = nullptr); bool MightBeDeclarator(unsigned Context); DeclGroupPtrTy ParseDeclGroup(ParsingDeclSpec &DS, unsigned Context, bool AllowFunctionDefinitions, - SourceLocation *DeclEnd = 0, - ForRangeInit *FRI = 0); + SourceLocation *DeclEnd = nullptr, + ForRangeInit *FRI = nullptr); Decl *ParseDeclarationAfterDeclarator(Declarator &D, const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo()); bool ParseAsmAttributesAfterDeclarator(Declarator &D); @@ -1746,10 +1747,10 @@ private: const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), AccessSpecifier AS = AS_none, DeclSpecContext DSC = DSC_normal, - LateParsedAttrList *LateAttrs = 0); + LateParsedAttrList *LateAttrs = nullptr); bool DiagnoseMissingSemiAfterTagDefinition(DeclSpec &DS, AccessSpecifier AS, - DeclSpecContext DSContext, - LateParsedAttrList *LateAttrs = 0); + DeclSpecContext DSContext, + LateParsedAttrList *LateAttrs = nullptr); void ParseSpecifierQualifierList(DeclSpec &DS, AccessSpecifier AS = AS_none, DeclSpecContext DSC = DSC_normal); @@ -1873,7 +1874,7 @@ private: /// might be a constructor-style initializer. /// If during the disambiguation process a parsing error is encountered, /// the function returns true to let the declaration parsing code handle it. - bool isCXXFunctionDeclarator(bool *IsAmbiguous = 0); + bool isCXXFunctionDeclarator(bool *IsAmbiguous = nullptr); /// isCXXConditionDeclaration - Disambiguates between a declaration or an /// expression for a condition of a if/switch/while/for statement. @@ -1931,7 +1932,7 @@ private: /// Doesn't consume tokens. TPResult isCXXDeclarationSpecifier(TPResult BracedCastResult = TPResult::False(), - bool *HasMissingTypename = 0); + bool *HasMissingTypename = nullptr); /// Given that isCXXDeclarationSpecifier returns \c TPResult::True or /// \c TPResult::Ambiguous, determine whether the decl-specifier would be @@ -1957,19 +1958,20 @@ private: TPResult TryParseOperatorId(); TPResult TryParseInitDeclaratorList(); TPResult TryParseDeclarator(bool mayBeAbstract, bool mayHaveIdentifier=true); - TPResult TryParseParameterDeclarationClause(bool *InvalidAsDeclaration = 0, - bool VersusTemplateArg = false); + TPResult + TryParseParameterDeclarationClause(bool *InvalidAsDeclaration = nullptr, + bool VersusTemplateArg = false); TPResult TryParseFunctionDeclarator(); TPResult TryParseBracketDeclarator(); TPResult TryConsumeDeclarationSpecifier(); public: - TypeResult ParseTypeName(SourceRange *Range = 0, + TypeResult ParseTypeName(SourceRange *Range = nullptr, Declarator::TheContext Context = Declarator::TypeNameContext, AccessSpecifier AS = AS_none, - Decl **OwnedType = 0, - ParsedAttributes *Attrs = 0); + Decl **OwnedType = nullptr, + ParsedAttributes *Attrs = nullptr); private: void ParseBlockId(SourceLocation CaretLoc); @@ -2022,7 +2024,7 @@ private: AttributeList::Syntax Syntax); void MaybeParseGNUAttributes(Declarator &D, - LateParsedAttrList *LateAttrs = 0) { + LateParsedAttrList *LateAttrs = nullptr) { if (Tok.is(tok::kw___attribute)) { ParsedAttributes attrs(AttrFactory); SourceLocation endLoc; @@ -2031,15 +2033,15 @@ private: } } void MaybeParseGNUAttributes(ParsedAttributes &attrs, - SourceLocation *endLoc = 0, - LateParsedAttrList *LateAttrs = 0) { + SourceLocation *endLoc = nullptr, + LateParsedAttrList *LateAttrs = nullptr) { if (Tok.is(tok::kw___attribute)) ParseGNUAttributes(attrs, endLoc, LateAttrs); } void ParseGNUAttributes(ParsedAttributes &attrs, - SourceLocation *endLoc = 0, - LateParsedAttrList *LateAttrs = 0, - Declarator *D = 0); + SourceLocation *endLoc = nullptr, + LateParsedAttrList *LateAttrs = nullptr, + Declarator *D = nullptr); void ParseGNUAttributeArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, @@ -2059,7 +2061,7 @@ private: } } void MaybeParseCXX11Attributes(ParsedAttributes &attrs, - SourceLocation *endLoc = 0) { + SourceLocation *endLoc = nullptr) { if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier()) { ParsedAttributesWithRange attrsWithRange(AttrFactory); ParseCXX11Attributes(attrsWithRange, endLoc); @@ -2067,7 +2069,7 @@ private: } } void MaybeParseCXX11Attributes(ParsedAttributesWithRange &attrs, - SourceLocation *endLoc = 0, + SourceLocation *endLoc = nullptr, bool OuterMightBeMessageSend = false) { if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier(false, OuterMightBeMessageSend)) @@ -2075,9 +2077,9 @@ private: } void ParseCXX11AttributeSpecifier(ParsedAttributes &attrs, - SourceLocation *EndLoc = 0); + SourceLocation *EndLoc = nullptr); void ParseCXX11Attributes(ParsedAttributesWithRange &attrs, - SourceLocation *EndLoc = 0); + SourceLocation *EndLoc = nullptr); /// \brief Parses a C++-style attribute argument list. Returns true if this /// results in adding an attribute to the ParsedAttributes list. bool ParseCXX11AttributeArgs(IdentifierInfo *AttrName, @@ -2089,12 +2091,12 @@ private: IdentifierInfo *TryParseCXX11AttributeIdentifier(SourceLocation &Loc); void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs, - SourceLocation *endLoc = 0) { + SourceLocation *endLoc = nullptr) { if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(attrs, endLoc); } void ParseMicrosoftAttributes(ParsedAttributes &attrs, - SourceLocation *endLoc = 0); + SourceLocation *endLoc = nullptr); void ParseMicrosoftDeclSpec(ParsedAttributes &Attrs); bool ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName, SourceLocation AttrNameLoc, @@ -2137,7 +2139,7 @@ private: ExprResult ParseAlignArgument(SourceLocation Start, SourceLocation &EllipsisLoc); void ParseAlignmentSpecifier(ParsedAttributes &Attrs, - SourceLocation *endLoc = 0); + SourceLocation *endLoc = nullptr); VirtSpecifiers::Specifier isCXX11VirtSpecifier(const Token &Tok) const; VirtSpecifiers::Specifier isCXX11VirtSpecifier() const { @@ -2241,7 +2243,7 @@ private: const ParsedTemplateInfo &TemplateInfo, SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs, - Decl **OwnedType = 0); + Decl **OwnedType = nullptr); Decl *ParseUsingDirective(unsigned Context, SourceLocation UsingLoc, SourceLocation &DeclEnd, @@ -2251,7 +2253,7 @@ private: SourceLocation UsingLoc, SourceLocation &DeclEnd, AccessSpecifier AS = AS_none, - Decl **OwnedType = 0); + Decl **OwnedType = nullptr); Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd); Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, @@ -2277,8 +2279,8 @@ private: ExprResult &BitfieldSize, LateParsedAttrList &LateAttrs); void ParseCXXClassMemberDeclaration(AccessSpecifier AS, AttributeList *Attr, - const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), - ParsingDeclRAIIObject *DiagsFromTParams = 0); + const ParsedTemplateInfo &TemplateInfo = ParsedTemplateInfo(), + ParsingDeclRAIIObject *DiagsFromTParams = nullptr); void ParseConstructorInitializer(Decl *ConstructorDecl); MemInitResult ParseMemInitializer(Decl *ConstructorDecl); void HandleMemberFunctionDeclDelays(Declarator& DeclaratorInfo, @@ -2358,9 +2360,9 @@ private: // C++ 14.1: Template Parameters [temp.param] Decl *ParseDeclarationStartingWithTemplate(unsigned Context, - SourceLocation &DeclEnd, - AccessSpecifier AS = AS_none, - AttributeList *AccessAttrs = 0); + SourceLocation &DeclEnd, + AccessSpecifier AS = AS_none, + AttributeList *AccessAttrs = nullptr); Decl *ParseTemplateDeclarationOrSpecialization(unsigned Context, SourceLocation &DeclEnd, AccessSpecifier AS, @@ -2371,7 +2373,7 @@ private: ParsingDeclRAIIObject &DiagsFromParams, SourceLocation &DeclEnd, AccessSpecifier AS=AS_none, - AttributeList *AccessAttrs = 0); + AttributeList *AccessAttrs = nullptr); bool ParseTemplateParameters(unsigned Depth, SmallVectorImpl<Decl*> &TemplateParams, SourceLocation &LAngleLoc, |