clang  14.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::DeclaratorChunk Struct Reference

One instance of this struct is used for each type in a declarator that is parsed. More...

#include "clang/Sema/DeclSpec.h"

Collaboration diagram for clang::DeclaratorChunk:
Collaboration graph
[legend]

Classes

struct  ArrayTypeInfo
 
struct  BlockPointerTypeInfo
 
struct  FunctionTypeInfo
 
struct  MemberPointerTypeInfo
 
struct  ParamInfo
 ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed. More...
 
struct  PipeTypeInfo
 
struct  PointerTypeInfo
 
struct  ReferenceTypeInfo
 
struct  TypeAndRange
 

Public Types

enum  {
  Pointer, Reference, Array, Function,
  BlockPointer, MemberPointer, Paren, Pipe
}
 

Public Member Functions

 DeclaratorChunk ()
 
SourceRange getSourceRange () const
 
void destroy ()
 
const ParsedAttributesViewgetAttrs () const
 If there are attributes applied to this declaratorchunk, return them. More...
 
ParsedAttributesViewgetAttrs ()
 
bool isParen () const
 

Static Public Member Functions

static DeclaratorChunk getPointer (unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
 Return a DeclaratorChunk for a pointer. More...
 
static DeclaratorChunk getReference (unsigned TypeQuals, SourceLocation Loc, bool lvalue)
 Return a DeclaratorChunk for a reference. More...
 
static DeclaratorChunk getArray (unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
 Return a DeclaratorChunk for an array. More...
 
static DeclaratorChunk getFunction (bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
 DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function. More...
 
static DeclaratorChunk getBlockPointer (unsigned TypeQuals, SourceLocation Loc)
 Return a DeclaratorChunk for a block. More...
 
static DeclaratorChunk getPipe (unsigned TypeQuals, SourceLocation Loc)
 Return a DeclaratorChunk for a block. More...
 
static DeclaratorChunk getMemberPointer (const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation StarLoc, SourceLocation EndLoc)
 
static DeclaratorChunk getParen (SourceLocation LParenLoc, SourceLocation RParenLoc)
 Return a DeclaratorChunk for a paren. More...
 

Public Attributes

enum clang::DeclaratorChunk:: { ... }  Kind
 
SourceLocation Loc
 Loc - The place where this type was defined. More...
 
SourceLocation EndLoc
 EndLoc - If valid, the place where this chunck ends. More...
 
ParsedAttributesView AttrList
 
union {
   PointerTypeInfo   Ptr
 
   ReferenceTypeInfo   Ref
 
   ArrayTypeInfo   Arr
 
   FunctionTypeInfo   Fun
 
   BlockPointerTypeInfo   Cls
 
   MemberPointerTypeInfo   Mem
 
   PipeTypeInfo   PipeInfo
 
}; 
 

Detailed Description

One instance of this struct is used for each type in a declarator that is parsed.

This is intended to be a small value object.

Definition at line 1174 of file DeclSpec.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Pointer 
Reference 
Array 
Function 
BlockPointer 
MemberPointer 
Paren 
Pipe 

Definition at line 1177 of file DeclSpec.h.

Constructor & Destructor Documentation

◆ DeclaratorChunk()

clang::DeclaratorChunk::DeclaratorChunk ( )
inline

Definition at line 1175 of file DeclSpec.h.

Member Function Documentation

◆ destroy()

void clang::DeclaratorChunk::destroy ( )
inline

◆ getArray()

static DeclaratorChunk clang::DeclaratorChunk::getArray ( unsigned  TypeQuals,
bool  isStatic,
bool  isStar,
Expr NumElts,
SourceLocation  LBLoc,
SourceLocation  RBLoc 
)
inlinestatic

◆ getAttrs() [1/2]

ParsedAttributesView& clang::DeclaratorChunk::getAttrs ( )
inline

Definition at line 1575 of file DeclSpec.h.

References AttrList.

◆ getAttrs() [2/2]

const ParsedAttributesView& clang::DeclaratorChunk::getAttrs ( ) const
inline

◆ getBlockPointer()

static DeclaratorChunk clang::DeclaratorChunk::getBlockPointer ( unsigned  TypeQuals,
SourceLocation  Loc 
)
inlinestatic

Return a DeclaratorChunk for a block.

Definition at line 1652 of file DeclSpec.h.

References BlockPointer, Cls, Kind, Loc, and clang::DeclaratorChunk::BlockPointerTypeInfo::TypeQuals.

◆ getFunction()

DeclaratorChunk DeclaratorChunk::getFunction ( bool  hasProto,
bool  isAmbiguous,
SourceLocation  LParenLoc,
ParamInfo Params,
unsigned  NumParams,
SourceLocation  EllipsisLoc,
SourceLocation  RParenLoc,
bool  RefQualifierIsLvalueRef,
SourceLocation  RefQualifierLoc,
SourceLocation  MutableLoc,
ExceptionSpecificationType  ESpecType,
SourceRange  ESpecRange,
ParsedType Exceptions,
SourceRange ExceptionRanges,
unsigned  NumExceptions,
Expr NoexceptExpr,
CachedTokens ExceptionSpecTokens,
ArrayRef< NamedDecl * >  DeclsInPrototype,
SourceLocation  LocalRangeBegin,
SourceLocation  LocalRangeEnd,
Declarator TheDeclarator,
TypeResult  TrailingReturnType = TypeResult(),
SourceLocation  TrailingReturnTypeLoc = SourceLocation(),
DeclSpec MethodQualifiers = nullptr 
)
static

DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.

"TheDeclarator" is the declarator that this will be added to.

Definition at line 160 of file DeclSpec.cpp.

References clang::DeclaratorChunk::FunctionTypeInfo::DeclsInPrototype, clang::DeclaratorChunk::FunctionTypeInfo::DeleteParams, clang::DeclaratorChunk::FunctionTypeInfo::EllipsisLoc, EndLoc, clang::EST_DependentNoexcept, clang::EST_Dynamic, clang::EST_NoexceptFalse, clang::EST_NoexceptTrue, clang::EST_None, clang::EST_Unparsed, clang::DeclaratorChunk::FunctionTypeInfo::Exceptions, clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocBeg, clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecLocEnd, clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecTokens, clang::DeclaratorChunk::FunctionTypeInfo::ExceptionSpecType, clang::DeclSpec::forEachCVRUQualifier(), Fun, Function, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::DeclSpec::getAttributePool(), clang::DeclSpec::getAttributes(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::DeclSpec::getTypeQualifiers(), clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype, clang::DeclaratorChunk::FunctionTypeInfo::HasTrailingReturnType, clang::Declarator::InlineParams, clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous, clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::SourceLocation::isValid(), clang::DeclaratorChunk::FunctionTypeInfo::isVariadic, Kind, Loc, clang::DeclaratorChunk::FunctionTypeInfo::LParenLoc, clang::DeclaratorChunk::FunctionTypeInfo::MethodQualifiers, clang::DeclaratorChunk::FunctionTypeInfo::MutableLoc, clang::DeclaratorChunk::FunctionTypeInfo::NoexceptExpr, clang::DeclaratorChunk::FunctionTypeInfo::NumExceptionsOrDecls, clang::DeclaratorChunk::FunctionTypeInfo::NumParams, clang::DeclaratorChunk::FunctionTypeInfo::Params, clang::DeclaratorChunk::FunctionTypeInfo::QualAttrFactory, clang::DeclaratorChunk::TypeAndRange::Range, clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierIsLValueRef, clang::DeclaratorChunk::FunctionTypeInfo::RefQualifierLoc, clang::DeclaratorChunk::FunctionTypeInfo::RParenLoc, clang::DeclSpec::SetTypeQual(), clang::ParsedAttributesView::size(), clang::AttributePool::takeAllFrom(), clang::ParsedAttributes::takeAllFrom(), clang::DeclSpec::TQ_atomic, clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnType, clang::DeclaratorChunk::FunctionTypeInfo::TrailingReturnTypeLoc, and clang::DeclaratorChunk::TypeAndRange::Ty.

Referenced by maybeSynthesizeBlockSignature().

◆ getMemberPointer()

static DeclaratorChunk clang::DeclaratorChunk::getMemberPointer ( const CXXScopeSpec SS,
unsigned  TypeQuals,
SourceLocation  StarLoc,
SourceLocation  EndLoc 
)
inlinestatic

◆ getParen()

static DeclaratorChunk clang::DeclaratorChunk::getParen ( SourceLocation  LParenLoc,
SourceLocation  RParenLoc 
)
inlinestatic

Return a DeclaratorChunk for a paren.

Definition at line 1687 of file DeclSpec.h.

References EndLoc, Kind, Loc, and Paren.

◆ getPipe()

static DeclaratorChunk clang::DeclaratorChunk::getPipe ( unsigned  TypeQuals,
SourceLocation  Loc 
)
inlinestatic

Return a DeclaratorChunk for a block.

Definition at line 1662 of file DeclSpec.h.

References Cls, Kind, Loc, Pipe, and clang::DeclaratorChunk::BlockPointerTypeInfo::TypeQuals.

◆ getPointer()

static DeclaratorChunk clang::DeclaratorChunk::getPointer ( unsigned  TypeQuals,
SourceLocation  Loc,
SourceLocation  ConstQualLoc,
SourceLocation  VolatileQualLoc,
SourceLocation  RestrictQualLoc,
SourceLocation  AtomicQualLoc,
SourceLocation  UnalignedQualLoc 
)
inlinestatic

◆ getReference()

static DeclaratorChunk clang::DeclaratorChunk::getReference ( unsigned  TypeQuals,
SourceLocation  Loc,
bool  lvalue 
)
inlinestatic

◆ getSourceRange()

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

Definition at line 1186 of file DeclSpec.h.

References EndLoc, clang::SourceLocation::isInvalid(), and Loc.

◆ isParen()

bool clang::DeclaratorChunk::isParen ( ) const
inline

Definition at line 1696 of file DeclSpec.h.

References Kind, and Paren.

Member Data Documentation

◆ @210

union { ... }

◆ Arr

ArrayTypeInfo clang::DeclaratorChunk::Arr

◆ AttrList

ParsedAttributesView clang::DeclaratorChunk::AttrList

Definition at line 1192 of file DeclSpec.h.

Referenced by getAttrs().

◆ Cls

BlockPointerTypeInfo clang::DeclaratorChunk::Cls

Definition at line 1554 of file DeclSpec.h.

Referenced by destroy(), getBlockPointer(), and getPipe().

◆ EndLoc

SourceLocation clang::DeclaratorChunk::EndLoc

EndLoc - If valid, the place where this chunck ends.

Definition at line 1184 of file DeclSpec.h.

Referenced by getArray(), getFunction(), getMemberPointer(), getParen(), and getSourceRange().

◆ Fun

FunctionTypeInfo clang::DeclaratorChunk::Fun

◆ Kind

enum { ... } clang::DeclaratorChunk::Kind

◆ Loc

SourceLocation clang::DeclaratorChunk::Loc

◆ Mem

MemberPointerTypeInfo clang::DeclaratorChunk::Mem

◆ PipeInfo

PipeTypeInfo clang::DeclaratorChunk::PipeInfo

Definition at line 1556 of file DeclSpec.h.

Referenced by destroy().

◆ Ptr

PointerTypeInfo clang::DeclaratorChunk::Ptr

Definition at line 1550 of file DeclSpec.h.

Referenced by destroy(), fillAtomicQualLoc(), and getPointer().

◆ Ref

ReferenceTypeInfo clang::DeclaratorChunk::Ref

Definition at line 1551 of file DeclSpec.h.

Referenced by destroy(), and getReference().


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