diff options
Diffstat (limited to 'lib/Sema/AttributeList.cpp')
-rw-r--r-- | lib/Sema/AttributeList.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp index 8e7029350a..93f8c5d359 100644 --- a/lib/Sema/AttributeList.cpp +++ b/lib/Sema/AttributeList.cpp @@ -95,13 +95,15 @@ AttributePool::createIntegerAttribute(ASTContext &C, IdentifierInfo *Name, SourceLocation TokLoc, int Arg) { Expr *IArg = IntegerLiteral::Create(C, llvm::APInt(32, (uint64_t) Arg), C.IntTy, TokLoc); - return create(Name, TokLoc, 0, TokLoc, 0, TokLoc, &IArg, 1, 0); + return create(Name, TokLoc, 0, TokLoc, 0, TokLoc, &IArg, 1, + AttributeList::AS_GNU); } #include "clang/Sema/AttrParsedAttrKinds.inc" AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name, - const IdentifierInfo *ScopeName) { + const IdentifierInfo *ScopeName, + Syntax SyntaxUsed) { StringRef AttrName = Name->getName(); // Normalize the attribute name, __foo__ becomes foo. @@ -109,10 +111,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name, AttrName.size() >= 4) AttrName = AttrName.substr(2, AttrName.size() - 4); - // FIXME: implement attribute namespacing correctly. SmallString<64> Buf; if (ScopeName) - AttrName = ((Buf += ScopeName->getName()) += "___") += AttrName; - - return ::getAttrKind(AttrName); + Buf += ScopeName->getName(); + // Ensure that in the case of C++11 attributes, we look for '::foo' if it is + // unscoped. + if (ScopeName || SyntaxUsed == AS_CXX11) + Buf += "::"; + Buf += AttrName; + + return ::getAttrKind(Buf); } |