]> granicus.if.org Git - clang/commitdiff
Sema: attribute((annotate)) must have at least one argument
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 14 Dec 2014 01:05:01 +0000 (01:05 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 14 Dec 2014 01:05:01 +0000 (01:05 +0000)
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

lib/Sema/SemaDeclAttr.cpp
test/Parser/access-spec-attrs.cpp

index 9cace20ee190d22070d52413fa7a67bad5853fbd..6cc79fff3eac3adda58b92592e3996a254bf5bcc 100644 (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;
index 4fa5975811651b335a07bd81423c7b09bdfed86a..2958e385f8b51ce6e09ed828d6af2c4cedc0d438 100644 (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) {