clang  6.0.0svn
Public Types | Public Member Functions | Friends | List of all members
clang::Declarator Class Reference

Information about one declarator, including the parsed type information and the identifier. More...

#include "clang/Sema/DeclSpec.h"

Inheritance diagram for clang::Declarator:
Inheritance graph
[legend]
Collaboration diagram for clang::Declarator:
Collaboration graph
[legend]

Public Types

enum  TheContext {
  FileContext, PrototypeContext, ObjCResultContext, ObjCParameterContext,
  KNRTypeListContext, TypeNameContext, FunctionalCastContext, MemberContext,
  BlockContext, ForContext, InitStmtContext, ConditionContext,
  TemplateParamContext, CXXNewContext, CXXCatchContext, ObjCCatchContext,
  BlockLiteralContext, LambdaExprContext, LambdaExprParameterContext, ConversionIdContext,
  TrailingReturnContext, TemplateTypeArgContext, AliasDeclContext, AliasTemplateContext
}
 
typedef SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
 
typedef llvm::iterator_range< type_object_iteratortype_object_range
 

Public Member Functions

 Declarator (const DeclSpec &ds, TheContext C)
 
 ~Declarator ()
 
const DeclSpecgetDeclSpec () const
 getDeclSpec - Return the declaration-specifier that this declarator was declared with. More...
 
DeclSpecgetMutableDeclSpec ()
 getMutableDeclSpec - Return a non-const version of the DeclSpec. More...
 
AttributePoolgetAttributePool () const
 
const CXXScopeSpecgetCXXScopeSpec () const
 getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part of the declarator-id. More...
 
CXXScopeSpecgetCXXScopeSpec ()
 
UnqualifiedIdgetName ()
 Retrieve the name specified by this declarator. More...
 
const DecompositionDeclaratorgetDecompositionDeclarator () const
 
TheContext getContext () const
 
bool isPrototypeContext () const
 
SourceRange getSourceRange () const LLVM_READONLY
 Get the source range that spans this declarator. More...
 
SourceLocation getLocStart () const LLVM_READONLY
 
SourceLocation getLocEnd () 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...
 
IdentifierInfogetIdentifier () 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 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 DeclaratorChunkgetTypeObject (unsigned i) const
 Return the specified TypeInfo from this declarator. More...
 
DeclaratorChunkgetTypeObject (unsigned i)
 
type_object_range type_objects () const
 Returns the range of type objects, from the identifier outwards. More...
 
void DropFirstTypeObject ()
 
const DeclaratorChunkgetInnermostNonParenChunk () 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 DeclaratorChunkgetOutermostNonParenChunk () 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::FunctionTypeInfogetFunctionTypeInfo ()
 getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses). More...
 
const DeclaratorChunk::FunctionTypeInfogetFunctionTypeInfo () 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 takeAttributes (ParsedAttributes &attrs, SourceLocation lastLoc)
 takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarator. More...
 
const AttributeListgetAttributes () const
 
AttributeListgetAttributes ()
 
AttributeList *& getAttrListRef ()
 
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)
 
ExprgetAsmLabel () 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
 

Detailed Description

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 1734 of file DeclSpec.h.

Member Typedef Documentation

◆ type_object_iterator

Definition at line 2166 of file DeclSpec.h.

◆ type_object_range

Definition at line 2167 of file DeclSpec.h.

Member Enumeration Documentation

◆ TheContext

Enumerator
FileContext 
PrototypeContext 
ObjCResultContext 
ObjCParameterContext 
KNRTypeListContext 
TypeNameContext 
FunctionalCastContext 
MemberContext 
BlockContext 
ForContext 
InitStmtContext 
ConditionContext 
TemplateParamContext 
CXXNewContext 
CXXCatchContext 
ObjCCatchContext 
BlockLiteralContext 
LambdaExprContext 
LambdaExprParameterContext 
ConversionIdContext 
TrailingReturnContext 
TemplateTypeArgContext 
AliasDeclContext 
AliasTemplateContext 

Definition at line 1736 of file DeclSpec.h.

Constructor & Destructor Documentation

◆ Declarator()

clang::Declarator::Declarator ( const DeclSpec ds,
TheContext  C 
)
inline

Definition at line 1837 of file DeclSpec.h.

◆ ~Declarator()

clang::Declarator::~Declarator ( )
inline

Definition at line 1845 of file DeclSpec.h.

