class ParsedAttr

Declaration

class ParsedAttr : public AttributeCommonInfo, private TrailingObjects { /* full declaration omitted */ };

Description

ParsedAttr - Represents a syntactic attribute. For a GNU attribute, there are four forms of this construct: 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused. 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused. 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used. 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.

Declared at: clang/include/clang/Sema/ParsedAttr.h:233

Inherits from: AttributeCommonInfo, TrailingObjects

Member Variables

private clang::IdentifierInfo* MacroII = nullptr
private clang::SourceLocation MacroExpansionLoc
private clang::SourceLocation EllipsisLoc
private unsigned int NumArgs
The number of expression arguments this attribute has. The expressions themselves are stored after the object.
private unsigned int Invalid
True if already diagnosed as invalid.
private unsigned int UsedAsTypeAttr
True if this attribute was used as a type attribute.
private unsigned int IsAvailability
True if this has the extra information associated with an availability attribute.
private unsigned int IsTypeTagForDatatype
True if this has extra information associated with a type_tag_for_datatype attribute.
private unsigned int IsProperty
True if this has extra information associated with a Microsoft __delcspec(property) attribute.
private unsigned int HasParsedType
True if this has a ParsedType
private unsigned int HasProcessingCache
True if the processing cache is valid.
private unsigned int ProcessingCache
A cached value.
private unsigned int IsPragmaClangAttribute
True if the attribute is specified using '#pragma clang attribute'.
private clang::SourceLocation UnavailableLoc
The location of the 'unavailable' keyword in an availability attribute.
private const clang::Expr* MessageExpr
private const clang::ParsedAttrInfo& Info

Inherited from AttributeCommonInfo:

protected static SpellingNotCalculated = 15

Method Overview

Inherited from AttributeCommonInfo:

Methods

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::IdentifierInfo* getterId,
    clang::IdentifierInfo* setterId,
    clang::AttributeCommonInfo::Syntax syntaxUsed)

Description

Constructor for microsoft __declspec(property) attribute.

Declared at: clang/include/clang/Sema/ParsedAttr.h:405

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::IdentifierInfo* getterId
clang::IdentifierInfo* setterId
clang::AttributeCommonInfo::Syntax syntaxUsed

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::ParsedType typeArg,
    clang::AttributeCommonInfo::Syntax syntaxUsed)

Description

Constructor for attributes with a single type argument.

Declared at: clang/include/clang/Sema/ParsedAttr.h:392

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::ParsedType typeArg
clang::AttributeCommonInfo::Syntax syntaxUsed

ParsedAttr(clang::ParsedAttr&&)

Declared at: clang/include/clang/Sema/ParsedAttr.h:450

Parameters

clang::ParsedAttr&&

ParsedAttr(const clang::ParsedAttr&)

Declared at: clang/include/clang/Sema/ParsedAttr.h:449

Parameters

const clang::ParsedAttr&

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::ArgsUnion* args,
    unsigned int numArgs,
    clang::AttributeCommonInfo::Syntax syntaxUsed,
    clang::SourceLocation ellipsisLoc)

Description

Constructor for attributes with expression arguments.

Declared at: clang/include/clang/Sema/ParsedAttr.h:319

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::ArgsUnion* args
unsigned int numArgs
clang::AttributeCommonInfo::Syntax syntaxUsed
clang::SourceLocation ellipsisLoc

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::IdentifierLoc* Parm,
    const clang::AvailabilityChange& introduced,
    const clang::AvailabilityChange& deprecated,
    const clang::AvailabilityChange& obsoleted,
    clang::SourceLocation unavailable,
    const clang::Expr* messageExpr,
    clang::AttributeCommonInfo::Syntax syntaxUsed,
    clang::SourceLocation strict,
    const clang::Expr* replacementExpr)

Description

Constructor for availability attributes.

