clang
9.0.0
|
Parser - This implements a parser for the C family of languages. More...
#include "clang/Parse/Parser.h"
Classes | |
struct | ConditionDeclarationOrInitStatementState |
class | ObjCTypeParamListScope |
Class to handle popping type parameters when leaving the scope. More... | |
struct | OpenMPVarListDataTy |
Data used for parsing list of variables in OpenMP clauses. More... | |
class | ParseScope |
ParseScope - Introduces a new scope for parsing. More... | |
class | UnannotatedTentativeParsingAction |
A tentative parsing action that can also revert token annotations. More... | |
Public Types | |
enum | SkipUntilFlags { StopAtSemi = 1 << 0, StopBeforeMatch = 1 << 1, StopAtCodeCompletion = 1 << 2 } |
Control flags for SkipUntil functions. More... | |
enum | TypeCastState { NotTypeCast = 0, MaybeTypeCast, IsTypeCast } |
TypeCastState - State whether an expression is or may be a type cast. More... | |
typedef OpaquePtr< DeclGroupRef > | DeclGroupPtrTy |
typedef OpaquePtr< TemplateName > | TemplateTy |
typedef SmallVector< TemplateParameterList *, 4 > | TemplateParameterLists |
typedef Sema::FullExprArg | FullExprArg |
Public Member Functions | |
Parser (Preprocessor &PP, Sema &Actions, bool SkipFunctionBodies) | |
~Parser () override | |
const LangOptions & | getLangOpts () const |
const TargetInfo & | getTargetInfo () const |
Preprocessor & | getPreprocessor () const |
Sema & | getActions () const |
AttributeFactory & | getAttrFactory () |
const Token & | getCurToken () const |
Scope * | getCurScope () const |
void | incrementMSManglingNumber () const |
Decl * | getObjCDeclContext () const |
void | Initialize () |
Initialize - Warm up the parser. More... | |
bool | ParseFirstTopLevelDecl (DeclGroupPtrTy &Result) |
Parse the first top-level declaration in a translation unit. More... | |
bool | ParseTopLevelDecl (DeclGroupPtrTy &Result, bool IsFirstDecl=false) |
ParseTopLevelDecl - Parse one top-level declaration. More... | |
bool | ParseTopLevelDecl () |
SourceLocation | ConsumeToken () |
ConsumeToken - Consume the current 'peek token' and lex the next one. More... | |
bool | TryConsumeToken (tok::TokenKind Expected) |
bool | TryConsumeToken (tok::TokenKind Expected, SourceLocation &Loc) |
SourceLocation | ConsumeAnyToken (bool ConsumeCodeCompletionTok=false) |
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type. More... | |
SourceLocation | getEndOfPreviousToken () |
IdentifierInfo * | getNullabilityKeyword (NullabilityKind nullability) |
Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds to the given nullability kind. More... | |
const Token & | NextToken () |
NextToken - This peeks ahead one token and returns it without consuming it. More... | |
bool | TryAnnotateTypeOrScopeToken () |
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C++) or a C++ scope specifier not followed by a typename, TryAnnotateTypeOrScopeToken will replace one or more tokens with a single annotation token representing the typename or C++ scope respectively. More... | |
bool | TryAnnotateTypeOrScopeTokenAfterScopeSpec (CXXScopeSpec &SS, bool IsNewScope) |
Try to annotate a type or scope token, having already parsed an optional scope specifier. More... | |
bool | TryAnnotateCXXScopeToken (bool EnteringContext=false) |
TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only annotates C++ scope specifiers and template-ids. More... | |
void | EnterScope (unsigned ScopeFlags) |
EnterScope - Start a new scope. More... | |
void | ExitScope () |
ExitScope - Pop a scope off the scope stack. More... | |
DiagnosticBuilder | Diag (SourceLocation Loc, unsigned DiagID) |
DiagnosticBuilder | Diag (const Token &Tok, unsigned DiagID) |
DiagnosticBuilder | Diag (unsigned DiagID) |
bool | SkipUntil (tok::TokenKind T, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0)) |
SkipUntil - Read tokens until we get to the specified token, then consume it (unless StopBeforeMatch is specified). More... | |
bool | SkipUntil (tok::TokenKind T1, tok::TokenKind T2, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0)) |
bool | SkipUntil (tok::TokenKind T1, tok::TokenKind T2, tok::TokenKind T3, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0)) |
bool | SkipUntil (ArrayRef< tok::TokenKind > Toks, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0)) |
SkipUntil - Read tokens until we get to the specified token, then consume it (unless no flag StopBeforeMatch). More... | |
void | SkipMalformedDecl () |
SkipMalformedDecl - Read tokens until we get to some likely good stopping point for skipping past a simple-declaration. More... | |
ExprResult | ParseExpression (TypeCastState isTypeCast=NotTypeCast) |
Simple precedence-based parser for binary/ternary operators. More... | |
ExprResult | ParseConstantExpressionInExprEvalContext (TypeCastState isTypeCast=NotTypeCast) |
ExprResult | ParseConstantExpression (TypeCastState isTypeCast=NotTypeCast) |
ExprResult | ParseCaseExpression (SourceLocation CaseLoc) |
ExprResult | ParseConstraintExpression () |
Parse a constraint-expression. More... | |
ExprResult | ParseAssignmentExpression (TypeCastState isTypeCast=NotTypeCast) |
Parse an expr that doesn't include (top-level) commas. More... | |
ExprResult | ParseMSAsmIdentifier (llvm::SmallVectorImpl< Token > &LineToks, unsigned &NumLineToksConsumed, bool IsUnevaluated) |
Parse an identifier in an MS-style inline assembly block. More... | |
TypeResult | ParseTypeName (SourceRange *Range=nullptr, DeclaratorContext Context=DeclaratorContext::TypeNameContext, AccessSpecifier AS=AS_none, Decl **OwnedType=nullptr, ParsedAttributes *Attrs=nullptr) |
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt]. More... | |
ExprResult | ParseOpenMPParensExpr (StringRef ClauseName, SourceLocation &RLoc) |
Parses simple expression in parens for single-expression clauses of OpenMP constructs. More... | |
bool | ParseOpenMPVarList (OpenMPDirectiveKind DKind, OpenMPClauseKind Kind, SmallVectorImpl< Expr *> &Vars, OpenMPVarListDataTy &Data) |
Parses clauses with list. More... | |
bool | ParseUnqualifiedId (CXXScopeSpec &SS, bool EnteringContext, bool AllowDestructorName, bool AllowConstructorName, bool AllowDeductionGuide, ParsedType ObjectType, SourceLocation *TemplateKWLoc, UnqualifiedId &Result) |
Parse a C++ unqualified-id (or a C identifier), which describes the name of an entity. More... | |
bool | parseMapperModifier (OpenMPVarListDataTy &Data) |
Parses the mapper modifier in map, to, and from clauses. More... | |
bool | parseMapTypeModifiers (OpenMPVarListDataTy &Data) |
Parses map-type-modifiers in map clause. More... | |
![]() | |
virtual | ~CodeCompletionHandler () |
Static Public Member Functions | |
static ParsedType | getTypeAnnotation (const Token &Tok) |
getTypeAnnotation - Read a parsed type out of an annotation token. More... | |
Friends | |
class | ColonProtectionRAIIObject |
class | InMessageExpressionRAIIObject |
class | PoisonSEHIdentifiersRAIIObject |
class | ObjCDeclContextSwitch |
class | ParenBraceBracketBalancer |
class | BalancedDelimiterTracker |
constexpr SkipUntilFlags | operator| (SkipUntilFlags L, SkipUntilFlags R) |
Parser - This implements a parser for the C family of languages.
After parsing units of the grammar, productions are invoked to handle whatever has been read.
Parser::Parser | ( | Preprocessor & | PP, |
Sema & | Actions, | ||
bool | SkipFunctionBodies | ||
) |
Definition at line 50 of file Parser.cpp.
References clang::Preprocessor::addCommentHandler(), clang::comments::tok::eof, clang::Preprocessor::isCodeCompletionEnabled(), clang::Preprocessor::setCodeCompletionHandler(), clang::Token::setKind(), and clang::Token::startToken().
Referenced by clang::Parser::AngleBracketTracker::Loc::isActiveOrNested().
|
override |
Definition at line 416 of file Parser.cpp.
References clang::Preprocessor::clearCodeCompletionHandler(), getCurScope(), getLangOpts(), i, clang::Preprocessor::isIncrementalProcessingEnabled(), and clang::Preprocessor::removeCommentHandler().
Referenced by clang::Parser::AngleBracketTracker::Loc::isActiveOrNested().
|
inline |
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
This should only be used in cases where the type of the token really isn't known, e.g. in error recovery.
Definition at line 476 of file Parser.h.
References ConsumeToken(), clang::Token::is(), and clang::Token::isAnnotation().
Referenced by IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), SkipMalformedDecl(), SkipUntil(), and TypeTraitArity().
|
inline |
ConsumeToken - Consume the current 'peek token' and lex the next one.
This does not work with special tokens: string literals, code completion, annotation tokens and balanced tokens must be handled using the specific consume methods. Returns the location of the consumed token.
Definition at line 448 of file Parser.h.
References clang::Token::getLocation(), and clang::Preprocessor::Lex().
Referenced by addConstevalToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), attributeParsedArgsUnevaluated(), CheckArrayDesignatorSyntax(), CheckAvailabilitySpecList(), ConsumeAnyToken(), clang::BalancedDelimiterTracker::consumeClose(), diagnoseDynamicExceptionSpecification(), diagnoseRedundantPropertyNullability(), FindLocsWithCommonFileID(), getMissingDeclaratorIdLoc(), Initialize(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isEndOfTemplateArgument(), isPipeDeclerator(), isValidAfterIdentifierInDeclarator(), clang::Parser::ObjCTypeParamListScope::leave(), clang::Parser::ConditionDeclarationOrInitStatementState::markNotExpression(), ParseConstraintExpression(), parseDeclareSimdClauses(), parseMapType(), parseOpenMPDirectiveKind(), parseOpenMPReductionId(), ParseReductionId(), ParseTopLevelDecl(), ParseUnqualifiedId(), clang::Parser::UnannotatedTentativeParsingAction::RevertAnnotations(), SkipMalformedDecl(), SkipUntil(), takeDeclAttributes(), TryAnnotateTypeOrScopeToken(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), tryConsumeLambdaSpecifierToken(), TypeTraitArity(), and VersionNumberSeparator().
DiagnosticBuilder Parser::Diag | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Definition at line 72 of file Parser.cpp.
References clang::DiagnosticsEngine::Report().
Referenced by addConstevalToLambdaDeclSpecifier(), addConstexprToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), CheckArrayDesignatorSyntax(), CheckAvailabilitySpecList(), clang::BalancedDelimiterTracker::consumeClose(), Diag(), diagnoseDynamicExceptionSpecification(), diagnoseExpectedAttributeSubjectSubRule(), diagnoseRedundantPropertyNullability(), diagnoseUnknownAttributeSubjectSubRule(), FixDigraph(), getMissingDeclaratorIdLoc(), getTypeAnnotation(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isPipeDeclerator(), isValidAfterIdentifierInDeclarator(), clang::Parser::ObjCTypeParamListScope::leave(), ParseConstraintExpression(), parseDeclareSimdClauses(), ParseFirstTopLevelDecl(), parseMapType(), parseOpenMPReductionId(), ParseTopLevelDecl(), ParseUnqualifiedId(), takeDeclAttributes(), TryAnnotateCXXScopeToken(), TryAnnotateTypeOrScopeToken(), tryConsumeLambdaSpecifierToken(), TypeTraitArity(), VersionNumberSeparator(), and clang::Parser::ParseScope::~ParseScope().
DiagnosticBuilder Parser::Diag | ( | const Token & | Tok, |
unsigned | DiagID | ||
) |
Definition at line 76 of file Parser.cpp.
References clang::FixItHint::CreateInsertion(), Diag(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::Token::getLocation(), clang::Preprocessor::getLocForEndOfToken(), clang::SourceLocation::isFileID(), and clang::SourceLocation::isInvalid().
|
inline |
void Parser::EnterScope | ( | unsigned | ScopeFlags | ) |
EnterScope - Start a new scope.
Definition at line 366 of file Parser.cpp.
References getCurScope(), and clang::Scope::Init().
Referenced by Initialize(), clang::Parser::ParseScope::ParseScope(), and clang::Parser::ParseScope::~ParseScope().
void Parser::ExitScope | ( | ) |
ExitScope - Pop a scope off the scope stack.
Definition at line 377 of file Parser.cpp.
References clang::Sema::ActOnPopScope(), getCurScope(), clang::Token::getLocation(), and clang::Scope::getParent().
Referenced by clang::Parser::ParseScope::Exit(), and clang::Parser::ParseScope::~ParseScope().
|
inline |
Definition at line 406 of file Parser.h.
Referenced by parseDeclareSimdClauses(), and parseOpenMPReductionId().
|
inline |
|
inline |
Definition at line 410 of file Parser.h.
References clang::Sema::getCurScope().
Referenced by addConstevalToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), CheckArrayDesignatorSyntax(), diagnoseDynamicExceptionSpecification(), diagnoseRedundantPropertyNullability(), EnterScope(), ExitScope(), getMissingDeclaratorIdLoc(), Initialize(), isValidAfterIdentifierInDeclarator(), clang::Parser::ObjCTypeParamListScope::leave(), ParseAssignmentExpression(), ParseConstraintExpression(), ParseExpression(), ParseTopLevelDecl(), ParseUnqualifiedId(), SetupFixedPointError(), takeDeclAttributes(), TryAnnotateTypeOrScopeToken(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), TypeTraitArity(), and ~Parser().
|
inline |
Definition at line 409 of file Parser.h.
Referenced by isMapModifier(), isMapType(), parseDeclareSimdClauses(), parseMapType(), parseOpenMPDirectiveKind(), parseOpenMPReductionId(), ParseReductionId(), and tryConsumeLambdaSpecifierToken().
|
inline |
Definition at line 494 of file Parser.h.
References clang::Preprocessor::getLocForEndOfToken().
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Definition at line 403 of file Parser.h.
References clang::Preprocessor::getLangOpts().
Referenced by addConstevalToLambdaDeclSpecifier(), addConstexprToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), CheckArrayDesignatorSyntax(), clang::BalancedDelimiterTracker::consumeOpen(), diagnoseDynamicExceptionSpecification(), diagnoseRedundantPropertyNullability(), getMissingDeclaratorIdLoc(), getTypeAnnotation(), Initialize(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isPipeDeclerator(), isValidAfterIdentifierInDeclarator(), clang::Parser::ObjCTypeParamListScope::leave(), ParseConstraintExpression(), ParseFirstTopLevelDecl(), ParseTopLevelDecl(), ParseUnqualifiedId(), clang::Parser::ConditionDeclarationOrInitStatementState::result(), clang::Parser::UnannotatedTentativeParsingAction::RevertAnnotations(), SetupFixedPointError(), takeDeclAttributes(), TryAnnotateCXXScopeToken(), TryAnnotateTypeOrScopeToken(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), TypeTraitArity(), and ~Parser().
|
inline |
Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds to the given nullability kind.
Definition at line 500 of file Parser.h.
References clang::Token::getKind(), clang::Sema::getNullabilityKeyword(), clang::Token::is(), clang::Token::isAnnotation(), clang::Token::isOneOf(), and clang::tok::isStringLiteral().
Referenced by addContextSensitiveTypeNullability().
|
inline |
Definition at line 415 of file Parser.h.
References clang::Sema::getObjCDeclContext().
Referenced by getMissingDeclaratorIdLoc(), and getTypeAnnotation().
|
inline |
Definition at line 405 of file Parser.h.
Referenced by isMapModifier(), isMapType(), and parseOpenMPDirectiveKind().
|
inline |
Definition at line 404 of file Parser.h.
References clang::Preprocessor::getTargetInfo().
Referenced by IsBuiltInOrStandardCXX11Attribute(), and takeDeclAttributes().
|
inlinestatic |
getTypeAnnotation - Read a parsed type out of an annotation token.
Definition at line 760 of file Parser.h.
References clang::Sema::ActOnObjCReenterContainerContext(), clang::Sema::ActOnObjCTemporaryExitContainerContext(), clang::Preprocessor::Backtrack(), clang::Preprocessor::CommitBacktrackedTokens(), Diag(), clang::Preprocessor::EnableBacktrackAtThisPos(), clang::Token::getAnnotationValue(), clang::OpaquePtr< PtrTy >::getAsOpaquePtr(), clang::OpaquePtr< QualType >::getFromOpaquePtr(), clang::Token::getIdentifierInfo(), clang::Preprocessor::getIdentifierInfo(), getLangOpts(), getObjCDeclContext(), clang::Token::isAnnotation(), isInvalid(), ObjCDeclContextSwitch, P, p, clang::Token::setAnnotationValue(), TryAnnotateCXXScopeToken(), TryAnnotateTypeOrScopeToken(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), and clang::TST_unspecified.
Referenced by takeDeclAttributes().
|
inline |
Definition at line 411 of file Parser.h.
References clang::Sema::incrementMSManglingNumber().
Referenced by clang::Parser::ParseScope::ParseScope().
void Parser::Initialize | ( | ) |
Initialize - Warm up the parser.
Definition at line 445 of file Parser.cpp.
References clang::Sema::ActOnTranslationUnitScope(), ConsumeToken(), clang::Scope::DeclScope, EnterScope(), clang::IdentifierTable::get(), getCurScope(), clang::Preprocessor::getIdentifierInfo(), clang::Preprocessor::getIdentifierTable(), getLangOpts(), clang::Sema::Initialize(), P, and clang::Preprocessor::SetPoisonReason().
|
inline |
NextToken - This peeks ahead one token and returns it without consuming it.
Definition at line 755 of file Parser.h.
References clang::Preprocessor::LookAhead().
Referenced by addConstevalToLambdaDeclSpecifier(), CheckArrayDesignatorSyntax(), clang::BalancedDelimiterTracker::consumeClose(), getMissingDeclaratorIdLoc(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isPipeDeclerator(), isValidAfterIdentifierInDeclarator(), ParseTopLevelDecl(), ParseUnqualifiedId(), SkipMalformedDecl(), takeDeclAttributes(), TryAnnotateCXXScopeToken(), TryAnnotateTypeOrScopeToken(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), and TypeTraitArity().
ExprResult Parser::ParseAssignmentExpression | ( | TypeCastState | isTypeCast = NotTypeCast | ) |
Parse an expr that doesn't include (top-level) commas.
Definition at line 159 of file ParseExpr.cpp.
References clang::prec::Assignment, clang::Sema::CodeCompleteExpression(), clang::ExprError(), clang::PreferredTypeBuilder::get(), getCurScope(), clang::Token::getLocation(), and clang::Token::is().
Referenced by CheckArrayDesignatorSyntax(), getMissingDeclaratorIdLoc(), ParseConstraintExpression(), and ParseExpression().
ExprResult Parser::ParseCaseExpression | ( | SourceLocation | CaseLoc | ) |
Definition at line 220 of file ParseExpr.cpp.
References clang::Sema::ActOnCaseExpr(), clang::prec::Conditional, clang::Sema::ConstantEvaluated, and NotTypeCast.
ExprResult Parser::ParseConstantExpression | ( | TypeCastState | isTypeCast = NotTypeCast | ) |
Definition at line 210 of file ParseExpr.cpp.
References clang::Sema::ConstantEvaluated, and ParseConstantExpressionInExprEvalContext().
Referenced by CheckArrayDesignatorSyntax(), getMissingDeclaratorIdLoc(), and ParseUnqualifiedId().
ExprResult Parser::ParseConstantExpressionInExprEvalContext | ( | TypeCastState | isTypeCast = NotTypeCast | ) |
Definition at line 200 of file ParseExpr.cpp.
References clang::Sema::ActOnConstantExpression(), clang::prec::Conditional, clang::Sema::ConstantEvaluated, and clang::Sema::ExprEvalContexts.
Referenced by ParseConstantExpression().
ExprResult Parser::ParseConstraintExpression | ( | ) |
Parse a constraint-expression.
/// constraint-expression: [Concepts TS temp.constr.decl p1] /// logical-or-expression ///
Definition at line 234 of file ParseExpr.cpp.
References clang::Sema::ActOnBinOp(), clang::Sema::ActOnConditionalOp(), clang::prec::Assignment, ColonLoc, clang::prec::Conditional, ConsumeToken(), clang::Sema::CorrectDelayedTyposInExpr(), clang::frontend::CPlusPlus, clang::frontend::CPlusPlus11, clang::FixItHint::CreateInsertion(), Diag(), clang::PreferredTypeBuilder::enterBinary(), clang::Preprocessor::EnterToken(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::getBinOpPrecedence(), clang::SourceManager::getCharacterData(), getCurScope(), clang::Sema::getExprRange(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), clang::SourceLocation::getLocWithOffset(), clang::Preprocessor::getSourceManager(), clang::Preprocessor::getSpelling(), clang::Token::is(), clang::Preprocessor::isAtStartOfMacroExpansion(), clang::SourceLocation::isFileID(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Token::isNot(), clang::Token::isOneOf(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::prec::LogicalOr, ParseAssignmentExpression(), ParseExpression(), SM, clang::prec::Spaceship, TryConsumeToken(), clang::prec::Unknown, and X.
ExprResult Parser::ParseExpression | ( | TypeCastState | isTypeCast = NotTypeCast | ) |
Simple precedence-based parser for binary/ternary operators.
Note: we diverge from the C99 grammar when parsing the assignment-expression production. C99 specifies that the LHS of an assignment operator should be parsed as a unary-expression, but consistency dictates that it be a conditional-expession. In practice, the important thing here is that the LHS of an assignment has to be an l-value, which productions between unary-expression and conditional-expression don't produce. Because we want consistency, we parse the LHS as a conditional-expression, then check for l-value-ness in semantic analysis stages.
/// pm-expression: [C++ 5.5] /// cast-expression /// pm-expression '.*' cast-expression /// pm-expression '->*' cast-expression /// /// multiplicative-expression: [C99 6.5.5] /// Note: in C++, apply pm-expression instead of cast-expression /// cast-expression /// multiplicative-expression '*' cast-expression /// multiplicative-expression '/' cast-expression /// multiplicative-expression '%' cast-expression /// /// additive-expression: [C99 6.5.6] /// multiplicative-expression /// additive-expression '+' multiplicative-expression /// additive-expression '-' multiplicative-expression /// /// shift-expression: [C99 6.5.7] /// additive-expression /// shift-expression '<<' additive-expression /// shift-expression '>>' additive-expression /// /// compare-expression: [C++20 expr.spaceship] /// shift-expression /// compare-expression '<=>' shift-expression /// /// relational-expression: [C99 6.5.8] /// compare-expression /// relational-expression '<' compare-expression /// relational-expression '>' compare-expression /// relational-expression '<=' compare-expression /// relational-expression '>=' compare-expression /// /// equality-expression: [C99 6.5.9] /// relational-expression /// equality-expression '==' relational-expression /// equality-expression '!=' relational-expression /// /// AND-expression: [C99 6.5.10] /// equality-expression /// AND-expression '&' equality-expression /// /// exclusive-OR-expression: [C99 6.5.11] /// AND-expression /// exclusive-OR-expression '^' AND-expression /// /// inclusive-OR-expression: [C99 6.5.12] /// exclusive-OR-expression /// inclusive-OR-expression '|' exclusive-OR-expression /// /// logical-AND-expression: [C99 6.5.13] /// inclusive-OR-expression /// logical-AND-expression '&&' inclusive-OR-expression /// /// logical-OR-expression: [C99 6.5.14] /// logical-AND-expression /// logical-OR-expression '||' logical-AND-expression /// /// conditional-expression: [C99 6.5.15] /// logical-OR-expression /// logical-OR-expression '?' expression ':' conditional-expression /// [GNU] logical-OR-expression '?' ':' conditional-expression /// [C++] the third operand is an assignment-expression /// /// assignment-expression: [C99 6.5.16] /// conditional-expression /// unary-expression assignment-operator assignment-expression /// [C++] throw-expression [C++ 15] /// /// assignment-operator: one of /// = *= /= %= += -= <<= >>= &= ^= |= /// /// expression: [C99 6.5.17] /// assignment-expression ...[opt] /// expression ',' assignment-expression ...[opt] ///
Definition at line 122 of file ParseExpr.cpp.
References clang::Sema::ActOnUnaryOp(), clang::prec::Comma, clang::ActionResult< PtrTy, CompressInvalid >::get(), getCurScope(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and ParseAssignmentExpression().
Referenced by addConstevalToLambdaDeclSpecifier(), ParseConstraintExpression(), ParseUnqualifiedId(), takeDeclAttributes(), and TypeTraitArity().
bool Parser::ParseFirstTopLevelDecl | ( | DeclGroupPtrTy & | Result | ) |
Parse the first top-level declaration in a translation unit.
translation-unit: [C] external-declaration [C] translation-unit external-declaration [C++] top-level-declaration-seq[opt] [C++20] global-module-fragment[opt] module-declaration top-level-declaration-seq[opt] private-module-fragment[opt]
Note that in C, it is an error if there is no first declaration.
Definition at line 553 of file Parser.cpp.
References clang::Sema::ActOnStartOfTranslationUnit(), Diag(), clang::Sema::getASTContext(), clang::ASTContext::getExternalSource(), getLangOpts(), and ParseTopLevelDecl().
bool Parser::parseMapperModifier | ( | OpenMPVarListDataTy & | Data | ) |
Parses the mapper modifier in map, to, and from clauses.
Parse the mapper modifier in map, to, and from clauses.
Definition at line 2080 of file ParseOpenMP.cpp.
References clang::BalancedDelimiterTracker::consumeClose(), clang::frontend::CPlusPlus, Diag(), clang::BalancedDelimiterTracker::expectAndConsume(), clang::format::FormatToken::isNot(), clang::Parser::OpenMPVarListDataTy::ReductionOrMapperId, clang::Parser::OpenMPVarListDataTy::ReductionOrMapperIdScopeSpec, and clang::format::Tok.
bool Parser::parseMapTypeModifiers | ( | OpenMPVarListDataTy & | Data | ) |
Parses map-type-modifiers in map clause.
Parse map-type-modifiers in map clause.
map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list) where, map-type-modifier ::= always | close | mapper(mapper-identifier)
Definition at line 2110 of file ParseOpenMP.cpp.
References Diag(), clang::format::FormatToken::is(), isMapModifier(), clang::Parser::OpenMPVarListDataTy::MapTypeModifiers, clang::Parser::OpenMPVarListDataTy::MapTypeModifiersLoc, and clang::format::Tok.
ExprResult Parser::ParseMSAsmIdentifier | ( | llvm::SmallVectorImpl< Token > & | LineToks, |
unsigned & | NumLineToksConsumed, | ||
bool | IsUnevaluated | ||
) |
Parse an identifier in an MS-style inline assembly block.
Definition at line 200 of file ParseStmtAsm.cpp.
References clang::frontend::CPlusPlus, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Token::getIdentifierInfo(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), i, Id, clang::Token::is(), clang::Token::isNot(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::Result, clang::Token::setKind(), and clang::Token::startToken().
ExprResult Parser::ParseOpenMPParensExpr | ( | StringRef | ClauseName, |
SourceLocation & | RLoc | ||
) |
Parses simple expression in parens for single-expression clauses of OpenMP constructs.
RLoc | Returned location of right paren. |
Definition at line 1734 of file ParseOpenMP.cpp.
References clang::prec::Conditional, clang::BalancedDelimiterTracker::consumeClose(), Diag(), clang::BalancedDelimiterTracker::expectAndConsume(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::BalancedDelimiterTracker::getCloseLocation(), clang::BalancedDelimiterTracker::getOpenLocation(), clang::getOpenMPClauseName(), clang::getOpenMPSimpleClauseType(), clang::format::FormatToken::is(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::format::FormatToken::isNot(), clang::SourceLocation::isValid(), clang::OMPC_DEFAULTMAP_MODIFIER_unknown, clang::OMPC_SCHEDULE_MODIFIER_unknown, clang::OMPC_SCHEDULE_unknown, clang::OMPD_unknown, parseOpenMPDirectiveKind(), and clang::format::Tok.
Referenced by parseDeclareSimdClauses().
bool Parser::ParseOpenMPVarList | ( | OpenMPDirectiveKind | DKind, |
OpenMPClauseKind | Kind, | ||
SmallVectorImpl< Expr *> & | Vars, | ||
OpenMPVarListDataTy & | Data | ||
) |
Parses clauses with list.
Definition at line 2173 of file ParseOpenMP.cpp.
References clang::Parser::OpenMPVarListDataTy::ColonLoc, clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), clang::frontend::CPlusPlus, clang::Parser::OpenMPVarListDataTy::DepKind, clang::Parser::OpenMPVarListDataTy::DepLinMapLoc, Diag(), clang::BalancedDelimiterTracker::expectAndConsume(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::BalancedDelimiterTracker::getCloseLocation(), clang::BalancedDelimiterTracker::getOpenLocation(), clang::getOpenMPClauseName(), clang::getOpenMPDirectiveName(), clang::getOpenMPSimpleClauseType(), clang::format::FormatToken::is(), clang::Parser::OpenMPVarListDataTy::IsMapTypeImplicit, clang::format::FormatToken::isNot(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::Parser::OpenMPVarListDataTy::LinKind, clang::Parser::OpenMPVarListDataTy::MapType, clang::Parser::OpenMPVarListDataTy::MapTypeModifiers, clang::Parser::OpenMPVarListDataTy::MapTypeModifiersLoc, Modifier, clang::OMPC_DEPEND_unknown, clang::OMPC_MAP_unknown, parseMapType(), ParseReductionId(), clang::Parser::OpenMPVarListDataTy::ReductionOrMapperId, clang::Parser::OpenMPVarListDataTy::ReductionOrMapperIdScopeSpec, clang::Parser::OpenMPVarListDataTy::RLoc, clang::Parser::OpenMPVarListDataTy::TailExpr, and clang::format::Tok.
Referenced by parseDeclareSimdClauses().
bool Parser::ParseTopLevelDecl | ( | DeclGroupPtrTy & | Result, |
bool | IsFirstDecl = false |
||
) |
ParseTopLevelDecl - Parse one top-level declaration.
ParseTopLevelDecl - Parse one top-level declaration, return whatever the action tells us to.
Returns true if the EOF was encountered.
This returns true if the EOF was encountered.
top-level-declaration: declaration [C++20] module-import-declaration
Definition at line 574 of file Parser.cpp.
References clang::ParsingDeclSpec::abort(), clang::Sema::ActOnDefaultCtorInitializers(), clang::Sema::ActOnEmptyDeclaration(), clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnFileScopeAsmDecl(), clang::Sema::ActOnFinishFunctionBody(), clang::Sema::ActOnFinishKNRParamDeclarations(), clang::Sema::ActOnModuleBegin(), clang::Sema::ActOnModuleEnd(), clang::Sema::ActOnModuleInclude(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnSkippedFunctionBody(), clang::Sema::ActOnStartOfFunctionDef(), clang::Preprocessor::AnnotateCachedTokens(), clang::AS_none, clang::Sema::BuildDeclaratorGroup(), clang::Sema::canDelayFunctionBody(), clang::Sema::canSkipFunctionBody(), clang::Sema::CheckForFunctionRedefinition(), clang::Declarator::clear(), clang::DeclSpec::ClearStorageClassSpecs(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::CodeCompleteOrdinaryName(), clang::ParsingDeclSpec::complete(), clang::ParsingDeclarator::complete(), clang::Scope::CompoundStmtScope, clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), ConsumeToken(), clang::Sema::ConvertDeclToDeclGroup(), clang::frontend::CPlusPlus, clang::frontend::CPlusPlus11, clang::FixItHint::CreateRemoval(), clang::Sema::CurContext, clang::Scope::DeclScope, clang::diff::Delete, Diag(), clang::Preprocessor::EnterToken(), clang::comments::tok::eof, clang::Parser::ParseScope::Exit(), clang::ExprError(), clang::FDK_Definition, clang::FileContext, clang::Scope::FnScope, clang::Scope::FunctionDeclarationScope, clang::Scope::FunctionPrototypeScope, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Token::getAnnotationValue(), clang::Decl::getAsFunction(), clang::Sema::getASTContext(), clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::SourceRange::getBegin(), clang::Decl::getBody(), clang::BalancedDelimiterTracker::getCloseLocation(), getCurScope(), clang::ParsingDeclarator::getDeclSpec(), clang::Declarator::getFunctionTypeInfo(), clang::Declarator::getIdentifier(), clang::Token::getIdentifierInfo(), clang::Declarator::getIdentifierLoc(), clang::Token::getKind(), getKind(), getLangOpts(), clang::Token::getLocation(), clang::Preprocessor::getLocForEndOfToken(), clang::SourceLocation::getLocWithOffset(), clang::ParsingDeclarator::getMutableDeclSpec(), clang::Scope::getParent(), clang::DeclSpec::getParsedSpecifiers(), clang::ASTContext::getPrintingPolicy(), clang::CXXScopeSpec::getRange(), clang::DeclSpec::getSourceRange(), clang::DeclSpec::getStorageClassSpec(), clang::DeclSpec::getStorageClassSpecLoc(), clang::DeclSpec::getThreadStorageClassSpec(), clang::DeclSpec::getThreadStorageClassSpecLoc(), clang::DeclSpec::getTypeSpecType(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::Sema::HandleDeclarator(), clang::DeclSpec::hasTagDefinition(), i, Id, clang::DeclaratorChunk::ParamInfo::Ident, clang::frontend::ImplicitInt, clang::Token::is(), clang::Preprocessor::isBacktrackEnabled(), clang::Preprocessor::isCodeCompletionReached(), clang::DeclSpec::isDeclRep(), clang::Token::isEditorPlaceholder(), clang::DeclSpec::isEmpty(), clang::Declarator::isFunctionDeclarator(), clang::Preprocessor::isIncrementalProcessingEnabled(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::CXXScopeSpec::isInvalid(), clang::DeclaratorChunk::FunctionTypeInfo::isKNRPrototype(), clang::Token::isNot(), clang::Token::isObjCAtKeyword(), clang::DeclContext::isTranslationUnit(), clang::KNRTypeListContext, clang::Sema::MarkAsLateParsedTemplate(), NextToken(), clang::None, clang::DeclaratorChunk::FunctionTypeInfo::NumParams, ObjCDeclContextSwitch, clang::OpenCL, clang::DeclaratorChunk::ParamInfo::Param, clang::DeclaratorChunk::FunctionTypeInfo::Params, clang::Sema::ParsedFreeStandingDeclSpec(), clang::Sema::PCC_Namespace, clang::Sema::PCC_ObjCImplementation, clang::DeclSpec::PQ_StorageClassSpecifier, clang::Result, clang::Preprocessor::RevertCachedTokens(), clang::Sema::SaveNestedNameSpecifierAnnotation(), clang::DeclSpec::SCS_extern, clang::DeclSpec::SCS_register, clang::DeclSpec::SCS_unspecified, clang::Token::setAnnotationRange(), clang::Token::setAnnotationValue(), clang::Declarator::setCommaLoc(), clang::Sema::setCurrentOpenCLExtensionForDecl(), clang::Sema::SetDeclDefaulted(), clang::Sema::SetDeclDeleted(), clang::Declarator::setFunctionDefinitionKind(), clang::Token::setKind(), clang::Sema::SetLateTemplateParser(), clang::Declarator::SetRangeBegin(), clang::DeclSpec::SetTypeSpecType(), clang::Sema::SkipBodyInfo::ShouldSkip, SkipMalformedDecl(), SkipUntil(), StopAtSemi, StopBeforeMatch, clang::DeclSpec::takeAttributesFrom(), TryAnnotateTypeOrScopeTokenAfterScopeSpec(), TryConsumeToken(), clang::DeclSpec::TSCS_unspecified, clang::DeclSpec::TST_class, clang::DeclSpec::TST_enum, clang::DeclSpec::TST_int, clang::DeclSpec::TST_interface, clang::DeclSpec::TST_struct, clang::DeclSpec::TST_union, and clang::DeclSpec::TST_unspecified.
|
inline |
Definition at line 438 of file Parser.h.
References clang::Result.
Referenced by ParseFirstTopLevelDecl().
TypeResult Parser::ParseTypeName | ( | SourceRange * | Range = nullptr , |
DeclaratorContext | Context = DeclaratorContext::TypeNameContext , |
||
AccessSpecifier | AS = AS_none , |
||
Decl ** | OwnedType = nullptr , |
||
ParsedAttributes * | Attrs = nullptr |
||
) |
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt].
Called type-id in C++.
Definition at line 42 of file ParseDecl.cpp.
Referenced by addConstevalToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), attributeParsedArgsUnevaluated(), diagnoseDynamicExceptionSpecification(), getMissingDeclaratorIdLoc(), takeDeclAttributes(), and TypeTraitArity().
bool Parser::ParseUnqualifiedId | ( | CXXScopeSpec & | SS, |
bool | EnteringContext, | ||
bool | AllowDestructorName, | ||
bool | AllowConstructorName, | ||
bool | AllowDeductionGuide, | ||
ParsedType | ObjectType, | ||
SourceLocation * | TemplateKWLoc, | ||
UnqualifiedId & | Result | ||
) |
Parse a C++ unqualified-id (or a C identifier), which describes the name of an entity.
SS | The nested-name-specifier that preceded this unqualified-id. If non-empty, then we are parsing the unqualified-id of a qualified-id. |
EnteringContext | whether we are entering the scope of the nested-name-specifier. |
AllowDestructorName | whether we allow parsing of a destructor name. |
AllowConstructorName | whether we allow parsing a constructor name. |
AllowDeductionGuide | whether we allow parsing a deduction guide name. |
ObjectType | if this unqualified-id occurs within a member access expression, the type of the base object whose member is being accessed. |
Result | on a successful parse, contains the parsed unqualified-id. |
Definition at line 2635 of file ParseExprCXX.cpp.
References clang::Sema::ActOnCXXDelete(), clang::Sema::ActOnCXXNew(), clang::Sema::ActOnDependentTemplateName(), clang::Sema::ActOnParenListExpr(), clang::Sema::ActOnTypeName(), clang::Declarator::AddTypeInfo(), clang::CXXScopeSpec::clear(), clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), ConsumeToken(), clang::frontend::CPlusPlus, clang::frontend::CPlusPlus17, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::CXXNewContext, Diag(), clang::PreferredTypeBuilder::enterFunctionArgument(), clang::ExprError(), clang::OpaquePtr< PtrTy >::get(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::DeclaratorChunk::getArray(), clang::Type::getCanonicalTypeInternal(), clang::BalancedDelimiterTracker::getCloseLocation(), clang::Sema::getConstructorName(), getCurScope(), clang::Declarator::getDeclSpec(), clang::Sema::getDestructorName(), clang::Sema::getDestructorTypeForDecltype(), clang::Declarator::getEndLoc(), clang::Token::getIdentifierInfo(), clang::UnqualifiedId::getKind(), getLangOpts(), clang::Token::getLocation(), clang::Lexer::getLocForEndOfToken(), clang::Declarator::getMutableDeclSpec(), clang::BalancedDelimiterTracker::getOpenLocation(), clang::BalancedDelimiterTracker::getRange(), clang::Sema::getSourceManager(), clang::DeclSpec::getSourceRange(), Id, clang::IK_LiteralOperatorId, clang::IK_OperatorFunctionId, clang::Initializer, clang::Token::is(), clang::Preprocessor::isCodeCompletionReached(), clang::Sema::isCurrentClassName(), clang::Sema::isDeductionGuideName(), clang::CXXScopeSpec::isEmpty(), clang::SourceLocation::isInvalid(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Declarator::isInvalidType(), clang::Token::isNot(), clang::CXXScopeSpec::isNotEmpty(), clang::Token::isOneOf(), clang::CXXScopeSpec::isSet(), clang::SourceLocation::isValid(), clang::TemplateIdAnnotation::LAngleLoc, clang::TemplateIdAnnotation::Name, NextToken(), ParseConstantExpression(), ParseExpression(), clang::Sema::ProduceConstructorSignatureHelp(), clang::TemplateIdAnnotation::RAngleLoc, clang::Result, clang::UnqualifiedId::setConstructorName(), clang::UnqualifiedId::setConstructorTemplateId(), clang::UnqualifiedId::setDeductionGuideName(), clang::UnqualifiedId::setDestructorName(), clang::UnqualifiedId::setIdentifier(), clang::Declarator::setInvalidType(), clang::Declarator::SetSourceRange(), clang::UnqualifiedId::setTemplateId(), clang::Sema::ShouldEnterDeclaratorScope(), SkipUntil(), StopAtSemi, StopBeforeMatch, clang::TemplateIdAnnotation::TemplateKWLoc, clang::TemplateIdAnnotation::TemplateNameLoc, and clang::TNK_Non_template.
Referenced by getMissingDeclaratorIdLoc(), and ParseReductionId().
void Parser::SkipMalformedDecl | ( | ) |
SkipMalformedDecl - Read tokens until we get to some likely good stopping point for skipping past a simple-declaration.
Skip until we reach something which seems like a sensible place to pick up parsing after a malformed declaration.
This will sometimes stop sooner than SkipUntil(tok::r_brace) would, but will never stop later.
Definition at line 1897 of file ParseDecl.cpp.
References ConsumeAnyToken(), ConsumeToken(), clang::comments::tok::eof, clang::Token::getKind(), clang::Token::is(), clang::Token::isAtStartOfLine(), clang::Token::isObjCAtKeyword(), clang::Token::isOneOf(), NextToken(), SkipUntil(), and TryConsumeToken().
Referenced by ParseTopLevelDecl(), and SkipUntil().
|
inline |
SkipUntil - Read tokens until we get to the specified token, then consume it (unless StopBeforeMatch is specified).
Because we cannot guarantee that the token will ever occur, this skips to the next token, or to some likely good stopping point. If Flags has StopAtSemi flag, skipping will stop at a ';' character.
If SkipUntil finds the specified token, it returns true, otherwise it returns false.
Definition at line 1089 of file Parser.h.
Referenced by addConstevalToLambdaDeclSpecifier(), addContextSensitiveTypeNullability(), CheckArrayDesignatorSyntax(), CheckAvailabilitySpecList(), diagnoseRedundantPropertyNullability(), FindLocsWithCommonFileID(), getMissingDeclaratorIdLoc(), IsBuiltInOrStandardCXX11Attribute(), clang::Parser::ObjCTypeParamListScope::leave(), clang::Parser::ConditionDeclarationOrInitStatementState::markNotExpression(), parseOpenMPReductionId(), ParseTopLevelDecl(), ParseUnqualifiedId(), clang::Parser::ConditionDeclarationOrInitStatementState::result(), SkipMalformedDecl(), SkipUntil(), takeDeclAttributes(), TypeTraitArity(), and VersionNumberSeparator().
|
inline |
Definition at line 1093 of file Parser.h.
References SkipUntil().
|
inline |
Definition at line 1098 of file Parser.h.
References clang::C, P, SkipMalformedDecl(), and SkipUntil().
bool Parser::SkipUntil | ( | ArrayRef< tok::TokenKind > | Toks, |
SkipUntilFlags | Flags = static_cast<SkipUntilFlags>(0) |
||
) |
SkipUntil - Read tokens until we get to the specified token, then consume it (unless no flag StopBeforeMatch).
Because we cannot guarantee that the token will ever occur, this skips to the next token, or to some likely good stopping point. If StopAtSemi is true, skipping will stop at a ';' character.
If SkipUntil finds the specified token, it returns true, otherwise it returns false.
Definition at line 245 of file Parser.cpp.
References ConsumeAnyToken(), ConsumeToken(), clang::comments::tok::eof, clang::Token::getKind(), HasFlagsSet(), i, clang::Token::is(), clang::Token::isNot(), SkipUntil(), StopAtCodeCompletion, StopAtSemi, and StopBeforeMatch.
TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only annotates C++ scope specifiers and template-ids.
This returns true if there was an error that could not be recovered from.
Note that this routine emits an error if you call it with ::new or ::delete as the current tokens, so only call it in contexts where these are invalid.
Definition at line 1978 of file Parser.cpp.
References clang::frontend::CPlusPlus, clang::FixItHint::CreateReplacement(), Diag(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), clang::Token::is(), clang::CXXScopeSpec::isEmpty(), and NextToken().
Referenced by getTypeAnnotation(), and SetupFixedPointError().
bool Parser::TryAnnotateTypeOrScopeToken | ( | ) |
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C++) or a C++ scope specifier not followed by a typename, TryAnnotateTypeOrScopeToken will replace one or more tokens with a single annotation token representing the typename or C++ scope respectively.
This simplifies handling of C++ scope specifiers and allows efficient backtracking without the need to re-parse and resolve nested-names and typenames. It will mainly be called when we expect to treat identifiers as typenames (if they are typenames). For example, in C we do not expect identifiers inside expressions to be treated as typenames so it will not be called for expressions in C. The benefit for C/ObjC is that a typename will be annotated and Actions.getTypeName will not be needed to be called again (e.g. getTypeName will not be called twice, once to check whether we have a declaration specifier, and another one to get the actual type inside ParseDeclarationSpecifiers).
This returns true if an error occurred.
Note that this routine emits an error if you call it with ::new or ::delete as the current tokens, so only call it in contexts where these are invalid.
Definition at line 1749 of file Parser.cpp.
References clang::Sema::ActOnTypenameType(), clang::Preprocessor::AnnotateCachedTokens(), ConsumeToken(), clang::frontend::CPlusPlus, Diag(), clang::Preprocessor::EnterToken(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Token::getAnnotationRange(), getCurScope(), clang::Token::getIdentifierInfo(), getLangOpts(), clang::Token::getLastLoc(), clang::Token::getLocation(), clang::CXXScopeSpec::getRange(), clang::TemplateIdAnnotation::getTemplateArgs(), clang::Token::is(), clang::Token::isAnnotation(), clang::Token::isEditorPlaceholder(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::CXXScopeSpec::isSet(), clang::TemplateIdAnnotation::Kind, clang::TemplateIdAnnotation::LAngleLoc, clang::Preprocessor::Lex(), clang::TemplateIdAnnotation::Name, NextToken(), clang::TemplateIdAnnotation::NumArgs, clang::TemplateIdAnnotation::RAngleLoc, clang::Result, clang::Token::setAnnotationEndLoc(), clang::Token::setKind(), clang::Token::setLocation(), clang::TemplateIdAnnotation::Template, clang::TemplateIdAnnotation::TemplateKWLoc, clang::TemplateIdAnnotation::TemplateNameLoc, clang::TNK_Dependent_template_name, clang::TNK_Type_template, clang::TNK_Undeclared_template, and TryAnnotateTypeOrScopeTokenAfterScopeSpec().
Referenced by getMissingDeclaratorIdLoc(), getTypeAnnotation(), and takeDeclAttributes().
bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec | ( | CXXScopeSpec & | SS, |
bool | IsNewScope | ||
) |
Try to annotate a type or scope token, having already parsed an optional scope specifier.
IsNewScope
should be true
unless the scope specifier was extracted from an existing tok::annot_cxxscope annotation.
An Objective-C object type followed by '<' is a specialization of a parameterized class type or a protocol-qualified type.
Definition at line 1864 of file Parser.cpp.
References clang::Preprocessor::AnnotateCachedTokens(), ConsumeToken(), clang::frontend::CPlusPlus, clang::comments::tok::eof, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::CXXScopeSpec::getBeginLoc(), getCurScope(), clang::Token::getIdentifierInfo(), getLangOpts(), clang::Token::getLocation(), clang::Sema::getTypeName(), clang::Token::is(), clang::CXXScopeSpec::isEmpty(), clang::CXXScopeSpec::isNotEmpty(), clang::Sema::isTemplateName(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::TemplateIdAnnotation::Kind, NextToken(), clang::Token::setAnnotationEndLoc(), clang::UnqualifiedId::setIdentifier(), clang::Token::setKind(), clang::Token::setLocation(), clang::TNK_Type_template, and clang::TNK_Undeclared_template.
Referenced by getTypeAnnotation(), ParseTopLevelDecl(), and TryAnnotateTypeOrScopeToken().
|
inline |
Definition at line 456 of file Parser.h.
References clang::Token::getLocation(), clang::Token::isNot(), and clang::Preprocessor::Lex().
Referenced by addContextSensitiveTypeNullability(), CheckAvailabilitySpecList(), diagnoseDynamicExceptionSpecification(), FindLocsWithCommonFileID(), getMissingDeclaratorIdLoc(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), clang::Parser::ObjCTypeParamListScope::leave(), ParseConstraintExpression(), ParseTopLevelDecl(), clang::Parser::ConditionDeclarationOrInitStatementState::result(), SkipMalformedDecl(), takeDeclAttributes(), TryConsumeToken(), and TypeTraitArity().
|
inline |
Definition at line 466 of file Parser.h.
References TryConsumeToken().
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 61 of file Parser.h.
Referenced by getTypeAnnotation(), ParseTopLevelDecl(), and takeDeclAttributes().
|
friend |
|
friend |
|
friend |