From: David Majnemer Date: Sun, 14 Dec 2014 01:05:01 +0000 (+0000) Subject: Sema: attribute((annotate)) must have at least one argument X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81fcac72061abd5a6e16184394357bf18f2321e3;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224204 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 9cace20ee1..6cc79fff3e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -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; diff --git a/test/Parser/access-spec-attrs.cpp b/test/Parser/access-spec-attrs.cpp index 4fa5975811..2958e385f8 100644 --- a/test/Parser/access-spec-attrs.cpp +++ b/test/Parser/access-spec-attrs.cpp @@ -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) {