]> granicus.if.org Git - clang/commitdiff
Removed a parameter from handleAttrWithMessage to make it more consistent with other...
authorAaron Ballman <aaron@aaronballman.com>
Thu, 18 Jul 2013 13:13:52 +0000 (13:13 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 18 Jul 2013 13:13:52 +0000 (13:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186578 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/MicrosoftExtensions.c
test/Sema/attr-unavailable-message.c

index 4c18a3306143fd154dd6308418e0b0575826fecf..cdc9649d9ad66a9860435703a6acba8c48df7e87 100644 (file)
@@ -2038,8 +2038,8 @@ static void handleDestructorAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 }
 
 template <typename AttrTy>
-static void handleAttrWithMessage(Sema &S, Decl *D, const AttributeList &Attr,
-                                  const char *Name) {
+static void handleAttrWithMessage(Sema &S, Decl *D,
+                                  const AttributeList &Attr) {
   unsigned NumArgs = Attr.getNumArgs();
   if (NumArgs > 1) {
     S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1;
@@ -2052,7 +2052,7 @@ static void handleAttrWithMessage(Sema &S, Decl *D, const AttributeList &Attr,
     StringLiteral *SE = dyn_cast<StringLiteral>(Attr.getArg(0));
     if (!SE) {
       S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_not_string)
-        << Name;
+        << Attr.getName();
       return;
     }
     Str = SE->getString();
@@ -4792,7 +4792,7 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
     handleCXX11NoReturnAttr(S, D, Attr);
     break;
   case AttributeList::AT_Deprecated:
-    handleAttrWithMessage<DeprecatedAttr>(S, D, Attr, "deprecated");
+    handleAttrWithMessage<DeprecatedAttr>(S, D, Attr);
     break;
   case AttributeList::AT_Destructor:  handleDestructorAttr  (S, D, Attr); break;
   case AttributeList::AT_ExtVectorType:
@@ -4873,7 +4873,7 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
   case AttributeList::AT_Packed:      handlePackedAttr      (S, D, Attr); break;
   case AttributeList::AT_Section:     handleSectionAttr     (S, D, Attr); break;
   case AttributeList::AT_Unavailable:
-    handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable");
+    handleAttrWithMessage<UnavailableAttr>(S, D, Attr);
     break;
   case AttributeList::AT_ArcWeakrefUnavailable: 
     handleArcWeakrefUnavailableAttr (S, D, Attr); 
index 5215e72b1bac64118cf67b8b394794a156dbbad3..6bafc36482890b66edc4027f667237b9389bd868 100644 (file)
@@ -96,7 +96,7 @@ struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declar
 #define MY_TEXT                "This is also deprecated"
 __declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
 
-struct __declspec(deprecated(123)) DS2 {};     // expected-error {{argument to deprecated attribute was not a string literal}}
+struct __declspec(deprecated(123)) DS2 {};     // expected-error {{argument to 'deprecated' attribute was not a string literal}}
 
 void test( void ) {
        e1 = one;       // expected-warning {{'e1' is deprecated: This is deprecated}}
index 97104960e5e46a7e7b5a03d8b949a462bb8bb0bd..1e1e19e60b7bffda9a50eb0732d1a3e18ea3a78d 100644 (file)
@@ -6,6 +6,11 @@ double dfoo(double)  __attribute__((__unavailable__("NO LONGER"))); // expected-
 
 void bar() __attribute__((__unavailable__)); // expected-note {{explicitly marked unavailable}}
 
+int quux(void) __attribute__((__unavailable__(12))); // expected-error {{argument to '__unavailable__' attribute was not a string literal}}
+
+#define ACCEPTABLE     "Use something else"
+int quux2(void) __attribute__((__unavailable__(ACCEPTABLE)));
+
 void test_foo() {
   int ir = foo(1); // expected-error {{'foo' is unavailable: USE IFOO INSTEAD}}
   double dr = dfoo(1.0); // expected-error {{'dfoo' is unavailable: NO LONGER}}