Declared at: clang/include/clang/Sema/ParsedAttr.h:335

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::IdentifierLoc* Parm
const clang::AvailabilityChange& introduced
const clang::AvailabilityChange& deprecated
const clang::AvailabilityChange& obsoleted
clang::SourceLocation unavailable
const clang::Expr* messageExpr
clang::AttributeCommonInfo::Syntax syntaxUsed
clang::SourceLocation strict
const clang::Expr* replacementExpr

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::IdentifierLoc* Parm1,
    clang::IdentifierLoc* Parm2,
    clang::IdentifierLoc* Parm3,
    clang::AttributeCommonInfo::Syntax syntaxUsed)

Description

Constructor for objc_bridge_related attributes.

Declared at: clang/include/clang/Sema/ParsedAttr.h:356

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::IdentifierLoc* Parm1
clang::IdentifierLoc* Parm2
clang::IdentifierLoc* Parm3
clang::AttributeCommonInfo::Syntax syntaxUsed

ParsedAttr(
    clang::IdentifierInfo* attrName,
    clang::SourceRange attrRange,
    clang::IdentifierInfo* scopeName,
    clang::SourceLocation scopeLoc,
    clang::IdentifierLoc* ArgKind,
    clang::ParsedType matchingCType,
    bool layoutCompatible,
    bool mustBeNull,
    clang::AttributeCommonInfo::Syntax syntaxUsed)

Description

Constructor for type_tag_for_datatype attribute.

Declared at: clang/include/clang/Sema/ParsedAttr.h:373

Parameters

clang::IdentifierInfo* attrName
clang::SourceRange attrRange
clang::IdentifierInfo* scopeName
clang::SourceLocation scopeLoc
clang::IdentifierLoc* ArgKind
clang::ParsedType matchingCType
bool layoutCompatible
bool mustBeNull
clang::AttributeCommonInfo::Syntax syntaxUsed

bool acceptsExprPack() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:628

size_t allocated_size() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:446

bool appliesToDecl(
    const clang::Decl* D,
    attr::SubjectMatchRule MatchRule) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:644

Parameters

const clang::Decl* D
attr::SubjectMatchRule MatchRule

clang::LangAS asOpenCLLangAS() const

Description

If this is an OpenCL address space attribute, returns its representation in LangAS, otherwise returns default address space.

Declared at: clang/include/clang/Sema/ParsedAttr.h:674

clang::LangAS asSYCLLangAS() const

Description

If this is an OpenCL address space attribute, returns its SYCL representation in LangAS, otherwise returns default address space.

Declared at: clang/include/clang/Sema/ParsedAttr.h:697

bool checkAtLeastNumArgs(class Sema& S,
                         unsigned int Num) const

Description

Check if the attribute has at least as many args as Num. May output an error. Returns false if a diagnostic is produced.

Declared at: clang/include/clang/Sema/ParsedAttr.h:618

Parameters

class Sema& S
unsigned int Num

bool checkAtMostNumArgs(class Sema& S,
                        unsigned int Num) const

Description

Check if the attribute has at most as many args as Num. May output an error. Returns false if a diagnostic is produced.

Declared at: clang/include/clang/Sema/ParsedAttr.h:621

Parameters

class Sema& S
unsigned int Num

bool checkExactlyNumArgs(class Sema& S,
                         unsigned int Num) const

Description

Check if the attribute has exactly as many args as Num. May output an error. Returns false if a diagnostic is produced.

Declared at: clang/include/clang/Sema/ParsedAttr.h:615

Parameters

class Sema& S
unsigned int Num

bool diagnoseAppertainsTo(
    class Sema& S,
    const clang::Stmt* St) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:636

Parameters

class Sema& S
const clang::Stmt* St

bool diagnoseAppertainsTo(
    class Sema& S,
    const clang::Decl* D) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:635

Parameters

class Sema& S
const clang::Decl* D

bool diagnoseLangOpts(class Sema& S) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:648

Parameters

class Sema& S

bool diagnoseMutualExclusion(
    class Sema& S,
    const clang::Decl* D) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:637

Parameters

class Sema& S
const clang::Decl* D

bool diagnoseMutualExclusion(
    class Sema& S,
    const clang::Stmt* St) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:641

Parameters

class Sema& S
const clang::Stmt* St