References clang::CXXScopeSpec::clear().

Member Function Documentation

◆ AddInnermostTypeInfo()

void clang::Declarator::AddInnermostTypeInfo ( const DeclaratorChunk TI)
inline

Add a new innermost chunk to this declarator.

Definition at line 2148 of file DeclSpec.h.

Referenced by maybeSynthesizeBlockSignature().

◆ AddTypeInfo()

void clang::Declarator::AddTypeInfo ( const DeclaratorChunk TI,
ParsedAttributes attrs,
SourceLocation  EndLoc 
)
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 2136 of file DeclSpec.h.

References clang::ParsedAttributes::getList(), clang::ParsedAttributes::getPool(), and clang::SourceLocation::isInvalid().

Referenced by addConstexprToLambdaDeclSpecifier(), getMissingDeclaratorIdLoc(), isPipeDeclerator(), and clang::Parser::ParseUnqualifiedId().

◆ clear()

void clang::Declarator::clear ( )
inline

◆ DropFirstTypeObject()

void clang::Declarator::DropFirstTypeObject ( )
inline

Definition at line 2174 of file DeclSpec.h.

Referenced by clang::Sema::ActOnCXXNew().

◆ ExtendWithDeclSpec()

void clang::Declarator::ExtendWithDeclSpec ( const DeclSpec DS)
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 1904 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().

◆ getAsmLabel()

Expr* clang::Declarator::getAsmLabel ( ) const
inline

Definition at line 2406 of file DeclSpec.h.

◆ getAttributePool()

AttributePool& clang::Declarator::getAttributePool ( ) const
inline

◆ getAttributes() [1/2]

const AttributeList* clang::Declarator::getAttributes ( ) const
inline

◆ getAttributes() [2/2]

AttributeList* clang::Declarator::getAttributes ( )
inline

Definition at line 2381 of file DeclSpec.h.

References clang::ParsedAttributes::getList().

◆ getAttrListRef()

AttributeList*& clang::Declarator::getAttrListRef ( )
inline

◆ getCommaLoc()

SourceLocation clang::Declarator::getCommaLoc ( ) const
inline

Definition at line 2426 of file DeclSpec.h.

Referenced by warnAboutAmbiguousFunction().

◆ getContext()

TheContext clang::Declarator::getContext ( ) const
inline

◆ getCXX11AttributeRanges()

void clang::Declarator::getCXX11AttributeRanges ( SmallVectorImpl< SourceRange > &  Ranges)
inline

Return a source range list of C++11 attributes associated with the declarator.

Definition at line 2396 of file DeclSpec.h.

References clang::ParsedAttributes::getList(), clang::AttributeList::getNext(), clang::AttributeList::getRange(), and clang::AttributeList::isCXX11Attribute().

◆ getCXXScopeSpec() [1/2]

const CXXScopeSpec& clang::Declarator::getCXXScopeSpec ( ) const
inline

getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part of the declarator-id.

Definition at line 1865 of file DeclSpec.h.

Referenced by clang::Sema::ActOnFriendFunctionDecl(), getMissingDeclaratorIdLoc(), isPipeDeclerator(), and SetNestedNameSpecifier().

◆ getCXXScopeSpec() [2/2]

CXXScopeSpec& clang::Declarator::getCXXScopeSpec ( )
inline

Definition at line 1866 of file DeclSpec.h.

◆ getDeclSpec()

const DeclSpec& clang::Declarator::getDeclSpec ( ) const
inline

◆ getDecompositionDeclarator()

const DecompositionDeclarator& clang::Declarator::getDecompositionDeclarator ( ) const
inline

Definition at line 1871 of file DeclSpec.h.

◆ getEllipsisLoc()

SourceLocation clang::Declarator::getEllipsisLoc ( ) const
inline

Definition at line 2430 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ getExtension()

bool clang::Declarator::getExtension ( ) const
inline

Definition at line 2409 of file DeclSpec.h.

◆ getFunctionDefinitionKind()

FunctionDefinitionKind clang::Declarator::getFunctionDefinitionKind ( ) const
inline

Definition at line 2441 of file DeclSpec.h.

Referenced by warnAboutAmbiguousFunction().

◆ getFunctionTypeInfo() [1/2]

DeclaratorChunk::FunctionTypeInfo& clang::Declarator::getFunctionTypeInfo ( )
inline

getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).

Definition at line 2246 of file DeclSpec.h.

