r224204 - Sema: attribute((annotate)) must have at least one argument
David Majnemer
david.majnemer at gmail.com
Sat Dec 13 17:05:04 PST 2014
Author: majnemer
Date: Sat Dec 13 19:05:01 2014
New Revision: 224204
URL: http://llvm.org/viewvc/llvm-project?rev=224204&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Parser/access-spec-attrs.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=224204&r1=224203&r2=224204&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Dec 13 19:05:01 2014
@@ -4802,7 +4802,7 @@ bool Sema::ProcessAccessDeclAttributeLis
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;
Modified: cfe/trunk/test/Parser/access-spec-attrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/access-spec-attrs.cpp?rev=224204&r1=224203&r2=224204&view=diff
==============================================================================
--- cfe/trunk/test/Parser/access-spec-attrs.cpp (original)
+++ cfe/trunk/test/Parser/access-spec-attrs.cpp Sat Dec 13 19:05:01 2014
@@ -5,6 +5,7 @@ public __attribute__((unavailable)): //
void foo();
private __attribute__((annotate("foobar"))):
void bar();
+private __attribute__((annotate())): // expected-error {{'annotate' attribute takes one argument}}
};
void f(X x) {
More information about the cfe-commits
mailing list