Sema: attribute((annotate)) must have at least one argument

Sema::handleAnnotateAttr expects that some basic validation is done on
the given AttributeList.  However, ProcessAccessDeclAttributeList called
it directly.  Instead, pass the list to ProcessDeclAttribute.

This fixes PR21847.

llvm-svn: 224204
This commit is contained in:
David Majnemer 2014-12-14 01:05:01 +00:00
parent 0cb861634b
commit 706f315e65
2 changed files with 2 additions and 1 deletions

View File

@ -4802,7 +4802,7 @@ bool Sema::ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl,
const AttributeList *AttrList) {
for (const AttributeList* l = AttrList; l; l = l->getNext()) {
if (l->getKind() == AttributeList::AT_Annotate) {
handleAnnotateAttr(*this, ASDecl, *l);
ProcessDeclAttribute(*this, nullptr, ASDecl, *l, l->isCXX11Attribute());
} else {
Diag(l->getLoc(), diag::err_only_annotate_after_access_spec);
return true;

View File

@ -5,6 +5,7 @@ public __attribute__((unavailable)): // expected-error {{access specifier can on
void foo();
private __attribute__((annotate("foobar"))):
void bar();
private __attribute__((annotate())): // expected-error {{'annotate' attribute takes one argument}}
};
void f(X x) {