bool existsInTarget(
    const clang::TargetInfo& Target) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:649

Parameters

const clang::TargetInfo& Target

clang::ArgsUnion getArg(unsigned int Arg) const

Description

getArg - Return the specified argument.

Declared at: clang/include/clang/Sema/ParsedAttr.h:494

Parameters

unsigned int Arg

clang::Expr* getArgAsExpr(unsigned int Arg) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:503

Parameters

unsigned int Arg

clang::IdentifierLoc* getArgAsIdent(
    unsigned int Arg) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:511

Parameters

unsigned int Arg

const clang::ArgsUnion* getArgsBuffer() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:303

clang::ArgsUnion* getArgsBuffer()

Declared at: clang/include/clang/Sema/ParsedAttr.h:302

const detail::AvailabilityData*
getAvailabilityData() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:310

detail::AvailabilityData* getAvailabilityData()

Declared at: clang/include/clang/Sema/ParsedAttr.h:307

const clang::AvailabilityChange&
getAvailabilityDeprecated() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:521

const clang::AvailabilityChange&
getAvailabilityIntroduced() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:515

const clang::AvailabilityChange&
getAvailabilityObsoleted() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:527

clang::SourceLocation getEllipsisLoc() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:488

const clang::ParsedAttrInfo& getInfo() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:718

AttributeCommonInfo::Kind getKind() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:715

bool getLayoutCompatible() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:563

clang::SourceLocation getMacroExpansionLoc() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:607

clang::IdentifierInfo* getMacroIdentifier() const

Description

Return the macro identifier if this attribute was declared in a macro. nullptr is returned if it was not declared in a macro.

Declared at: clang/include/clang/Sema/ParsedAttr.h:605

void getMatchRules(
    const clang::LangOptions& LangOpts,
    SmallVectorImpl<
        std::pair<attr::SubjectMatchRule, bool>>&
        MatchRules) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:645

Parameters

const clang::LangOptions& LangOpts
SmallVectorImpl< std::pair<attr::SubjectMatchRule, bool>>& MatchRules

const clang::ParsedType& getMatchingCType() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:557

unsigned int getMaxArgs() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:631

const clang::Expr* getMessageExpr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:545

unsigned int getMinArgs() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:630

bool getMustBeNull() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:569

unsigned int getNumArgMembers() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:632

unsigned int getNumArgs() const

Description

getNumArgs - Return the number of actual arguments to this attribute.

Declared at: clang/include/clang/Sema/ParsedAttr.h:491

unsigned int getProcessingCache() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:469

const detail::PropertyData&
getPropertyDataBuffer() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:441

detail::PropertyData& getPropertyDataBuffer()

Description

The property data immediately follows the object is is mutually exclusive with arguments.

Declared at: clang/include/clang/Sema/ParsedAttr.h:437

clang::IdentifierInfo* getPropertyDataGetter()
    const

Declared at: clang/include/clang/Sema/ParsedAttr.h:580

clang::IdentifierInfo* getPropertyDataSetter()
    const

Declared at: clang/include/clang/Sema/ParsedAttr.h:586

const clang::Expr* getReplacementExpr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:551

unsigned int getSemanticSpelling() const

Description

If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration (due to having semantically-distinct spelling variations), return the value of that semantic spelling. If the parsed attribute does not have a semantic equivalent, or would not have a Spelling enumeration, the value UINT_MAX is returned.

Declared at: clang/include/clang/Sema/ParsedAttr.h:670

clang::SourceLocation getStrictLoc() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:533

const clang::ParsedType& getTypeArg() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:575

clang::ParsedType& getTypeBuffer()

Description

The type buffer immediately follows the object and are mutually exclusive with arguments.

Declared at: clang/include/clang/Sema/ParsedAttr.h:430

const clang::ParsedType& getTypeBuffer() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:431

const detail::TypeTagForDatatypeData&
getTypeTagForDatatypeDataSlot() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:424

detail::TypeTagForDatatypeData&
getTypeTagForDatatypeDataSlot()

Description

