2014-11-24 04:15:30 -05:00
|
|
|
#include "clang/Basic/Attributes.h"
|
2017-04-20 17:20:51 -04:00
|
|
|
#include "clang/Basic/AttrSubjectMatchRules.h"
|
2014-11-24 04:15:30 -05:00
|
|
|
#include "clang/Basic/IdentifierTable.h"
|
|
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
|
|
|
|
using namespace clang;
|
|
|
|
|
|
2015-01-18 11:23:48 -05:00
|
|
|
int clang::hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope,
|
2015-12-30 06:49:41 -05:00
|
|
|
const IdentifierInfo *Attr, const TargetInfo &Target,
|
|
|
|
|
const LangOptions &LangOpts) {
|
2014-11-24 04:15:30 -05:00
|
|
|
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"
|
|
|
|
|
|
2015-01-18 11:23:48 -05:00
|
|
|
return 0;
|
2014-11-24 04:15:30 -05:00
|
|
|
}
|
2017-04-20 17:20:51 -04:00
|
|
|
|
|
|
|
|
const char *attr::getSubjectMatchRuleSpelling(attr::SubjectMatchRule Rule) {
|
|
|
|
|
switch (Rule) {
|
|
|
|
|
#define ATTR_MATCH_RULE(NAME, SPELLING, IsAbstract) \
|
|
|
|
|
case attr::NAME: \
|
|
|
|
|
return SPELLING;
|
|
|
|
|
#include "clang/Basic/AttrSubMatchRulesList.inc"
|
|
|
|
|
}
|
|
|
|
|
llvm_unreachable("Invalid subject match rule");
|
|
|
|
|
}
|