Referenced by clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDestructorDeclarator(), maybeSynthesizeBlockSignature(), and clang::Parser::ParseTopLevelDecl().

◆ getFunctionTypeInfo() [2/2]

const DeclaratorChunk::FunctionTypeInfo& clang::Declarator::getFunctionTypeInfo ( ) const
inline

getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).

Definition at line 2255 of file DeclSpec.h.

◆ getIdentifier()

IdentifierInfo* clang::Declarator::getIdentifier ( ) const
inline

◆ getIdentifierLoc()

SourceLocation clang::Declarator::getIdentifierLoc ( ) const
inline

◆ getInnermostNonParenChunk()

const DeclaratorChunk* clang::Declarator::getInnermostNonParenChunk ( ) const
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 2183 of file DeclSpec.h.

◆ getLocEnd()

SourceLocation clang::Declarator::getLocEnd ( ) const
inline

◆ getLocStart()

SourceLocation clang::Declarator::getLocStart ( ) const
inline

◆ getMutableDeclSpec()

DeclSpec& clang::Declarator::getMutableDeclSpec ( )
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 1857 of file DeclSpec.h.

Referenced by addContextSensitiveTypeNullability(), clang::Sema::CheckDeductionGuideDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), getFunctionStorageClass(), and clang::Parser::ParseUnqualifiedId().

◆ getName()

UnqualifiedId& clang::Declarator::getName ( )
inline

◆ getNumTypeObjects()

unsigned clang::Declarator::getNumTypeObjects ( ) const
inline

◆ getOutermostNonParenChunk()

const DeclaratorChunk* clang::Declarator::getOutermostNonParenChunk ( ) const
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 2194 of file DeclSpec.h.

◆ getSourceRange()

SourceRange clang::Declarator::getSourceRange ( ) const
inline

Get the source range that spans this declarator.

Definition at line 1885 of file DeclSpec.h.

Referenced by clang::Sema::ActOnCXXConditionDeclaration(), clang::Sema::ActOnCXXNew(), clang::Sema::CheckDeductionGuideDeclarator(), and getMissingDeclaratorIdLoc().

◆ getTypeObject() [1/2]

const DeclaratorChunk& clang::Declarator::getTypeObject ( unsigned  i) const
inline

◆ getTypeObject() [2/2]

DeclaratorChunk& clang::Declarator::getTypeObject ( unsigned  i)
inline

Definition at line 2161 of file DeclSpec.h.

◆ hasAttributes()

bool clang::Declarator::hasAttributes ( ) const
inline

hasAttributes - do we contain any attributes?

Definition at line 2386 of file DeclSpec.h.

◆ hasEllipsis()

bool clang::Declarator::hasEllipsis ( ) const
inline

◆ hasGroupingParens()

bool clang::Declarator::hasGroupingParens ( ) const
inline

Definition at line 2423 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ hasName()

bool clang::Declarator::hasName ( ) const
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 2105 of file DeclSpec.h.

References clang::UnqualifiedId::getKind(), clang::UnqualifiedId::Identifier, and clang::UnqualifiedId::IK_Identifier.

Referenced by getMissingDeclaratorIdLoc().

◆ hasTrailingReturnType()

bool clang::Declarator::hasTrailingReturnType ( ) const
inline

Determine whether a trailing return type was written (at any level) within this declarator.

Definition at line 2356 of file DeclSpec.h.

References clang::DeclaratorChunk::Function.

Referenced by GetDeclSpecTypeForDeclarator().

◆ isArrayOfUnknownBound()

bool clang::Declarator::isArrayOfUnknownBound ( ) const
inline

isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of unknown bound (looking through parentheses).

Definition at line 2205 of file DeclSpec.h.

References clang::DeclaratorChunk::Arr, clang::DeclaratorChunk::Array, clang::DeclaratorChunk::Kind, and clang::DeclaratorChunk::ArrayTypeInfo::NumElts.

◆ isCtorOrDtor()

bool Declarator::isCtorOrDtor ( )

Returns true if this declares a constructor or a destructor.

Definition at line 397 of file DeclSpec.cpp.

References clang::UnqualifiedId::getKind(), clang::UnqualifiedId::IK_ConstructorName, and clang::UnqualifiedId::IK_DestructorName.

Referenced by clang::Sema::CodeCompleteFunctionQualifiers().

◆ isDeclarationOfFunction()

bool Declarator::isDeclarationOfFunction ( ) const