Type tag information is stored immediately following the arguments, if any, at the end of the object. They are mutually exclusive with availability slots.

Declared at: clang/include/clang/Sema/ParsedAttr.h:421

clang::SourceLocation getUnavailableLoc() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:539

void handleAttrWithDelayedArgs(
    clang::Sema& S,
    clang::Decl* D) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:634

Parameters

clang::Sema& S
clang::Decl* D

bool hasCustomParsing() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:627

bool hasMacroIdentifier() const

Description

Returns true if this attribute was declared in a macro.

Declared at: clang/include/clang/Sema/ParsedAttr.h:601

bool hasParsedType() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:457

bool hasProcessingCache() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:467

bool hasVariadicArg() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:633

bool isArgExpr(unsigned int Arg) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:499

Parameters

unsigned int Arg

bool isArgIdent(unsigned int Arg) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:507

Parameters

unsigned int Arg

bool isDeclspecPropertyAttribute() const

Description

Is this the Microsoft __declspec(property) attribute?

Declared at: clang/include/clang/Sema/ParsedAttr.h:460

bool isInvalid() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:464

bool isKnownToGCC() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:650

bool isPackExpansion() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:487

bool isParamExpr(size_t N) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:629

Parameters

size_t N

bool isPragmaClangAttribute() const

Description

True if the attribute is specified using '#pragma clang attribute'.

Declared at: clang/include/clang/Sema/ParsedAttr.h:483

bool isStmtAttr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:625

bool isSupportedByPragmaAttribute() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:651

bool isTargetSpecificAttr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:623

bool isTypeAttr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:624

bool isUsedAsTypeAttr() const

Declared at: clang/include/clang/Sema/ParsedAttr.h:479

size_t numTrailingObjects(
    OverloadToken<detail::TypeTagForDatatypeData>)
    const

Declared at: clang/include/clang/Sema/ParsedAttr.h:245

Parameters

OverloadToken<detail::TypeTagForDatatypeData>

size_t numTrailingObjects(
    OverloadToken<detail::AvailabilityData>) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:241

Parameters

OverloadToken<detail::AvailabilityData>

size_t numTrailingObjects(
    OverloadToken<clang::ArgsUnion>) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:240

Parameters

OverloadToken<clang::ArgsUnion>

size_t numTrailingObjects(
    OverloadToken<clang::ParsedType>) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:248

Parameters

OverloadToken<clang::ParsedType>

size_t numTrailingObjects(
    OverloadToken<detail::PropertyData>) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:251

Parameters

OverloadToken<detail::PropertyData>

void setInvalid(bool b = true) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:465

Parameters

bool b = true

void setIsPragmaClangAttribute()

Declared at: clang/include/clang/Sema/ParsedAttr.h:485

void setMacroIdentifier(
    clang::IdentifierInfo* MacroName,
    clang::SourceLocation Loc)

Description

Set the macro identifier info object that this parsed attribute was declared in if it was declared in a macro. Also set the expansion location of the macro.

Declared at: clang/include/clang/Sema/ParsedAttr.h:595

Parameters

clang::IdentifierInfo* MacroName
clang::SourceLocation Loc

void setProcessingCache(unsigned int value) const

Declared at: clang/include/clang/Sema/ParsedAttr.h:474

Parameters

unsigned int value

void setUsedAsTypeAttr(bool Used = true)

Declared at: clang/include/clang/Sema/ParsedAttr.h:480

Parameters

bool Used = true

bool slidesFromDeclToDeclSpecLegacyBehavior()
    const

Description

Returns whether a [[]] attribute, if specified ahead of a declaration, should be applied to the decl-specifier-seq instead (i.e. whether it "slides" to the decl-specifier-seq). By the standard, attributes specified before the declaration always appertain to the declaration, but historically we have allowed some of these attributes to slide to the decl-specifier-seq, so we need to keep supporting this behavior. This may only be called if isStandardAttributeSyntax() returns true.

Declared at: clang/include/clang/Sema/ParsedAttr.h:663

~ParsedAttr()

Declared at: clang/include/clang/Sema/ParsedAttr.h:453