aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/ParsedAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/ParsedAttr.cpp')
-rw-r--r--lib/Sema/ParsedAttr.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/lib/Sema/ParsedAttr.cpp b/lib/Sema/ParsedAttr.cpp
index 5c04443460bc..5d0a734f237a 100644
--- a/lib/Sema/ParsedAttr.cpp
+++ b/lib/Sema/ParsedAttr.cpp
@@ -100,71 +100,6 @@ void AttributePool::takePool(AttributePool &pool) {
pool.Attrs.clear();
}
-#include "clang/Sema/AttrParsedAttrKinds.inc"
-
-static StringRef normalizeAttrScopeName(StringRef ScopeName,
- ParsedAttr::Syntax SyntaxUsed) {
- // Normalize the "__gnu__" scope name to be "gnu" and the "_Clang" scope name
- // to be "clang".
- if (SyntaxUsed == ParsedAttr::AS_CXX11 ||
- SyntaxUsed == ParsedAttr::AS_C2x) {
- if (ScopeName == "__gnu__")
- ScopeName = "gnu";
- else if (ScopeName == "_Clang")
- ScopeName = "clang";
- }
- return ScopeName;
-}
-
-static StringRef normalizeAttrName(StringRef AttrName,
- StringRef NormalizedScopeName,
- ParsedAttr::Syntax SyntaxUsed) {
- // Normalize the attribute name, __foo__ becomes foo. This is only allowable
- // for GNU attributes, and attributes using the double square bracket syntax.
- bool ShouldNormalize =
- SyntaxUsed == ParsedAttr::AS_GNU ||
- ((SyntaxUsed == ParsedAttr::AS_CXX11 ||
- SyntaxUsed == ParsedAttr::AS_C2x) &&
- (NormalizedScopeName == "gnu" || NormalizedScopeName == "clang"));
- if (ShouldNormalize && AttrName.size() >= 4 && AttrName.startswith("__") &&
- AttrName.endswith("__"))
- AttrName = AttrName.slice(2, AttrName.size() - 2);
-
- return AttrName;
-}
-
-ParsedAttr::Kind ParsedAttr::getKind(const IdentifierInfo *Name,
- const IdentifierInfo *ScopeName,
- Syntax SyntaxUsed) {
- StringRef AttrName = Name->getName();
-
- SmallString<64> FullName;
- if (ScopeName)
- FullName += normalizeAttrScopeName(ScopeName->getName(), SyntaxUsed);
-
- AttrName = normalizeAttrName(AttrName, FullName, SyntaxUsed);
-
- // Ensure that in the case of C++11 attributes, we look for '::foo' if it is
- // unscoped.
- if (ScopeName || SyntaxUsed == AS_CXX11 || SyntaxUsed == AS_C2x)
- FullName += "::";
- FullName += AttrName;
-
- return ::getAttrKind(FullName, SyntaxUsed);
-}
-
-unsigned ParsedAttr::getAttributeSpellingListIndex() const {
- // Both variables will be used in tablegen generated
- // attribute spell list index matching code.
- auto Syntax = static_cast<ParsedAttr::Syntax>(SyntaxUsed);
- StringRef Scope =
- ScopeName ? normalizeAttrScopeName(ScopeName->getName(), Syntax) : "";
- StringRef Name = normalizeAttrName(AttrName->getName(), Scope, Syntax);
-
-#include "clang/Sema/AttrSpellingListIndex.inc"
-
-}
-
struct ParsedAttrInfo {
unsigned NumArgs : 4;
unsigned OptArgs : 4;