◆ isDecompositionDeclarator()

bool clang::Declarator::isDecompositionDeclarator ( ) const
inline

Return whether this declarator is a decomposition declarator.

Definition at line 2111 of file DeclSpec.h.

References clang::DecompositionDeclarator::isSet().

◆ isExpressionContext()

bool clang::Declarator::isExpressionContext ( ) const
inline

Determine whether this declaration appears in a context where an expression could appear.

Definition at line 2307 of file DeclSpec.h.

Referenced by warnAboutRedundantParens().

◆ isFirstDeclarationOfMember()

bool clang::Declarator::isFirstDeclarationOfMember ( )
inline

Returns true if this declares a real member and not a friend.

Definition at line 2446 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ isFirstDeclarator()

bool clang::Declarator::isFirstDeclarator ( ) const
inline

◆ isFunctionDeclarationContext()

bool clang::Declarator::isFunctionDeclarationContext ( ) const
inline

Return true if this declaration appears in a context where a function declarator would be a function declaration.

Definition at line 2269 of file DeclSpec.h.

References clang::DeclSpec::SCS_typedef.

Referenced by clang::Sema::CheckExtraCXXDefaultArguments().

◆ isFunctionDeclarator() [1/2]

bool clang::Declarator::isFunctionDeclarator ( unsigned &  idx) const
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 2215 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(), GetDeclSpecTypeForDeclarator(), maybeSynthesizeBlockSignature(), clang::Parser::ParseTopLevelDecl(), and warnAboutAmbiguousFunction().

◆ isFunctionDeclarator() [2/2]

bool clang::Declarator::isFunctionDeclarator ( ) const
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 2239 of file DeclSpec.h.

◆ isFunctionDeclaratorAFunctionDeclaration()

bool clang::Declarator::isFunctionDeclaratorAFunctionDeclaration ( ) const
inline

Return true if a function declarator at this position would be a function declaration.

Definition at line 2343 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ isFunctionDefinition()

bool clang::Declarator::isFunctionDefinition ( ) const
inline

Definition at line 2437 of file DeclSpec.h.

References clang::FDK_Declaration.

◆ isInvalidType()

bool clang::Declarator::isInvalidType ( ) const
inline

◆ isObjCIvar()

bool clang::Declarator::isObjCIvar ( ) const
inline

Definition at line 2412 of file DeclSpec.h.

◆ isObjCWeakProperty()

bool clang::Declarator::isObjCWeakProperty ( ) const
inline

Definition at line 2415 of file DeclSpec.h.

◆ isPastIdentifier()

bool clang::Declarator::isPastIdentifier ( ) const
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 2099 of file DeclSpec.h.

References clang::UnqualifiedId::isValid().

Referenced by getMissingDeclaratorIdLoc().

◆ isPrototypeContext()

bool clang::Declarator::isPrototypeContext ( ) const
inline

Definition at line 1877 of file DeclSpec.h.

Referenced by clang::Sema::GetTypeForDeclarator().

◆ isRedeclaration()

bool clang::Declarator::isRedeclaration ( ) const
inline

Definition at line 2459 of file DeclSpec.h.

◆ isStaticMember()

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 389 of file DeclSpec.cpp.

References clang::UnqualifiedId::IK_OperatorFunctionId, clang::CXXMethodDecl::isStaticOverloadedOperator(), clang::UnqualifiedId::OFI::Operator, clang::UnqualifiedId::OperatorFunctionId, and clang::DeclSpec::SCS_static.

Referenced by clang::Sema::CodeCompleteFunctionQualifiers().

◆ mayBeFollowedByCXXDirectInit()

bool clang::Declarator::mayBeFollowedByCXXDirectInit ( ) const
inline

mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initializer, e.g.

"int x(1);".

Definition at line 2045 of file DeclSpec.h.

References clang::UnqualifiedId::getKind(), clang::UnqualifiedId::IK_Identifier, clang::DeclSpec::SCS_extern, and clang::DeclSpec::SCS_typedef.

Referenced by getMissingDeclaratorIdLoc().

◆ mayHaveDecompositionDeclarator()

bool clang::Declarator::mayHaveDecompositionDeclarator ( ) const
inline

Return true if the context permits a C++17 decomposition declarator.

Definition at line 2004 of file DeclSpec.h.

◆ mayHaveIdentifier()

bool clang::Declarator::mayHaveIdentifier ( ) const
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 1970 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().

