Syntax SyntaxUsed) {
StringRef AttrName = Name->getName();
- // Normalize the attribute name, __foo__ becomes foo.
- if (AttrName.size() >= 4 && AttrName.startswith("__") &&
+ SmallString<64> FullName;
+ if (ScopeName)
+ FullName += ScopeName->getName();
+
+ // Normalize the attribute name, __foo__ becomes foo. This is only allowable
+ // for GNU attributes.
+ bool IsGNU = SyntaxUsed == AS_GNU || (SyntaxUsed == AS_CXX11 &&
+ FullName.equals("gnu"));
+ if (IsGNU && AttrName.size() >= 4 && AttrName.startswith("__") &&
AttrName.endswith("__"))
- AttrName = AttrName.substr(2, AttrName.size() - 4);
+ AttrName = AttrName.slice(2, AttrName.size() - 2);
- SmallString<64> Buf;
- if (ScopeName)
- 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;
+ FullName += "::";
+ FullName += AttrName;
- return ::getAttrKind(Buf);
+ return ::getAttrKind(FullName);
}
unsigned AttributeList::getAttributeSpellingListIndex() const {
struct __declspec(aligned) S2 {}; /* expected-warning {{unknown __declspec attribute 'aligned' ignored}} */
struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */
+
+__declspec(__noreturn__) void f7(void); /* expected-warning {{unknown __declspec attribute '__noreturn__' ignored}} */
static_assert(alignof(outer<int,char>::inner<double,short>) == alignof(int) * alignof(double), "template's alignment is wrong");
static_assert(alignof(int(int)) >= 1, "alignof(function) not positive"); // expected-error{{invalid application of 'alignof' to a function type}}
+
+[[__carries_dependency__]] // expected-warning{{unknown attribute '__carries_dependency__' ignored}}
+void func(void);