21#include "llvm/ADT/StringSwitch.h"
27 if (Name ==
"__gnu__")
38 if (Name.size() >= 4 && Name.starts_with(
"__") && Name.ends_with(
"__"))
39 return Name.substr(2, Name.size() - 4);
47#include "clang/Basic/AttrHasAttributeImpl.inc"
64 if (LangOpts.OpenMP && ScopeName ==
"omp" &&
65 (Name ==
"directive" || Name ==
"sequence"))
75 if (Ptr->hasSpelling(Syntax, Name))
87 Target, LangOpts, CheckPlugins);
99#define ATTR_MATCH_RULE(NAME, SPELLING, IsAbstract) \
102#include "clang/Basic/AttrSubMatchRulesList.inc"
104 llvm_unreachable(
"Invalid subject match rule");
126 StringRef NormalizedScopeName,
130 bool ShouldNormalize =
134 (NormalizedScopeName.empty() || NormalizedScopeName ==
"gnu" ||
135 NormalizedScopeName ==
"clang"));
162#include "clang/Sema/AttrParsedAttrKinds.inc"
170 if (!ScopeName.empty()) {
192 return ::getAttrKind(
normalizeName(Name, ScopeName, SyntaxUsed), SyntaxUsed);
199#define CXX11_ATTR_ARGS_INFO
200 return llvm::StringSwitch<AttributeCommonInfo::AttrArgsInfo>(AttrName)
201#include "clang/Basic/CXX11AttributeInfo.inc"
203#undef CXX11_ATTR_ARGS_INFO
207 return static_cast<std::string
>(
213 StringRef AttrName)
const {
214 return static_cast<std::string
>(
225 return llvm::StringSwitch<AttributeCommonInfo::Scope>(ScopeName)
237unsigned AttributeCommonInfo::calculateAttributeSpellingListIndex()
const {
247#include "clang/Sema/AttrSpellingListIndex.inc"
250#define ATTR_NAME(NAME) NAME,
252#include "clang/Basic/AttributeSpellingList.inc"
255#define ATTR_SCOPE_NAME(SCOPE_NAME) SCOPE_NAME,
257#include "clang/Basic/AttributeSpellingList.inc"
260std::optional<StringRef>
262 if (ScopeName.size() > 0 &&
269 return CorrectedScopeName;
286 return CorrectedAttrName;
static StringRef canonicalizeAttrName(StringRef Name)
static StringRef normalizeAttrName(StringRef AttrName, StringRef NormalizedScopeName, AttributeCommonInfo::Syntax SyntaxUsed)
static constexpr const char * AttrScopeSpellingList[]
static StringRef canonicalizeScopeName(StringRef Name)
static AttributeCommonInfo::Scope getScopeFromNormalizedScopeName(StringRef ScopeName)
static SmallString< 64 > normalizeName(StringRef AttrName, StringRef ScopeName, AttributeCommonInfo::Syntax SyntaxUsed)
static constexpr const char * AttrSpellingList[]
static int hasAttributeImpl(AttributeCommonInfo::Syntax Syntax, StringRef Name, StringRef ScopeName, const TargetInfo &Target, const LangOptions &LangOpts)
static StringRef normalizeAttrScopeName(StringRef ScopeName, AttributeCommonInfo::Syntax SyntaxUsed)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
Attr - This represents one attribute.
bool isClangScope() const
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_HLSLAnnotation
<vardecl> : <annotation>
const IdentifierInfo * getScopeName() const
StringRef getNormalizedAttrName(StringRef ScopeName) const
std::optional< StringRef > tryGetCorrectedAttrName(StringRef ScopeName, StringRef AttrName, const TargetInfo &Target, const LangOptions &LangOpts) const
static AttrArgsInfo getCXX11AttrArgsInfo(const IdentifierInfo *Name)
SourceRange getNormalizedRange() const
std::optional< StringRef > tryGetCorrectedScopeName(StringRef ScopeName) const
const IdentifierInfo * getAttrName() const
StringRef getNormalizedScopeName() const
Kind getParsedKind() const
SourceLocation getNameLoc() const
const IdentifierInfo * getName() const
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
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.
std::optional< StringRef > getCorrection() const
void add(const StringRef Candidate)
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
Exposes information about the current target.
Defines the clang::TargetInfo interface.
SubjectMatchRule
A list of all the recognized kinds of attributes.
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
StringRef getName(const HeaderType T)
The JSON file list parser is used to communicate input to InstallAPI.
int hasAttribute(AttributeCommonInfo::Syntax Syntax, llvm::StringRef ScopeName, llvm::StringRef AttrName, const TargetInfo &Target, const LangOptions &LangOpts, bool CheckPlugins)
Return the version number associated with the attribute if we recognize and implement the attribute s...
const std::list< std::unique_ptr< ParsedAttrInfo > > & getAttributePluginInstances()