1 #include "clang/Basic/Attributes.h"
2 #include "clang/Basic/AttrSubjectMatchRules.h"
3 #include "clang/Basic/IdentifierTable.h"
4 #include "llvm/ADT/StringSwitch.h"
7 int clang::hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope,
8 const IdentifierInfo *Attr, const TargetInfo &Target,
9 const LangOptions &LangOpts) {
10 StringRef Name = Attr->getName();
11 // Normalize the attribute name, __foo__ becomes foo.
12 if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__"))
13 Name = Name.substr(2, Name.size() - 4);
15 #include "clang/Basic/AttrHasAttributeImpl.inc"
20 const char *attr::getSubjectMatchRuleSpelling(attr::SubjectMatchRule Rule) {
22 #define ATTR_MATCH_RULE(NAME, SPELLING, IsAbstract) \
25 #include "clang/Basic/AttrSubMatchRulesList.inc"
27 llvm_unreachable("Invalid subject match rule");