xref: /minix3/external/bsd/llvm/dist/clang/lib/Basic/Attributes.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc #include "clang/Basic/Attributes.h"
2*0a6a1f1dSLionel Sambuc #include "clang/Basic/IdentifierTable.h"
3*0a6a1f1dSLionel Sambuc #include "llvm/ADT/StringSwitch.h"
4*0a6a1f1dSLionel Sambuc using namespace clang;
5*0a6a1f1dSLionel Sambuc 
hasAttribute(AttrSyntax Syntax,const IdentifierInfo * Scope,const IdentifierInfo * Attr,const llvm::Triple & T,const LangOptions & LangOpts)6*0a6a1f1dSLionel Sambuc int clang::hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope,
7*0a6a1f1dSLionel Sambuc                          const IdentifierInfo *Attr, const llvm::Triple &T,
8*0a6a1f1dSLionel Sambuc                          const LangOptions &LangOpts) {
9*0a6a1f1dSLionel Sambuc   StringRef Name = Attr->getName();
10*0a6a1f1dSLionel Sambuc   // Normalize the attribute name, __foo__ becomes foo.
11*0a6a1f1dSLionel Sambuc   if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__"))
12*0a6a1f1dSLionel Sambuc     Name = Name.substr(2, Name.size() - 4);
13*0a6a1f1dSLionel Sambuc 
14*0a6a1f1dSLionel Sambuc #include "clang/Basic/AttrHasAttributeImpl.inc"
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc   return 0;
17*0a6a1f1dSLionel Sambuc }
18