14#ifndef LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
15#define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H
68#define PARSED_ATTR(NAME) AT_##NAME,
69#include "clang/Basic/AttrParsedAttrList.inc"
88 LLVM_PREFERRED_TYPE(Kind)
89 unsigned AttrKind : 16;
91 LLVM_PREFERRED_TYPE(Syntax)
92 unsigned SyntaxUsed : 4;
93 LLVM_PREFERRED_TYPE(
bool)
94 unsigned SpellingIndex : 4;
95 LLVM_PREFERRED_TYPE(
bool)
96 unsigned IsAlignas : 1;
97 LLVM_PREFERRED_TYPE(
bool)
98 unsigned IsRegularKeywordAttribute : 1;
108 constexpr Form(
Syntax SyntaxUsed,
unsigned SpellingIndex,
bool IsAlignas,
109 bool IsRegularKeywordAttribute)
110 : SyntaxUsed(SyntaxUsed), SpellingIndex(SpellingIndex),
111 IsAlignas(IsAlignas),
112 IsRegularKeywordAttribute(IsRegularKeywordAttribute) {}
115 IsAlignas(
Tok ==
tok::kw_alignas),
128 static Form Keyword(
bool IsAlignas,
bool IsRegularKeywordAttribute) {
130 IsRegularKeywordAttribute);
140 IsAlignas(0), IsRegularKeywordAttribute(0) {}
142 LLVM_PREFERRED_TYPE(Syntax)
143 unsigned SyntaxUsed : 4;
144 unsigned SpellingIndex : 4;
145 LLVM_PREFERRED_TYPE(
bool)
146 unsigned IsAlignas : 1;
147 LLVM_PREFERRED_TYPE(
bool)
148 unsigned IsRegularKeywordAttribute : 1;
154 : AttrName(AttrName), AttrScope(AttrScope), AttrRange(AttrRange),
155 AttrKind(AttrKind), SyntaxUsed(FormUsed.
getSyntax()),
156 SpellingIndex(FormUsed.getSpellingIndex()),
166 AttrName,
Scope, AttrRange,
190 IsRegularKeywordAttribute);
198 bool hasScope()
const {
return AttrScope.isValid(); }
209 StringRef AttrName)
const;
214 std::optional<StringRef>
260 "Spelling cannot be found");
263 : calculateAttributeSpellingListIndex();
276 unsigned calculateAttributeSpellingListIndex()
const;
280 unsigned getAttributeSpellingListIndexRaw()
const {
return SpellingIndex; }
292#define KEYWORD_ATTRIBUTE(NAME, HASARG, ...) \
293 case tok::kw_##NAME: \
295#include "clang/Basic/RegularKeywordAttrInfo.inc"
296#undef KEYWORD_ATTRIBUTE
Defines the Diagnostic-related interfaces.
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TokenKind enum and support functions.
An object for streaming information to a record.
SourceLocation getScopeLoc() const
bool isAttributeSpellingListCalculated() const
AttributeCommonInfo(const IdentifierInfo *AttrName, SourceRange AttrRange, Form FormUsed)
bool isMicrosoftAttribute() const
bool isClangScope() const
void setAttributeSpellingListIndex(unsigned V)
std::string getNormalizedFullName() const
Gets the normalized full name, which consists of both scope and name and with surrounding underscores...
Syntax
The style used to specify an attribute.
@ AS_Keyword
__ptr16, alignas(...), etc.
@ AS_Declspec
__declspec(...)
@ AS_ContextSensitiveKeyword
Context-sensitive version of a keyword attribute.
@ AS_HLSLAnnotation
<vardecl> : <annotation>
@ AS_Implicit
The attibute has no source code manifestation and is only created implicitly.
@ AS_Microsoft
[uuid("...")] class Foo
AttributeCommonInfo(SourceRange AttrRange, Kind K, Form FormUsed)
bool isCXX11Attribute() const
bool isDeclspecAttribute() const
SourceRange getRange() const
bool isC23Attribute() const
void setRange(SourceRange R)
AttributeCommonInfo(const IdentifierInfo *AttrName, AttributeScopeInfo AttrScope, SourceRange AttrRange, Kind AttrKind, Form FormUsed)
void setAttrName(const IdentifierInfo *AttrNameII)
unsigned getAttributeSpellingListIndex() const
const IdentifierInfo * getScopeName() const
bool isExplicitScope() const
StringRef getNormalizedAttrName(StringRef ScopeName) const
std::optional< StringRef > tryGetCorrectedAttrName(StringRef ScopeName, StringRef AttrName, const TargetInfo &Target, const LangOptions &LangOpts) const
AttributeCommonInfo(const IdentifierInfo *AttrName, AttributeScopeInfo Scope, SourceRange AttrRange, Form FormUsed)
bool isContextSensitiveKeywordAttribute() const
AttributeCommonInfo(AttributeCommonInfo &&)=default
static AttrArgsInfo getCXX11AttrArgsInfo(const IdentifierInfo *Name)
bool isGNUAttribute() const
bool isRegularKeywordAttribute() const
AttributeCommonInfo(SourceRange AttrRange, AttributeScopeInfo AttrScope, Kind K, Form FormUsed)
SourceRange getNormalizedRange() const
std::optional< StringRef > tryGetCorrectedScopeName(StringRef ScopeName) const
bool isKeywordAttribute() const
SourceLocation getLoc() const
const IdentifierInfo * getAttrName() const
StringRef getNormalizedScopeName() const
AttributeCommonInfo(const AttributeCommonInfo &)=default
static constexpr unsigned SpellingNotCalculated
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
Kind getParsedKind() const
@ ak_attr_info
AttributeCommonInfo *.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Scope - A scope is a transient data structure that is used while parsing the program.
Encodes a location in the source.
A trivial tuple used to represent a source range.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Exposes information about the current target.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
bool doesKeywordAttributeTakeArgs(tok::TokenKind Kind)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.