clang  6.0.0svn
Attributes.cpp
Go to the documentation of this file.
4 #include "llvm/ADT/StringSwitch.h"
5 using namespace clang;
6 
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);
14 
15 #include "clang/Basic/AttrHasAttributeImpl.inc"
16 
17  return 0;
18 }
19 
21  switch (Rule) {
22 #define ATTR_MATCH_RULE(NAME, SPELLING, IsAbstract) \
23  case attr::NAME: \
24  return SPELLING;
25 #include "clang/Basic/AttrSubMatchRulesList.inc"
26  }
27  llvm_unreachable("Invalid subject match rule");
28 }
One of these records is kept for each identifier that is lexed.
SubjectMatchRule
A list of all the recognized kinds of attributes.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
AttrSyntax
Definition: Attributes.h:20
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:39
int hasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope, const IdentifierInfo *Attr, const TargetInfo &Target, const LangOptions &LangOpts)
Return the version number associated with the attribute if we recognize and implement the attribute s...
Definition: Attributes.cpp:7
Exposes information about the current target.
Definition: TargetInfo.h:54
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const char * getSubjectMatchRuleSpelling(SubjectMatchRule Rule)
Definition: Attributes.cpp:20
StringRef getName() const
Return the actual identifier string.
Dataflow Directional Tag Classes.
Attr - This represents one attribute.
Definition: Attr.h:43