clang  6.0.0svn
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
clang::DeclSpec Class Reference

Captures information about "declaration specifiers". More...

#include "clang/Sema/DeclSpec.h"

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

Public Types

enum  SCS {
  SCS_unspecified = 0, SCS_typedef, SCS_extern, SCS_static,
  SCS_auto, SCS_register, SCS_private_extern, SCS_mutable
}
 storage-class-specifier More...
 
enum  TSC { TSC_unspecified, TSC_imaginary, TSC_complex }
 
enum  TQ {
  TQ_unspecified = 0, TQ_const = 1, TQ_restrict = 2, TQ_volatile = 4,
  TQ_unaligned = 8, TQ_atomic = 16
}
 
enum  ParsedSpecifiers {
  PQ_None = 0, PQ_StorageClassSpecifier = 1, PQ_TypeSpecifier = 2, PQ_TypeQualifier = 4,
  PQ_FunctionSpecifier = 8
}
 ParsedSpecifiers - Flags to query which specifiers were applied. More...
 
typedef ThreadStorageClassSpecifier TSCS
 
typedef TypeSpecifierWidth TSW
 
typedef TypeSpecifierSign TSS
 
typedef TypeSpecifierType TST
 

Public Member Functions

 DeclSpec (AttributeFactory &attrFactory)
 
SCS getStorageClassSpec () const
 
TSCS getThreadStorageClassSpec () const
 
bool isExternInLinkageSpec () const
 
void setExternInLinkageSpec (bool Value)
 
SourceLocation getStorageClassSpecLoc () const
 
SourceLocation getThreadStorageClassSpecLoc () const
 
void ClearStorageClassSpecs ()
 
void ClearTypeSpecType ()
 
TSW getTypeSpecWidth () const
 
TSC getTypeSpecComplex () const
 
TSS getTypeSpecSign () const
 
TST getTypeSpecType () const
 
bool isTypeAltiVecVector () const
 
bool isTypeAltiVecPixel () const
 
bool isTypeAltiVecBool () const
 
bool isTypeSpecOwned () const
 
bool isTypeRep () const
 
bool isTypeSpecPipe () const
 
ParsedType getRepAsType () const
 
DeclgetRepAsDecl () const
 
ExprgetRepAsExpr () const
 
CXXScopeSpecgetTypeSpecScope ()
 
const CXXScopeSpecgetTypeSpecScope () const
 
SourceRange getSourceRange () const LLVM_READONLY
 
SourceLocation getLocStart () const LLVM_READONLY
 
SourceLocation getLocEnd () const LLVM_READONLY
 
SourceLocation getTypeSpecWidthLoc () const
 
SourceRange getTypeSpecWidthRange () const
 
SourceLocation getTypeSpecComplexLoc () const
 
SourceLocation getTypeSpecSignLoc () const
 
SourceLocation getTypeSpecTypeLoc () const
 
SourceLocation getAltiVecLoc () const
 
SourceLocation getTypeSpecTypeNameLoc () const
 
SourceRange getTypeofParensRange () const
 
void setTypeofParensRange (SourceRange range)
 
bool hasAutoTypeSpec () const
 
bool hasTagDefinition () const
 
unsigned getTypeQualifiers () const
 getTypeQualifiers - Return a set of TQs. More...
 
SourceLocation getConstSpecLoc () const
 
SourceLocation getRestrictSpecLoc () const
 
SourceLocation getVolatileSpecLoc () const
 
SourceLocation getAtomicSpecLoc () const
 
SourceLocation getUnalignedSpecLoc () const
 
SourceLocation getPipeLoc () const
 
void ClearTypeQualifiers ()
 Clear out all of the type qualifiers. More...
 
bool isInlineSpecified () const
 
SourceLocation getInlineSpecLoc () const
 
bool isVirtualSpecified () const
 
SourceLocation getVirtualSpecLoc () const
 
bool isExplicitSpecified () const
 
SourceLocation getExplicitSpecLoc () const
 
bool isNoreturnSpecified () const
 
SourceLocation getNoreturnSpecLoc () const
 
void ClearFunctionSpecs ()
 
bool hasTypeSpecifier () const
 Return true if any type-specifier has been found. More...
 
unsigned getParsedSpecifiers () const
 Return a bitmask of which flavors of specifiers this DeclSpec includes. More...
 
bool isEmpty () const
 isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the production of it. More...
 
void SetRangeStart (SourceLocation Loc)
 
void SetRangeEnd (SourceLocation Loc)
 
