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