clang
10.0.0git
|
Information about one declarator, including the parsed type information and the identifier. More...
#include "clang/Sema/DeclSpec.h"
Public Types | |
typedef SmallVectorImpl< DeclaratorChunk >::const_iterator | type_object_iterator |
typedef llvm::iterator_range< type_object_iterator > | type_object_range |
Public Member Functions | |
Declarator (const DeclSpec &ds, DeclaratorContext C) | |
~Declarator () | |
const DeclSpec & | getDeclSpec () const |
getDeclSpec - Return the declaration-specifier that this declarator was declared with. More... | |
DeclSpec & | getMutableDeclSpec () |
getMutableDeclSpec - Return a non-const version of the DeclSpec. More... | |
AttributePool & | getAttributePool () const |
const CXXScopeSpec & | getCXXScopeSpec () const |
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part of the declarator-id. More... | |
CXXScopeSpec & | getCXXScopeSpec () |
UnqualifiedId & | getName () |
Retrieve the name specified by this declarator. More... | |
const DecompositionDeclarator & | getDecompositionDeclarator () const |
DeclaratorContext | getContext () const |
bool | isPrototypeContext () const |
SourceRange | getSourceRange () const LLVM_READONLY |
Get the source range that spans this declarator. More... | |
SourceLocation | getBeginLoc () const LLVM_READONLY |
SourceLocation | getEndLoc () const LLVM_READONLY |
void | SetSourceRange (SourceRange R) |
void | SetRangeBegin (SourceLocation Loc) |
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid. More... | |
void | SetRangeEnd (SourceLocation Loc) |
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid. More... | |
void | ExtendWithDeclSpec (const DeclSpec &DS) |
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec, unless its location is invalid. More... | |
void | clear () |
Reset the contents of this Declarator. More... | |
bool | mayOmitIdentifier () const |
mayOmitIdentifier - Return true if the identifier is either optional or not allowed. More... | |
bool | mayHaveIdentifier () const |
mayHaveIdentifier - Return true if the identifier is either optional or required. More... | |
bool | mayHaveDecompositionDeclarator () const |
Return true if the context permits a C++17 decomposition declarator. More... | |
bool | mayBeFollowedByCXXDirectInit () const |
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initializer, e.g. More... | |
bool | isPastIdentifier () const |
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear. More... | |
bool | hasName () const |
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentifier()) or some kind of special C++ name (constructor, destructor, etc.), or a structured binding (which is not exactly a name, but occupies the same position). More... | |
bool | isDecompositionDeclarator () const |
Return whether this declarator is a decomposition declarator. More... | |
IdentifierInfo * | getIdentifier () const |
SourceLocation | getIdentifierLoc () const |
void | SetIdentifier (IdentifierInfo *Id, SourceLocation IdLoc) |
Set the name of this declarator to be the given identifier. More... | |
void | setDecompositionBindings (SourceLocation LSquareLoc, ArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc) |
Set the decomposition bindings for this declarator. More... | |
void | AddTypeInfo (const DeclaratorChunk &TI, ParsedAttributes &&attrs, SourceLocation EndLoc) |
AddTypeInfo - Add a chunk to this declarator. More... | |
void | AddTypeInfo (const DeclaratorChunk &TI, SourceLocation EndLoc) |
AddTypeInfo - Add a chunk to this declarator. More... | |
void | AddInnermostTypeInfo (const DeclaratorChunk &TI) |
Add a new innermost chunk to this declarator. More... | |
unsigned | getNumTypeObjects () const |
Return the number of types applied to this declarator. More... | |
const DeclaratorChunk & | getTypeObject (unsigned i) const |
Return the specified TypeInfo from this declarator. More... | |
DeclaratorChunk & | getTypeObject (unsigned i) |
type_object_range | type_objects () const |
Returns the range of type objects, from the identifier outwards. More... | |
void | DropFirstTypeObject () |
const DeclaratorChunk * | getInnermostNonParenChunk () const |
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk, or null if there are no non-parens chunks. More... | |
const DeclaratorChunk * | getOutermostNonParenChunk () const |
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chunk, or null if there are no non-parens chunks. More... | |
bool | isArrayOfUnknownBound () const |
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of unknown bound (looking through parentheses). More... | |
bool | isFunctionDeclarator (unsigned &idx) const |
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking through parentheses). More... | |
bool | isFunctionDeclarator () const |
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if the identifier is a function declarator (looking through parentheses). More... | |
DeclaratorChunk::FunctionTypeInfo & | getFunctionTypeInfo () |
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses). More... | |
const DeclaratorChunk::FunctionTypeInfo & | getFunctionTypeInfo () const |
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses). More... | |
bool | isDeclarationOfFunction () const |
Determine whether the declaration that will be produced from this declaration will be a function. More... | |
bool | isFunctionDeclarationContext () const |
Return true if this declaration appears in a context where a function declarator would be a function declaration. More... | |
bool | isExpressionContext () const |
Determine whether this declaration appears in a context where an expression could appear. More... | |
bool | isFunctionDeclaratorAFunctionDeclaration () const |
Return true if a function declarator at this position would be a function declaration. More... | |
bool | hasTrailingReturnType () const |
Determine whether a trailing return type was written (at any level) within this declarator. More... | |
void | setTrailingRequiresClause (Expr *TRC) |
Sets a trailing requires clause for this declarator. More... | |
Expr * | getTrailingRequiresClause () |
Sets a trailing requires clause for this declarator. More... | |
bool | hasTrailingRequiresClause () const |
Determine whether a trailing requires clause was written in this declarator. More... | |
void | setTemplateParameterLists (ArrayRef< TemplateParameterList *> TPLs) |
Sets the template parameter lists that preceded the declarator. More... | |
ArrayRef< TemplateParameterList * > | getTemplateParameterLists () const |
The template parameter lists that preceded the declarator. More... | |
void | setInventedTemplateParameterList (TemplateParameterList *Invented) |
Sets the template parameter list generated from the explicit template parameters along with any invented template parameters from placeholder-typed parameters. More... | |
TemplateParameterList * | getInventedTemplateParameterList () const |
The template parameter list generated from the explicit template parameters along with any invented template parameters from placeholder-typed parameters, if there were any such parameters. More... | |
void | takeAttributes (ParsedAttributes &attrs, SourceLocation lastLoc) |
takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarator. More... | |
const ParsedAttributes & | getAttributes () const |
ParsedAttributes & | getAttributes () |
bool | hasAttributes () const |
hasAttributes - do we contain any attributes? More... | |
void | getCXX11AttributeRanges (SmallVectorImpl< SourceRange > &Ranges) |
Return a source range list of C++11 attributes associated with the declarator. More... | |
void | setAsmLabel (Expr *E) |
Expr * | getAsmLabel () const |
void | setExtension (bool Val=true) |
bool | getExtension () const |
void | setObjCIvar (bool Val=true) |
bool | isObjCIvar () const |
void | setObjCWeakProperty (bool Val=true) |
bool | isObjCWeakProperty () const |
void | setInvalidType (bool Val=true) |
bool | isInvalidType () const |
void | setGroupingParens (bool flag) |
bool | hasGroupingParens () const |
bool | isFirstDeclarator () const |
SourceLocation | getCommaLoc () const |
void | setCommaLoc (SourceLocation CL) |
bool | hasEllipsis () const |
SourceLocation | getEllipsisLoc () const |
void | setEllipsisLoc (SourceLocation EL) |
void | setFunctionDefinitionKind (FunctionDefinitionKind Val) |
bool | isFunctionDefinition () const |
FunctionDefinitionKind | getFunctionDefinitionKind () const |
bool | isFirstDeclarationOfMember () |
Returns true if this declares a real member and not a friend. More... | |
bool | isStaticMember () |
Returns true if this declares a static member. More... | |
bool | isCtorOrDtor () |
Returns true if this declares a constructor or a destructor. More... | |
void | setRedeclaration (bool Val) |
bool | isRedeclaration () const |
Friends | |
struct | DeclaratorChunk |
Information about one declarator, including the parsed type information and the identifier.
When the declarator is fully formed, this is turned into the appropriate Decl object.
Declarators come in two types: normal declarators and abstract declarators. Abstract declarators are used when parsing types, and don't have an identifier. Normal declarators do have ID's.
Instances of this class should be a transient object that lives on the stack, not objects that are allocated in large quantities on the heap.
Definition at line 1792 of file DeclSpec.h.
typedef SmallVectorImpl<DeclaratorChunk>::const_iterator clang::Declarator::type_object_iterator |
Definition at line 2233 of file DeclSpec.h.
typedef llvm::iterator_range<type_object_iterator> clang::Declarator::type_object_range |
Definition at line 2234 of file DeclSpec.h.
|
inline |
Definition at line 1880 of file DeclSpec.h.
|
inline |
Definition at line 1890 of file DeclSpec.h.
References clang::CXXScopeSpec::clear().
|
inline |
Add a new innermost chunk to this declarator.
Definition at line 2215 of file DeclSpec.h.
Referenced by maybeSynthesizeBlockSignature().
|
inline |
AddTypeInfo - Add a chunk to this declarator.
Also extend the range to EndLoc, which should be the last token of the chunk. This function takes attrs by R-Value reference because it takes ownership of those attributes from the parameter.
Definition at line 2195 of file DeclSpec.h.
References clang::SourceLocation::isInvalid().
Referenced by addConstevalToLambdaDeclSpecifier(), getMissingDeclaratorIdLoc(), isPipeDeclerator(), and clang::Parser::ParseUnqualifiedId().
|
inline |
AddTypeInfo - Add a chunk to this declarator.
Also extend the range to EndLoc, which should be the last token of the chunk.
Definition at line 2207 of file DeclSpec.h.
References clang::SourceLocation::isInvalid().
|
inline |
Reset the contents of this Declarator.
Definition at line 1958 of file DeclSpec.h.
References clang::CXXScopeSpec::clear(), clang::ParsedAttributes::clear(), clang::UnqualifiedId::clear(), clang::DecompositionDeclarator::clear(), and clang::DeclSpec::getSourceRange().
Referenced by clang::ParsingDeclarator::clear(), and clang::Parser::ParseTopLevelDecl().
|
inline |
Definition at line 2241 of file DeclSpec.h.
Referenced by clang::Sema::ActOnCXXNew().
|
inline |
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec, unless its location is invalid.
Adopts the range start if the current range start is invalid.
Definition at line 1949 of file DeclSpec.h.
References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::DeclSpec::getSourceRange(), clang::SourceLocation::isInvalid(), clang::SourceRange::setBegin(), and clang::SourceRange::setEnd().
Referenced by isPipeDeclerator().
|
inline |
Definition at line 2518 of file DeclSpec.h.
|
inline |
Definition at line 1904 of file DeclSpec.h.
References clang::ParsedAttributes::getPool().
Referenced by addContextSensitiveTypeNullability(), takeDeclAttributes(), and transferARCOwnershipToDeclaratorChunk().
|
inline |
Definition at line 2496 of file DeclSpec.h.
Referenced by distributeFunctionTypeAttrFromDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), GetDeclSpecTypeForDeclarator(), clang::Parser::ParseTopLevelDecl(), and takeDeclAttributes().
|
inline |
Definition at line 2497 of file DeclSpec.h.
|
inline |
Definition at line 1931 of file DeclSpec.h.
References clang::SourceRange::getBegin().
Referenced by clang::Sema::ActOnStartFunctionDeclarationDeclarator(), clang::Sema::isLibstdcxxEagerExceptionSpecHack(), maybeSynthesizeBlockSignature(), and warnAboutRedundantParens().
|
inline |
Definition at line 2538 of file DeclSpec.h.
Referenced by warnAboutAmbiguousFunction().
|
inline |
Definition at line 1920 of file DeclSpec.h.
Referenced by clang::Sema::ActOnBlockArguments(), clang::Sema::ActOnTypeName(), addConstevalToLambdaDeclSpecifier(), getCCForDeclaratorChunk(), GetDeclSpecTypeForDeclarator(), getMissingDeclaratorIdLoc(), isOmittedBlockReturnType(), isPipeDeclerator(), warnAboutAmbiguousFunction(), and warnAboutRedundantParens().
|
inline |
Return a source range list of C++11 attributes associated with the declarator.
Definition at line 2511 of file DeclSpec.h.
|
inline |
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part of the declarator-id.
Definition at line 1910 of file DeclSpec.h.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnStartFunctionDeclarationDeclarator(), getMissingDeclaratorIdLoc(), isPipeDeclerator(), and warnAboutRedundantParens().
|
inline |
Definition at line 1911 of file DeclSpec.h.
|
inline |
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Definition at line 1895 of file DeclSpec.h.
Referenced by clang::Sema::ActOnCXXConditionDeclaration(), clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnCXXNew(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::canDelayFunctionBody(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructorDeclarator(), clang::Sema::containsUnexpandedParameterPacks(), diagnoseDynamicExceptionSpecification(), diagnoseRedundantReturnTypeQualifiers(), getCCForDeclaratorChunk(), clang::ParsingDeclarator::getDeclSpec(), GetDeclSpecTypeForDeclarator(), getFunctionStorageClass(), getMissingDeclaratorIdLoc(), GetTypeSourceInfoForDeclarator(), InventTemplateParameter(), isOmittedBlockReturnType(), isPipeDeclerator(), clang::Parser::ParseUnqualifiedId(), takeDeclAttributes(), warnAboutAmbiguousFunction(), and warnAboutRedundantParens().
|
inline |
Definition at line 1916 of file DeclSpec.h.
|
inline |
Definition at line 2542 of file DeclSpec.h.
Referenced by getMissingDeclaratorIdLoc(), GetTypeSourceInfoForDeclarator(), and InventTemplateParameter().
|
inline |
Definition at line 1932 of file DeclSpec.h.
References clang::SourceRange::getEnd().
Referenced by getMissingDeclaratorIdLoc(), clang::Parser::ParseUnqualifiedId(), and warnAboutRedundantParens().
|
inline |
Definition at line 2521 of file DeclSpec.h.
|
inline |
Definition at line 2553 of file DeclSpec.h.
Referenced by warnAboutAmbiguousFunction().
|
inline |
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Definition at line 2313 of file DeclSpec.h.
Referenced by clang::Sema::ActOnStartTrailingRequiresClause(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDestructorDeclarator(), checkMethodTypeQualifiers(), diagnoseDynamicExceptionSpecification(), maybeSynthesizeBlockSignature(), and clang::Parser::ParseTopLevelDecl().
|
inline |
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Definition at line 2322 of file DeclSpec.h.
|
inline |
Definition at line 2172 of file DeclSpec.h.
References clang::UnqualifiedId::getKind(), clang::UnqualifiedId::Identifier, and clang::IK_Identifier.
Referenced by clang::Sema::ActOnBlockArguments(), clang::Sema::ActOnTypeName(), getMissingDeclaratorIdLoc(), clang::Sema::HandleMSProperty(), InventTemplateParameter(), clang::Sema::isLibstdcxxEagerExceptionSpecHack(), isPipeDeclerator(), clang::Parser::ParseTopLevelDecl(), takeDeclAttributes(), warnAboutAmbiguousFunction(), and warnAboutRedundantParens().
|
inline |
Definition at line 2178 of file DeclSpec.h.
References clang::UnqualifiedId::StartLocation.
Referenced by clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnStartFunctionDeclarationDeclarator(), clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructorDeclarator(), diagnoseRedundantReturnTypeQualifiers(), getMissingDeclaratorIdLoc(), clang::Sema::HandleMSProperty(), InventTemplateParameter(), clang::Parser::ParseTopLevelDecl(), and takeDeclAttributes().
|
inline |
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk, or null if there are no non-parens chunks.
Definition at line 2250 of file DeclSpec.h.
|
inline |
The template parameter list generated from the explicit template parameters along with any invented template parameters from placeholder-typed parameters, if there were any such parameters.
Definition at line 2476 of file DeclSpec.h.
|
inline |
getMutableDeclSpec - Return a non-const version of the DeclSpec.
This should be used with extreme care: declspecs can often be shared between multiple declarators, so mutating the DeclSpec affects all of the Declarators. This should only be done when the declspec is known to not be shared or when in error recovery etc.
Definition at line 1902 of file DeclSpec.h.
Referenced by addContextSensitiveTypeNullability(), clang::Sema::CheckDeductionGuideDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), GetDeclSpecTypeForDeclarator(), getFunctionStorageClass(), clang::Parser::ParseUnqualifiedId(), and takeDeclAttributes().
|
inline |
Retrieve the name specified by this declarator.
Definition at line 1914 of file DeclSpec.h.
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructorDeclarator(), diagnoseRedundantReturnTypeQualifiers(), GetDeclSpecTypeForDeclarator(), getMissingDeclaratorIdLoc(), and clang::Sema::GetNameForDeclarator().
|
inline |
Return the number of types applied to this declarator.
Definition at line 2220 of file DeclSpec.h.
Referenced by clang::Sema::ActOnCXXNew(), clang::Sema::ActOnStartOfLambdaDefinition(), addContextSensitiveTypeNullability(), clang::Sema::canDelayFunctionBody(), clang::Sema::CheckExtraCXXDefaultArguments(), classifyPointerDeclarator(), clang::Sema::containsUnexpandedParameterPacks(), diagnoseRedundantReturnTypeQualifiers(), distributeFunctionTypeAttrToInnermost(), distributeObjCPointerTypeAttrFromDeclarator(), GetDeclSpecTypeForDeclarator(), getMissingDeclaratorIdLoc(), GetTypeSourceInfoForDeclarator(), handleObjCOwnershipTypeAttr(), inferARCWriteback(), isOmittedBlockReturnType(), isPipeDeclerator(), maybeMovePastReturnType(), maybeSynthesizeBlockSignature(), takeDeclAttributes(), transferARCOwnership(), and warnAboutRedundantParens().
|
inline |
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chunk, or null if there are no non-parens chunks.
Definition at line 2261 of file DeclSpec.h.
|
inline |
Get the source range that spans this declarator.
Definition at line 1930 of file DeclSpec.h.
Referenced by clang::Sema::ActOnCXXConditionDeclaration(), clang::Sema::ActOnCXXNew(), clang::Sema::CheckDeductionGuideDeclarator(), and getMissingDeclaratorIdLoc().
|
inline |
The template parameter lists that preceded the declarator.
Definition at line 2462 of file DeclSpec.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), and clang::Sema::ActOnStartFunctionDeclarationDeclarator().
|
inline |
Sets a trailing requires clause for this declarator.
Definition at line 2446 of file DeclSpec.h.
Referenced by clang::Sema::containsUnexpandedParameterPacks().
|
inline |
Return the specified TypeInfo from this declarator.
TypeInfo #0 is closest to the identifier.
Definition at line 2224 of file DeclSpec.h.
Referenced by clang::Sema::ActOnCXXNew(), addContextSensitiveTypeNullability(), clang::Sema::canDelayFunctionBody(), clang::Sema::CheckExtraCXXDefaultArguments(), classifyPointerDeclarator(), clang::Sema::containsUnexpandedParameterPacks(), diagnoseRedundantReturnTypeQualifiers(), distributeFunctionTypeAttr(), distributeFunctionTypeAttrToInnermost(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), distributeObjCPointerTypeAttrFromDeclarator(), getCCForDeclaratorChunk(), getMissingDeclaratorIdLoc(), GetTypeSourceInfoForDeclarator(), hasOuterPointerLikeChunk(), inferARCWriteback(), isOmittedBlockReturnType(), isPipeDeclerator(), maybeMovePastReturnType(), takeDeclAttributes(), transferARCOwnership(), transferARCOwnershipToDeclaratorChunk(), and warnAboutRedundantParens().
|
inline |
Definition at line 2228 of file DeclSpec.h.
|
inline |
hasAttributes - do we contain any attributes?
Definition at line 2500 of file DeclSpec.h.
|
inline |
Definition at line 2541 of file DeclSpec.h.
References clang::SourceLocation::isValid().
Referenced by getMissingDeclaratorIdLoc(), and InventTemplateParameter().
|
inline |
Definition at line 2535 of file DeclSpec.h.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentifier()) or some kind of special C++ name (constructor, destructor, etc.), or a structured binding (which is not exactly a name, but occupies the same position).
Definition at line 2162 of file DeclSpec.h.
References clang::UnqualifiedId::getKind(), clang::UnqualifiedId::Identifier, and clang::IK_Identifier.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Determine whether a trailing requires clause was written in this declarator.
Definition at line 2452 of file DeclSpec.h.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Determine whether a trailing return type was written (at any level) within this declarator.
Definition at line 2432 of file DeclSpec.h.
References clang::DeclaratorChunk::Function.
Referenced by GetDeclSpecTypeForDeclarator().
|
inline |
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of unknown bound (looking through parentheses).
Definition at line 2272 of file DeclSpec.h.
References clang::DeclaratorChunk::Arr, clang::DeclaratorChunk::Array, clang::DeclaratorChunk::Kind, and clang::DeclaratorChunk::ArrayTypeInfo::NumElts.
bool Declarator::isCtorOrDtor | ( | ) |
Returns true if this declares a constructor or a destructor.
Definition at line 404 of file DeclSpec.cpp.
References clang::UnqualifiedId::getKind(), getName(), clang::IK_ConstructorName, and clang::IK_DestructorName.
bool Declarator::isDeclarationOfFunction | ( | ) | const |
Determine whether the declaration that will be produced from this declaration will be a function.
A declaration can declare a function even if the declarator itself isn't a function declarator, if the type specifier refers to a function type. This routine checks for both cases.
Definition at line 312 of file DeclSpec.cpp.
References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Type::isFunctionType(), clang::QualType::isNull(), clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, clang::TST_Accum, clang::TST_atomic, clang::TST_auto, clang::TST_auto_type, clang::TST_bool, clang::TST_char, clang::TST_char16, clang::TST_char32, clang::TST_char8, clang::TST_class, clang::TST_decimal128, clang::TST_decimal32, clang::TST_decimal64, clang::TST_decltype, clang::TST_decltype_auto, clang::TST_double, clang::TST_enum, clang::TST_error, clang::TST_float, clang::TST_float128, clang::TST_Float16, clang::TST_Fract, clang::TST_half, clang::TST_int, clang::TST_int128, clang::TST_interface, clang::TST_struct, clang::TST_typename, clang::TST_typeofExpr, clang::TST_typeofType, clang::TST_underlyingType, clang::TST_union, clang::TST_unknown_anytype, clang::TST_unspecified, clang::TST_void, and clang::TST_wchar.
Referenced by diagnoseDynamicExceptionSpecification().
|
inline |
Return whether this declarator is a decomposition declarator.
Definition at line 2168 of file DeclSpec.h.
References clang::DecompositionDeclarator::isSet().
|
inline |
Determine whether this declaration appears in a context where an expression could appear.
Definition at line 2377 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
Referenced by warnAboutRedundantParens().
|
inline |
Returns true if this declares a real member and not a friend.
Definition at line 2558 of file DeclSpec.h.
References clang::MemberContext.
Referenced by getCCForDeclaratorChunk(), and getMissingDeclaratorIdLoc().
|
inline |
Definition at line 2537 of file DeclSpec.h.
References clang::SourceLocation::isValid().
Referenced by warnAboutAmbiguousFunction(), and warnAboutRedundantParens().
|
inline |
Return true if this declaration appears in a context where a function declarator would be a function declaration.
Definition at line 2336 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::DeclSpec::SCS_typedef, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
Referenced by clang::Sema::CheckExtraCXXDefaultArguments().
|
inline |
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking through parentheses).
If true is returned, then the reference type parameter idx is assigned with the index of the declaration chunk.
Definition at line 2282 of file DeclSpec.h.
References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.
Referenced by clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::ActOnStartTrailingRequiresClause(), diagnoseDynamicExceptionSpecification(), getCCForDeclaratorChunk(), GetDeclSpecTypeForDeclarator(), getMissingDeclaratorIdLoc(), maybeSynthesizeBlockSignature(), clang::Parser::ParseTopLevelDecl(), and warnAboutAmbiguousFunction().
|
inline |
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if the identifier is a function declarator (looking through parentheses).
Definition at line 2306 of file DeclSpec.h.
|
inline |
Return true if a function declarator at this position would be a function declaration.
Definition at line 2419 of file DeclSpec.h.
References clang::DeclaratorChunk::Paren.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Definition at line 2549 of file DeclSpec.h.
References clang::FDK_Declaration.
|
inline |
Definition at line 2530 of file DeclSpec.h.
References clang::DeclSpec::getTypeSpecType(), and clang::DeclSpec::TST_error.
Referenced by clang::Sema::ActOnBuiltinBitCastExpr(), clang::Sema::ActOnCastExpr(), clang::Sema::ActOnCXXNamedCast(), clang::Sema::ActOnCXXNew(), clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnFriendTypeDecl(), clang::Sema::ActOnOpenMPDeclareMapperVarDecl(), clang::Sema::ActOnTypeName(), addConstevalToLambdaDeclSpecifier(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructorDeclarator(), checkMethodTypeQualifiers(), GetDeclSpecTypeForDeclarator(), getMissingDeclaratorIdLoc(), clang::Parser::ParseUnqualifiedId(), takeDeclAttributes(), TypeTraitArity(), and warnAboutRedundantParens().
|
inline |
Definition at line 2524 of file DeclSpec.h.
|
inline |
Definition at line 2527 of file DeclSpec.h.
|
inline |
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear.
(This may happen even if we haven't actually parsed a name, perhaps because this context doesn't require one.)
Definition at line 2156 of file DeclSpec.h.
References clang::UnqualifiedId::isValid().
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Definition at line 1922 of file DeclSpec.h.
References clang::LambdaExprParameterContext, clang::ObjCParameterContext, clang::ObjCResultContext, and clang::PrototypeContext.
Referenced by clang::Sema::GetTypeForDeclarator().
|
inline |
Definition at line 2572 of file DeclSpec.h.
bool Declarator::isStaticMember | ( | ) |
Returns true if this declares a static member.
This cannot be called on a declarator outside of a MemberContext because we won't know until redeclaration time if the decl is static.
Definition at line 396 of file DeclSpec.cpp.
References getName(), clang::IK_OperatorFunctionId, clang::CXXMethodDecl::isStaticOverloadedOperator(), clang::MemberContext, clang::UnqualifiedId::OFI::Operator, clang::UnqualifiedId::OperatorFunctionId, and clang::DeclSpec::SCS_static.
Referenced by getCCForDeclaratorChunk().
|
inline |
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initializer, e.g.
"int x(1);".
Definition at line 2099 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::UnqualifiedId::getKind(), clang::IK_Identifier, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::DeclSpec::SCS_extern, clang::DeclSpec::SCS_typedef, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Return true if the context permits a C++17 decomposition declarator.
Definition at line 2055 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
|
inline |
mayHaveIdentifier - Return true if the identifier is either optional or required.
This is true for normal declarators and prototypes, but not typenames.
Definition at line 2018 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().
|
inline |
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
This is true for typenames, prototypes, and template parameter lists.
Definition at line 1979 of file DeclSpec.h.
References clang::AliasDeclContext, clang::AliasTemplateContext, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::ConversionIdContext, clang::CXXCatchContext, clang::CXXNewContext, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::InitStmtContext, clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::PrototypeContext, clang::RequiresExprContext, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, and clang::TypeNameContext.
Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().
|
inline |
Definition at line 2517 of file DeclSpec.h.
|
inline |
Definition at line 2539 of file DeclSpec.h.
Referenced by clang::Parser::ParseTopLevelDecl().
void Declarator::setDecompositionBindings | ( | SourceLocation | LSquareLoc, |
ArrayRef< DecompositionDeclarator::Binding > | Bindings, | ||
SourceLocation | RSquareLoc | ||
) |
Set the decomposition bindings for this declarator.
Definition at line 280 of file DeclSpec.cpp.
References clang::ast_matchers::hasName().
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Definition at line 2543 of file DeclSpec.h.
Referenced by getMissingDeclaratorIdLoc().
Definition at line 2520 of file DeclSpec.h.
Referenced by isPipeDeclerator().
|
inline |
Definition at line 2545 of file DeclSpec.h.
Referenced by clang::Sema::ActOnStartOfFunctionDef(), and clang::Parser::ParseTopLevelDecl().
|
inline |
Definition at line 2534 of file DeclSpec.h.
Referenced by getMissingDeclaratorIdLoc().
|
inline |
Set the name of this declarator to be the given identifier.
Definition at line 2181 of file DeclSpec.h.
References clang::UnqualifiedId::setIdentifier().
Referenced by getMissingDeclaratorIdLoc().
Definition at line 2529 of file DeclSpec.h.
Referenced by clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDestructorDeclarator(), checkMethodTypeQualifiers(), GetDeclSpecTypeForDeclarator(), getFunctionStorageClass(), getMissingDeclaratorIdLoc(), clang::Sema::HandleMSProperty(), and clang::Parser::ParseUnqualifiedId().
|
inline |
Sets the template parameter list generated from the explicit template parameters along with any invented template parameters from placeholder-typed parameters.
Definition at line 2469 of file DeclSpec.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator().
Definition at line 2523 of file DeclSpec.h.
Definition at line 2526 of file DeclSpec.h.
|
inline |
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
Definition at line 1937 of file DeclSpec.h.
References clang::SourceLocation::isInvalid(), and clang::SourceRange::setBegin().
Referenced by getMissingDeclaratorIdLoc(), and clang::Parser::ParseTopLevelDecl().
|
inline |
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
Definition at line 1942 of file DeclSpec.h.
References clang::SourceLocation::isInvalid(), and clang::SourceRange::setEnd().
Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().
|
inline |
Definition at line 2571 of file DeclSpec.h.
|
inline |
Definition at line 1934 of file DeclSpec.h.
Referenced by clang::Parser::ParseUnqualifiedId().
|
inline |
Sets the template parameter lists that preceded the declarator.
Definition at line 2457 of file DeclSpec.h.
|
inline |
Sets a trailing requires clause for this declarator.
Definition at line 2441 of file DeclSpec.h.
Referenced by diagnoseDynamicExceptionSpecification(), and getMissingDeclaratorIdLoc().
|
inline |
takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarator.
These examples both add 3 attributes to "var": short int var attribute((aligned(16),common,deprecated)); short int x, attribute((aligned(16)) var attribute((common,deprecated));
Also extends the range of the declarator.
Definition at line 2489 of file DeclSpec.h.
References clang::SourceLocation::isInvalid(), and clang::ParsedAttributes::takeAllFrom().
|
inline |
Returns the range of type objects, from the identifier outwards.
Definition at line 2237 of file DeclSpec.h.
Referenced by clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), and warnAboutRedundantParens().
|
friend |
Definition at line 1877 of file DeclSpec.h.
DecompositionDeclarator::Binding clang::Declarator::InlineBindings[16] |
Definition at line 1864 of file DeclSpec.h.
DeclaratorChunk::ParamInfo clang::Declarator::InlineParams[16] |
InlineParams - This is a local array used for the first function decl chunk to avoid going to the heap for the common case when we have one function chunk in the declarator.
Definition at line 1863 of file DeclSpec.h.
Referenced by clang::DeclaratorChunk::getFunction().