bool SetStorageClassSpec (Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 These methods set the specified attribute of the DeclSpec and return false if there was no error. More...
 
bool SetStorageClassSpecThread (TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool SetTypeSpecWidth (TSW W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 These methods set the specified attribute of the DeclSpec, but return true and ignore the request if invalid (e.g. More...
 
bool SetTypeSpecComplex (TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool SetTypeSpecSign (TSS S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool SetTypeSpecType (TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 
bool SetTypeSpecType (TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ParsedType Rep, const PrintingPolicy &Policy)
 
bool SetTypeSpecType (TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, Decl *Rep, bool Owned, const PrintingPolicy &Policy)
 
bool SetTypeSpecType (TST T, SourceLocation TagKwLoc, SourceLocation TagNameLoc, const char *&PrevSpec, unsigned &DiagID, ParsedType Rep, const PrintingPolicy &Policy)
 
bool SetTypeSpecType (TST T, SourceLocation TagKwLoc, SourceLocation TagNameLoc, const char *&PrevSpec, unsigned &DiagID, Decl *Rep, bool Owned, const PrintingPolicy &Policy)
 
bool SetTypeSpecType (TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, Expr *Rep, const PrintingPolicy &policy)
 
bool SetTypeAltiVecVector (bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 
bool SetTypeAltiVecPixel (bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 
bool SetTypeAltiVecBool (bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 
bool SetTypePipe (bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
 
bool SetTypeSpecError ()
 
void UpdateDeclRep (Decl *Rep)
 
void UpdateTypeRep (ParsedType Rep)
 
void UpdateExprRep (Expr *Rep)
 
bool SetTypeQual (TQ T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const LangOptions &Lang)
 
bool setFunctionSpecInline (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool setFunctionSpecForceInline (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool setFunctionSpecVirtual (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool setFunctionSpecExplicit (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool setFunctionSpecNoreturn (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool SetFriendSpec (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool setModulePrivateSpec (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool SetConstexprSpec (SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
 
bool isFriendSpecified () const
 
SourceLocation getFriendSpecLoc () const
 
bool isModulePrivateSpecified () const
 
SourceLocation getModulePrivateSpecLoc () const
 
bool isConstexprSpecified () const
 
SourceLocation getConstexprSpecLoc () const
 
void ClearConstexprSpec ()
 
AttributePoolgetAttributePool () const
 
void addAttributes (AttributeList *AL)
 Concatenates two attribute lists. More...
 
bool hasAttributes () const
 
ParsedAttributesgetAttributes ()
 
const ParsedAttributesgetAttributes () const
 
void takeAttributesFrom (ParsedAttributes &attrs)
 
void Finish (Sema &S, const PrintingPolicy &Policy)
 Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (lacking an FP type). More...
 
const WrittenBuiltinSpecsgetWrittenBuiltinSpecs () const
 
ObjCDeclSpecgetObjCQualifiers () const
 
void setObjCQualifiers (ObjCDeclSpec *quals)
 
bool isMissingDeclaratorOk ()
 Checks if this DeclSpec can stand alone, without a Declarator. More...
 

Static Public Member Functions

static bool isDeclRep (TST T)
 
static const char * getSpecifierName (DeclSpec::TST T, const PrintingPolicy &Policy)
 Turn a type-specifier-type into a string like "_Bool" or "union". More...
 
static const char * getSpecifierName (DeclSpec::TQ Q)
 
static const char * getSpecifierName (DeclSpec::TSS S)
 
static const char * getSpecifierName (DeclSpec::TSC C)
 
static const char * getSpecifierName (DeclSpec::TSW W)
 
static const char * getSpecifierName (DeclSpec::SCS S)
 
static const char * getSpecifierName (DeclSpec::TSCS S)
 

Static Public Attributes

static const TSCS TSCS_unspecified = clang::TSCS_unspecified
 
static const TSCS TSCS___thread = clang::TSCS___thread
 
static const TSCS TSCS_thread_local = clang::TSCS_thread_local
 
static const TSCS TSCS__Thread_local = clang::TSCS__Thread_local
 
static const TSW TSW_unspecified = clang::TSW_unspecified
 
static const TSW TSW_short = clang::TSW_short
 
static const TSW TSW_long = clang::TSW_long
 
static const TSW TSW_longlong = clang::TSW_longlong
 
static const TSS TSS_unspecified = clang::TSS_unspecified
 
static const TSS TSS_signed = clang::TSS_signed
 
static const TSS TSS_unsigned = clang::TSS_unsigned
 
static const TST TST_unspecified = clang::TST_unspecified
 
static const TST TST_void = clang::TST_void
 
static const TST TST_char = clang::TST_char
 
static const TST TST_wchar = clang::TST_wchar
 
static const TST TST_char16 = clang::TST_char16
 
static const TST TST_char32 = clang::TST_char32
 
static const TST TST_int = clang::TST_int
 
static const TST TST_int128 = clang::TST_int128
 
static const TST TST_half = clang::TST_half
 
static const TST TST_float = clang::TST_float
 
static const TST TST_double = clang::TST_double
 
static const TST TST_float16 = clang::TST_Float16
 
static const TST TST_float128 = clang::TST_float128
 
static const TST TST_bool = clang::TST_bool
 
static const TST TST_decimal32 = clang::TST_decimal32
 
static const TST TST_decimal64 = clang::TST_decimal64
 
static const TST TST_decimal128 = clang::TST_decimal128
 
static const TST TST_enum = clang::TST_enum
 
static const TST TST_union = clang::TST_union
 
static const TST TST_struct = clang::TST_struct
 
static const TST TST_interface = clang::TST_interface
 
static const TST TST_class = clang::TST_class
 
static const TST TST_typename = clang::TST_typename
 
static const TST TST_typeofType = clang::TST_typeofType
 
static const TST TST_typeofExpr = clang::TST_typeofExpr
 
static const TST TST_decltype = clang::TST_decltype
 
static const TST TST_decltype_auto = clang::TST_decltype_auto
 
static const TST TST_underlyingType = clang::TST_underlyingType
 
static const TST TST_auto = clang::TST_auto
 
static const TST TST_auto_type = clang::TST_auto_type
 
static const TST TST_unknown_anytype = clang::TST_unknown_anytype
 
static const TST TST_atomic = clang::TST_atomic
 
static const TST TST_error = clang::TST_error
 

Detailed Description

Captures information about "declaration specifiers".

"Declaration specifiers" encompasses storage-class-specifiers, type-specifiers, type-qualifiers, and function-specifiers.

Definition at line 228 of file DeclSpec.h.

Member Typedef Documentation

◆ TSCS

Definition at line 245 of file DeclSpec.h.

◆ TSS

Definition at line 265 of file DeclSpec.h.

◆ TST

Definition at line 271 of file DeclSpec.h.

◆ TSW

Definition at line 252 of file DeclSpec.h.

Member Enumeration Documentation

◆ ParsedSpecifiers

ParsedSpecifiers - Flags to query which specifiers were applied.

This is returned by getParsedSpecifiers.

Enumerator
PQ_None 
PQ_StorageClassSpecifier 
PQ_TypeSpecifier 
PQ_TypeQualifier 
PQ_FunctionSpecifier 

Definition at line 323 of file DeclSpec.h.

◆ SCS

storage-class-specifier

Note
The order of these enumerators is important for diagnostics.
Enumerator
SCS_unspecified 
SCS_typedef 
SCS_extern 
SCS_static 
SCS_auto 
SCS_register 
SCS_private_extern 
SCS_mutable 

Definition at line 232 of file DeclSpec.h.

◆ TQ

Enumerator
TQ_unspecified 
TQ_const 
TQ_restrict 
TQ_volatile 
TQ_unaligned 
TQ_atomic 

Definition at line 310 of file DeclSpec.h.

◆ TSC

Enumerator
TSC_unspecified 
TSC_imaginary 
TSC_complex 

Definition at line 258 of file DeclSpec.h.

Constructor & Destructor Documentation

◆ DeclSpec()

clang::DeclSpec::DeclSpec ( AttributeFactory attrFactory)
inline

Definition at line 418 of file DeclSpec.h.

Member Function Documentation

◆ addAttributes()

void clang::DeclSpec::addAttributes ( AttributeList AL)
inline

Concatenates two attribute lists.

The GCC attribute syntax allows for the following:

short __attribute__(( unused, deprecated ))
int __attribute__(( may_alias, aligned(16) )) var;

This declares 4 attributes using 2 lists. The following syntax is also allowed and equivalent to the previous declaration.

short __attribute__((unused)) __attribute__((deprecated))
int __attribute__((may_alias)) __attribute__((aligned(16))) var;

Definition at line 732 of file DeclSpec.h.

References clang::ParsedAttributes::addAll().

Referenced by addContextSensitiveTypeNullability().

◆ ClearConstexprSpec()

void clang::DeclSpec::ClearConstexprSpec ( )
inline

Definition at line 706 of file DeclSpec.h.

◆ ClearFunctionSpecs()

void clang::DeclSpec::ClearFunctionSpecs ( )
inline

Definition at line 575 of file DeclSpec.h.

◆ ClearStorageClassSpecs()

void clang::DeclSpec::ClearStorageClassSpecs ( )
inline

◆ ClearTypeQualifiers()

void clang::DeclSpec::ClearTypeQualifiers ( )
inline

Clear out all of the type qualifiers.

Definition at line 548 of file DeclSpec.h.

◆ ClearTypeSpecType()

void clang::DeclSpec::ClearTypeSpecType ( )
inline

Definition at line 467 of file DeclSpec.h.

References TST_unspecified.

◆ Finish()

void DeclSpec::Finish ( Sema S,
const PrintingPolicy Policy 
)

Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Imaginary" (lacking an FP type).

Finish - This does final analysis of the declspec, rejecting things like "_Imaginary" (lacking an FP type).

After calling this method, DeclSpec is guaranteed self-consistent, even if an error occurred.

This returns a diagnostic to issue or diag::NUM_DIAGNOSTICS if there is no error. After calling this method, DeclSpec is guaranteed self-consistent, even if an error occurred.

Definition at line 992 of file DeclSpec.cpp.

◆ getAltiVecLoc()

SourceLocation clang::DeclSpec::getAltiVecLoc ( ) const
inline

Definition at line 509 of file DeclSpec.h.

◆ getAtomicSpecLoc()

SourceLocation clang::DeclSpec::getAtomicSpecLoc ( ) const
inline

◆ getAttributePool()

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

Definition at line 711 of file DeclSpec.h.

References clang::ParsedAttributes::getPool().

Referenced by takeDeclAttributes().

◆ getAttributes() [1/2]

ParsedAttributes& clang::DeclSpec::getAttributes ( )
inline

◆ getAttributes() [2/2]

const ParsedAttributes& clang::DeclSpec::getAttributes ( ) const
inline

Definition at line 739 of file DeclSpec.h.

◆ getConstexprSpecLoc()

SourceLocation clang::DeclSpec::getConstexprSpecLoc ( ) const
inline

Definition at line 704 of file DeclSpec.h.

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

◆ getConstSpecLoc()

SourceLocation clang::DeclSpec::getConstSpecLoc ( ) const
inline

◆ getExplicitSpecLoc()

SourceLocation clang::DeclSpec::getExplicitSpecLoc ( ) const
inline

Definition at line 570 of file DeclSpec.h.

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

◆ getFriendSpecLoc()

SourceLocation clang::DeclSpec::getFriendSpecLoc ( ) const
inline

Definition at line 698 of file DeclSpec.h.

◆ getInlineSpecLoc()

SourceLocation clang::DeclSpec::getInlineSpecLoc ( ) const
inline

Definition at line 562 of file DeclSpec.h.

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

◆ getLocEnd()

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

Definition at line 502 of file DeclSpec.h.

References clang::SourceRange::getEnd().

Referenced by isPipeDeclerator().

◆ getLocStart()

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

◆ getModulePrivateSpecLoc()

SourceLocation clang::DeclSpec::getModulePrivateSpecLoc ( ) const
inline

Definition at line 701 of file DeclSpec.h.

◆ getNoreturnSpecLoc()

SourceLocation clang::DeclSpec::getNoreturnSpecLoc ( ) const
inline

Definition at line 573 of file DeclSpec.h.

Referenced by clang::Sema::CheckMain(), and clang::Sema::DiagnoseFunctionSpecifiers().

◆ getObjCQualifiers()

ObjCDeclSpec* clang::DeclSpec::getObjCQualifiers ( ) const
inline

Definition at line 754 of file DeclSpec.h.

◆ getParsedSpecifiers()

unsigned DeclSpec::getParsedSpecifiers ( ) const

Return a bitmask of which flavors of specifiers this DeclSpec includes.

getParsedSpecifiers - Return a bitmask of which flavors of specifiers this declaration specifier includes.

Definition at line 411 of file DeclSpec.cpp.

References clang::TSCS_unspecified.

Referenced by clang::Sema::CodeCompleteDeclSpec(), clang::Parser::ParseTopLevelDecl(), and warnAboutRedundantParens().

◆ getPipeLoc()

SourceLocation clang::DeclSpec::getPipeLoc ( ) const
inline

Definition at line 545 of file DeclSpec.h.

Referenced by isPipeDeclerator().

◆ getRepAsDecl()

Decl* clang::DeclSpec::getRepAsDecl ( ) const
inline

Definition at line 489 of file DeclSpec.h.

Referenced by GetDeclSpecTypeForDeclarator().

◆ getRepAsExpr()

Expr* clang::DeclSpec::getRepAsExpr ( ) const
inline

◆ getRepAsType()

ParsedType clang::DeclSpec::getRepAsType ( ) const
inline

◆ getRestrictSpecLoc()

SourceLocation clang::DeclSpec::getRestrictSpecLoc ( ) const
inline

◆ getSourceRange()

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

◆ getSpecifierName() [1/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TST  T,
const PrintingPolicy Policy 
)
static

◆ getSpecifierName() [2/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TQ  Q)
static

Definition at line 539 of file DeclSpec.cpp.

References TQ_atomic, TQ_const, TQ_restrict, TQ_unaligned, TQ_unspecified, and TQ_volatile.

◆ getSpecifierName() [3/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TSS  S)
static

Definition at line 486 of file DeclSpec.cpp.

◆ getSpecifierName() [4/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TSC  C)
static

Definition at line 476 of file DeclSpec.cpp.

◆ getSpecifierName() [5/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TSW  W)
static

◆ getSpecifierName() [6/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::SCS  S)
static

Definition at line 442 of file DeclSpec.cpp.

◆ getSpecifierName() [7/7]

const char * DeclSpec::getSpecifierName ( DeclSpec::TSCS  S)
static

Definition at line 456 of file DeclSpec.cpp.

◆ getStorageClassSpec()

SCS clang::DeclSpec::getStorageClassSpec ( ) const
inline

◆ getStorageClassSpecLoc()

SourceLocation clang::DeclSpec::getStorageClassSpecLoc ( ) const
inline

◆ getThreadStorageClassSpec()

TSCS clang::DeclSpec::getThreadStorageClassSpec ( ) const
inline

Definition at line 446 of file DeclSpec.h.

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

◆ getThreadStorageClassSpecLoc()

SourceLocation clang::DeclSpec::getThreadStorageClassSpecLoc ( ) const
inline

Definition at line 455 of file DeclSpec.h.

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

◆ getTypeofParensRange()

SourceRange clang::DeclSpec::getTypeofParensRange ( ) const
inline

Definition at line 516 of file DeclSpec.h.

◆ getTypeQualifiers()

unsigned clang::DeclSpec::getTypeQualifiers ( ) const
inline

◆ getTypeSpecComplex()

TSC clang::DeclSpec::getTypeSpecComplex ( ) const
inline

Definition at line 475 of file DeclSpec.h.

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

◆ getTypeSpecComplexLoc()

SourceLocation clang::DeclSpec::getTypeSpecComplexLoc ( ) const
inline

Definition at line 506 of file DeclSpec.h.

◆ getTypeSpecScope() [1/2]

CXXScopeSpec& clang::DeclSpec::getTypeSpecScope ( )
inline

Definition at line 497 of file DeclSpec.h.

◆ getTypeSpecScope() [2/2]

const CXXScopeSpec& clang::DeclSpec::getTypeSpecScope ( ) const
inline

Definition at line 498 of file DeclSpec.h.

◆ getTypeSpecSign()

TSS clang::DeclSpec::getTypeSpecSign ( ) const
inline

Definition at line 476 of file DeclSpec.h.

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

◆ getTypeSpecSignLoc()

SourceLocation clang::DeclSpec::getTypeSpecSignLoc ( ) const
inline

Definition at line 507 of file DeclSpec.h.

◆ getTypeSpecType()

TST clang::DeclSpec::getTypeSpecType ( ) const
inline

◆ getTypeSpecTypeLoc()

SourceLocation clang::DeclSpec::getTypeSpecTypeLoc ( ) const
inline

◆ getTypeSpecTypeNameLoc()

SourceLocation clang::DeclSpec::getTypeSpecTypeNameLoc ( ) const
inline

Definition at line 511 of file DeclSpec.h.

◆ getTypeSpecWidth()

TSW clang::DeclSpec::getTypeSpecWidth ( ) const
inline

Definition at line 474 of file DeclSpec.h.

◆ getTypeSpecWidthLoc()

SourceLocation clang::DeclSpec::getTypeSpecWidthLoc ( ) const
inline

Definition at line 504 of file DeclSpec.h.

References clang::SourceRange::getBegin().

◆ getTypeSpecWidthRange()

SourceRange clang::DeclSpec::getTypeSpecWidthRange ( ) const
inline

Definition at line 505 of file DeclSpec.h.

◆ getUnalignedSpecLoc()

SourceLocation clang::DeclSpec::getUnalignedSpecLoc ( ) const
inline

Definition at line 544 of file DeclSpec.h.

Referenced by diagnoseRedundantReturnTypeQualifiers(), and isPipeDeclerator().

◆ getVirtualSpecLoc()

SourceLocation clang::DeclSpec::getVirtualSpecLoc ( ) const
inline

◆ getVolatileSpecLoc()

SourceLocation clang::DeclSpec::getVolatileSpecLoc ( ) const
inline

◆ getWrittenBuiltinSpecs()

const WrittenBuiltinSpecs& clang::DeclSpec::getWrittenBuiltinSpecs ( ) const
inline

Definition at line 750 of file DeclSpec.h.

◆ hasAttributes()

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

Definition at line 736 of file DeclSpec.h.

References clang::ParsedAttributes::empty().

◆ hasAutoTypeSpec()

bool clang::DeclSpec::hasAutoTypeSpec ( ) const
inline

Definition at line 519 of file DeclSpec.h.

Referenced by clang::Sema::ActOnCXXNew(), and clang::Sema::canDelayFunctionBody().

◆ hasTagDefinition()

bool DeclSpec::hasTagDefinition ( ) const

Definition at line 402 of file DeclSpec.cpp.

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

◆ hasTypeSpecifier()

bool clang::DeclSpec::hasTypeSpecifier ( ) const
inline

◆ isConstexprSpecified()

bool clang::DeclSpec::isConstexprSpecified ( ) const
inline

Definition at line 703 of file DeclSpec.h.

Referenced by clang::Sema::canDelayFunctionBody(), and getMissingDeclaratorIdLoc().

◆ isDeclRep()

static bool clang::DeclSpec::isDeclRep ( TST  T)
inlinestatic

Definition at line 412 of file DeclSpec.h.

◆ isEmpty()

bool clang::DeclSpec::isEmpty ( ) const
inline

isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the production of it.

Definition at line 602 of file DeclSpec.h.

References PQ_None.

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

◆ isExplicitSpecified()

bool clang::DeclSpec::isExplicitSpecified ( ) const
inline

Definition at line 569 of file DeclSpec.h.

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

◆ isExternInLinkageSpec()

bool clang::DeclSpec::isExternInLinkageSpec ( ) const
inline

Definition at line 449 of file DeclSpec.h.

Referenced by getFunctionStorageClass(), and StorageClassSpecToVarDeclStorageClass().

◆ isFriendSpecified()

bool clang::DeclSpec::isFriendSpecified ( ) const
inline

◆ isInlineSpecified()

bool clang::DeclSpec::isInlineSpecified ( ) const
inline

Definition at line 559 of file DeclSpec.h.

◆ isMissingDeclaratorOk()

bool DeclSpec::isMissingDeclaratorOk ( )

Checks if this DeclSpec can stand alone, without a Declarator.

Only tag declspecs can stand alone.

Definition at line 1275 of file DeclSpec.cpp.

References SCS_typedef.

◆ isModulePrivateSpecified()

bool clang::DeclSpec::isModulePrivateSpecified ( ) const
inline

Definition at line 700 of file DeclSpec.h.

References clang::SourceLocation::isValid().

◆ isNoreturnSpecified()

bool clang::DeclSpec::isNoreturnSpecified ( ) const
inline

Definition at line 572 of file DeclSpec.h.

Referenced by clang::Sema::CheckMain(), and clang::Sema::DiagnoseFunctionSpecifiers().

◆ isTypeAltiVecBool()

bool clang::DeclSpec::isTypeAltiVecBool ( ) const
inline

Definition at line 480 of file DeclSpec.h.

◆ isTypeAltiVecPixel()

bool clang::DeclSpec::isTypeAltiVecPixel ( ) const
inline

Definition at line 479 of file DeclSpec.h.

◆ isTypeAltiVecVector()

bool clang::DeclSpec::isTypeAltiVecVector ( ) const
inline

Definition at line 478 of file DeclSpec.h.

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

◆ isTypeRep()

bool clang::DeclSpec::isTypeRep ( ) const
inline

Definition at line 482 of file DeclSpec.h.

References isTypeRep().

Referenced by isTypeRep().

◆ isTypeSpecOwned()

bool clang::DeclSpec::isTypeSpecOwned ( ) const
inline

Definition at line 481 of file DeclSpec.h.

Referenced by GetDeclSpecTypeForDeclarator().

◆ isTypeSpecPipe()

bool clang::DeclSpec::isTypeSpecPipe ( ) const
inline

Definition at line 483 of file DeclSpec.h.

Referenced by isPipeDeclerator().

◆ isVirtualSpecified()

bool clang::DeclSpec::isVirtualSpecified ( ) const
inline

◆ SetConstexprSpec()

bool DeclSpec::SetConstexprSpec ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

◆ setExternInLinkageSpec()

void clang::DeclSpec::setExternInLinkageSpec ( bool  Value)
inline

Definition at line 450 of file DeclSpec.h.

◆ SetFriendSpec()

bool DeclSpec::SetFriendSpec ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 928 of file DeclSpec.cpp.

◆ setFunctionSpecExplicit()

bool DeclSpec::setFunctionSpecExplicit ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 898 of file DeclSpec.cpp.

◆ setFunctionSpecForceInline()

bool DeclSpec::setFunctionSpecForceInline ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 871 of file DeclSpec.cpp.

◆ setFunctionSpecInline()

bool DeclSpec::setFunctionSpecInline ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 857 of file DeclSpec.cpp.

◆ setFunctionSpecNoreturn()

bool DeclSpec::setFunctionSpecNoreturn ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 913 of file DeclSpec.cpp.

◆ setFunctionSpecVirtual()

bool DeclSpec::setFunctionSpecVirtual ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 883 of file DeclSpec.cpp.

◆ setModulePrivateSpec()

bool DeclSpec::setModulePrivateSpec ( SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 946 of file DeclSpec.cpp.

◆ setObjCQualifiers()

void clang::DeclSpec::setObjCQualifiers ( ObjCDeclSpec quals)
inline

Definition at line 755 of file DeclSpec.h.

Referenced by takeDeclAttributes().

◆ SetRangeEnd()

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

◆ SetRangeStart()

void clang::DeclSpec::SetRangeStart ( SourceLocation  Loc)
inline

Definition at line 606 of file DeclSpec.h.

References clang::SourceRange::setBegin().

◆ SetStorageClassSpec()

bool DeclSpec::SetStorageClassSpec ( Sema S,
SCS  SC,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

These methods set the specified attribute of the DeclSpec and return false if there was no error.

If an error occurs (for example, if we tried to set "auto" on a spec with "extern" already set), they return true and set PrevSpec and DiagID such that Diag(Loc, DiagID) << PrevSpec; will yield a useful result.

TODO: use a more general approach that still allows these diagnostics to be ignored when desired.

Definition at line 551 of file DeclSpec.cpp.

◆ SetStorageClassSpecThread()

bool DeclSpec::SetStorageClassSpecThread ( TSCS  TSC,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 612 of file DeclSpec.cpp.

References BadSpecifier(), and clang::TSCS_unspecified.

◆ SetTypeAltiVecBool()

bool DeclSpec::SetTypeAltiVecBool ( bool  isAltiVecBool,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

Definition at line 808 of file DeclSpec.cpp.

References getSpecifierName(), and clang::TST_unspecified.

◆ SetTypeAltiVecPixel()

bool DeclSpec::SetTypeAltiVecPixel ( bool  isAltiVecPixel,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

Definition at line 793 of file DeclSpec.cpp.

References getSpecifierName(), and clang::TST_unspecified.

◆ SetTypeAltiVecVector()

bool DeclSpec::SetTypeAltiVecVector ( bool  isAltiVecVector,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

Definition at line 764 of file DeclSpec.cpp.

References getSpecifierName(), and clang::TST_unspecified.

◆ setTypeofParensRange()

void clang::DeclSpec::setTypeofParensRange ( SourceRange  range)
inline

Definition at line 517 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc().

◆ SetTypePipe()

bool DeclSpec::SetTypePipe ( bool  isPipe,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

Definition at line 777 of file DeclSpec.cpp.

References getSpecifierName(), clang::TSP_pipe, and clang::TST_unspecified.

◆ SetTypeQual()

bool DeclSpec::SetTypeQual ( TQ  T,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const LangOptions Lang 
)

Definition at line 831 of file DeclSpec.cpp.

References BadSpecifier(), and clang::T.

◆ SetTypeSpecComplex()

bool DeclSpec::SetTypeSpecComplex ( TSC  C,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 643 of file DeclSpec.cpp.

References BadSpecifier(), and clang::C.

◆ SetTypeSpecError()

bool DeclSpec::SetTypeSpecError ( )

Definition at line 823 of file DeclSpec.cpp.

References clang::TST_error.

Referenced by getMissingDeclaratorIdLoc().

◆ SetTypeSpecSign()

bool DeclSpec::SetTypeSpecSign ( TSS  S,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID 
)

Definition at line 653 of file DeclSpec.cpp.

◆ SetTypeSpecType() [1/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

◆ SetTypeSpecType() [2/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
ParsedType  Rep,
const PrintingPolicy Policy 
)

Definition at line 663 of file DeclSpec.cpp.

◆ SetTypeSpecType() [3/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
Decl Rep,
bool  Owned,
const PrintingPolicy Policy 
)

Definition at line 712 of file DeclSpec.cpp.

◆ SetTypeSpecType() [4/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  TagKwLoc,
SourceLocation  TagNameLoc,
const char *&  PrevSpec,
unsigned &  DiagID,
ParsedType  Rep,
const PrintingPolicy Policy 
)

Definition at line 671 of file DeclSpec.cpp.

References getSpecifierName(), clang::T, and clang::TST_unspecified.

◆ SetTypeSpecType() [5/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  TagKwLoc,
SourceLocation  TagNameLoc,
const char *&  PrevSpec,
unsigned &  DiagID,
Decl Rep,
bool  Owned,
const PrintingPolicy Policy 
)

Definition at line 720 of file DeclSpec.cpp.

References getSpecifierName(), clang::T, and clang::TST_unspecified.

◆ SetTypeSpecType() [6/6]

bool DeclSpec::SetTypeSpecType ( TST  T,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
Expr Rep,
const PrintingPolicy policy 
)

Definition at line 692 of file DeclSpec.cpp.

References getSpecifierName(), clang::T, and clang::TST_unspecified.

◆ SetTypeSpecWidth()

bool DeclSpec::SetTypeSpecWidth ( TSW  W,
SourceLocation  Loc,
const char *&  PrevSpec,
unsigned &  DiagID,
const PrintingPolicy Policy 
)

These methods set the specified attribute of the DeclSpec, but return true and ignore the request if invalid (e.g.

"extern" then "auto" is specified).

Definition at line 626 of file DeclSpec.cpp.

References BadSpecifier(), clang::TSW_long, clang::TSW_longlong, and clang::TSW_unspecified.

◆ takeAttributesFrom()

void clang::DeclSpec::takeAttributesFrom ( ParsedAttributes attrs)
inline

◆ UpdateDeclRep()

void clang::DeclSpec::UpdateDeclRep ( Decl Rep)
inline

Definition at line 663 of file DeclSpec.h.

◆ UpdateExprRep()

void clang::DeclSpec::UpdateExprRep ( Expr Rep)
inline

Definition at line 671 of file DeclSpec.h.

◆ UpdateTypeRep()

void clang::DeclSpec::UpdateTypeRep ( ParsedType  Rep)
inline

Definition at line 667 of file DeclSpec.h.

Member Data Documentation

◆ DeclRep

Decl* clang::DeclSpec::DeclRep

Definition at line 366 of file DeclSpec.h.

◆ ExprRep

Expr* clang::DeclSpec::ExprRep

Definition at line 367 of file DeclSpec.h.

◆ TSCS___thread

const TSCS clang::DeclSpec::TSCS___thread = clang::TSCS___thread
static

Definition at line 247 of file DeclSpec.h.

◆ TSCS__Thread_local

const TSCS clang::DeclSpec::TSCS__Thread_local = clang::TSCS__Thread_local
static

Definition at line 249 of file DeclSpec.h.

◆ TSCS_thread_local

const TSCS clang::DeclSpec::TSCS_thread_local = clang::TSCS_thread_local
static

Definition at line 248 of file DeclSpec.h.

◆ TSCS_unspecified

const TSCS clang::DeclSpec::TSCS_unspecified = clang::TSCS_unspecified
static

Definition at line 246 of file DeclSpec.h.

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

◆ TSS_signed

const TSS clang::DeclSpec::TSS_signed = clang::TSS_signed
static

Definition at line 267 of file DeclSpec.h.

◆ TSS_unsigned

const TSS clang::DeclSpec::TSS_unsigned = clang::TSS_unsigned
static

Definition at line 268 of file DeclSpec.h.

◆ TSS_unspecified

const TSS clang::DeclSpec::TSS_unspecified = clang::TSS_unspecified
static

Definition at line 266 of file DeclSpec.h.

Referenced by clang::Sema::CodeCompleteDeclSpec(), and hasTypeSpecifier().

◆ TST_atomic

const TST clang::DeclSpec::TST_atomic = clang::TST_atomic
static

Definition at line 303 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc(), and getSpecifierName().

◆ TST_auto

const TST clang::DeclSpec::TST_auto = clang::TST_auto
static

Definition at line 300 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_auto_type

const TST clang::DeclSpec::TST_auto_type = clang::TST_auto_type
static

Definition at line 301 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_bool

const TST clang::DeclSpec::TST_bool = clang::TST_bool
static

Definition at line 285 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_char

const TST clang::DeclSpec::TST_char = clang::TST_char
static

Definition at line 274 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_char16

const TST clang::DeclSpec::TST_char16 = clang::TST_char16
static

Definition at line 276 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_char32

const TST clang::DeclSpec::TST_char32 = clang::TST_char32
static

Definition at line 277 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_class

const TST clang::DeclSpec::TST_class = clang::TST_class
static

◆ TST_decimal128

const TST clang::DeclSpec::TST_decimal128 = clang::TST_decimal128
static

Definition at line 288 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_decimal32

const TST clang::DeclSpec::TST_decimal32 = clang::TST_decimal32
static

Definition at line 286 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_decimal64

const TST clang::DeclSpec::TST_decimal64 = clang::TST_decimal64
static

Definition at line 287 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_decltype

const TST clang::DeclSpec::TST_decltype = clang::TST_decltype
static

◆ TST_decltype_auto

const TST clang::DeclSpec::TST_decltype_auto = clang::TST_decltype_auto
static

Definition at line 298 of file DeclSpec.h.

Referenced by clang::Sema::getDestructorTypeForDecltype(), and getSpecifierName().

◆ TST_double

const TST clang::DeclSpec::TST_double = clang::TST_double
static

Definition at line 282 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_enum

const TST clang::DeclSpec::TST_enum = clang::TST_enum
static

◆ TST_error

const TST clang::DeclSpec::TST_error = clang::TST_error
static

◆ TST_float

const TST clang::DeclSpec::TST_float = clang::TST_float
static

Definition at line 281 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_float128

const TST clang::DeclSpec::TST_float128 = clang::TST_float128
static

Definition at line 284 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_float16

const TST clang::DeclSpec::TST_float16 = clang::TST_Float16
static

Definition at line 283 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_half

const TST clang::DeclSpec::TST_half = clang::TST_half
static

Definition at line 280 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_int

const TST clang::DeclSpec::TST_int = clang::TST_int
static

Definition at line 278 of file DeclSpec.h.

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

◆ TST_int128

const TST clang::DeclSpec::TST_int128 = clang::TST_int128
static

Definition at line 279 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_interface

const TST clang::DeclSpec::TST_interface = clang::TST_interface
static

◆ TST_struct

const TST clang::DeclSpec::TST_struct = clang::TST_struct
static

◆ TST_typename

const TST clang::DeclSpec::TST_typename = clang::TST_typename
static

◆ TST_typeofExpr

const TST clang::DeclSpec::TST_typeofExpr = clang::TST_typeofExpr
static

Definition at line 296 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc(), and getSpecifierName().

◆ TST_typeofType

const TST clang::DeclSpec::TST_typeofType = clang::TST_typeofType
static

Definition at line 295 of file DeclSpec.h.

Referenced by getMissingDeclaratorIdLoc(), and getSpecifierName().

◆ TST_underlyingType

const TST clang::DeclSpec::TST_underlyingType = clang::TST_underlyingType
static

Definition at line 299 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_union

const TST clang::DeclSpec::TST_union = clang::TST_union
static

◆ TST_unknown_anytype

const TST clang::DeclSpec::TST_unknown_anytype = clang::TST_unknown_anytype
static

Definition at line 302 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_unspecified

const TST clang::DeclSpec::TST_unspecified = clang::TST_unspecified
static

◆ TST_void

const TST clang::DeclSpec::TST_void = clang::TST_void
static

Definition at line 273 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TST_wchar

const TST clang::DeclSpec::TST_wchar = clang::TST_wchar
static

Definition at line 275 of file DeclSpec.h.

Referenced by getSpecifierName().

◆ TSW_long

const TSW clang::DeclSpec::TSW_long = clang::TSW_long
static

Definition at line 255 of file DeclSpec.h.

◆ TSW_longlong

const TSW clang::DeclSpec::TSW_longlong = clang::TSW_longlong
static

Definition at line 256 of file DeclSpec.h.

◆ TSW_short

const TSW clang::DeclSpec::TSW_short = clang::TSW_short
static

Definition at line 254 of file DeclSpec.h.

◆ TSW_unspecified

const TSW clang::DeclSpec::TSW_unspecified = clang::TSW_unspecified
static

Definition at line 253 of file DeclSpec.h.

Referenced by hasTypeSpecifier().

◆ TypeRep

UnionParsedType clang::DeclSpec::TypeRep

Definition at line 365 of file DeclSpec.h.


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