◆ mayOmitIdentifier()

bool clang::Declarator::mayOmitIdentifier ( ) const
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 1934 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().

◆ setAsmLabel()

void clang::Declarator::setAsmLabel ( Expr E)
inline

Definition at line 2405 of file DeclSpec.h.

◆ setCommaLoc()

void clang::Declarator::setCommaLoc ( SourceLocation  CL)
inline

Definition at line 2427 of file DeclSpec.h.

Referenced by clang::Parser::ParseTopLevelDecl().

◆ setDecompositionBindings()

void Declarator::setDecompositionBindings ( SourceLocation  LSquareLoc,
ArrayRef< DecompositionDeclarator::Binding Bindings,
SourceLocation  RSquareLoc 
)

Set the decomposition bindings for this declarator.

Definition at line 276 of file DeclSpec.cpp.

References clang::ast_matchers::hasName().

Referenced by getMissingDeclaratorIdLoc().

◆ setEllipsisLoc()

void clang::Declarator::setEllipsisLoc ( SourceLocation  EL)
inline

Definition at line 2431 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ setExtension()

void clang::Declarator::setExtension ( bool  Val = true)
inline

Definition at line 2408 of file DeclSpec.h.

Referenced by isPipeDeclerator().

◆ setFunctionDefinitionKind()

void clang::Declarator::setFunctionDefinitionKind ( FunctionDefinitionKind  Val)
inline

◆ setGroupingParens()

void clang::Declarator::setGroupingParens ( bool  flag)
inline

Definition at line 2422 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ SetIdentifier()

void clang::Declarator::SetIdentifier ( IdentifierInfo Id,
SourceLocation  IdLoc 
)
inline

Set the name of this declarator to be the given identifier.

Definition at line 2124 of file DeclSpec.h.

References clang::UnqualifiedId::setIdentifier().

Referenced by getMissingDeclaratorIdLoc().

◆ setInvalidType()

void clang::Declarator::setInvalidType ( bool  Val = true)
inline

◆ setObjCIvar()

void clang::Declarator::setObjCIvar ( bool  Val = true)
inline

Definition at line 2411 of file DeclSpec.h.

◆ setObjCWeakProperty()

void clang::Declarator::setObjCWeakProperty ( bool  Val = true)
inline

Definition at line 2414 of file DeclSpec.h.

◆ SetRangeBegin()

void clang::Declarator::SetRangeBegin ( SourceLocation  Loc)
inline

SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.

Definition at line 1892 of file DeclSpec.h.

References clang::SourceLocation::isInvalid(), and clang::SourceRange::setBegin().

Referenced by getMissingDeclaratorIdLoc(), and clang::Parser::ParseTopLevelDecl().

◆ SetRangeEnd()

void clang::Declarator::SetRangeEnd ( SourceLocation  Loc)
inline

SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.

Definition at line 1897 of file DeclSpec.h.

References clang::SourceLocation::isInvalid(), and clang::SourceRange::setEnd().

Referenced by getMissingDeclaratorIdLoc(), and isPipeDeclerator().

◆ setRedeclaration()

void clang::Declarator::setRedeclaration ( bool  Val)
inline

Definition at line 2458 of file DeclSpec.h.

◆ SetSourceRange()

void clang::Declarator::SetSourceRange ( SourceRange  R)
inline

Definition at line 1889 of file DeclSpec.h.

Referenced by clang::Parser::ParseUnqualifiedId().

◆ takeAttributes()

void clang::Declarator::takeAttributes ( ParsedAttributes attrs,
SourceLocation  lastLoc 
)
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 2373 of file DeclSpec.h.

References clang::SourceLocation::isInvalid(), and clang::ParsedAttributes::takeAllFrom().

◆ type_objects()

type_object_range clang::Declarator::type_objects ( ) const
inline

Returns the range of type objects, from the identifier outwards.

Definition at line 2170 of file DeclSpec.h.

Referenced by clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), and warnAboutRedundantParens().

Friends And Related Function Documentation

◆ DeclaratorChunk

friend struct DeclaratorChunk
friend

Definition at line 1834 of file DeclSpec.h.

Member Data Documentation

◆ InlineBindings

DecompositionDeclarator::Binding clang::Declarator::InlineBindings[16]

Definition at line 1821 of file DeclSpec.h.

◆ InlineParams

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 1820 of file DeclSpec.h.


The documentation for this class was generated from the following files: