From 81fcac72061abd5a6e16184394357bf18f2321e3 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 14 Dec 2014 01:05:01 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaDeclAttr.cpp | 2 +- test/Parser/access-spec-attrs.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.50.1