Updated the consumed analysis warnings to use a more standardized diagnostic.
authorAaron Ballman <aaron@aaronballman.com>
Wed, 21 Aug 2013 22:07:20 +0000 (22:07 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 21 Aug 2013 22:07:20 +0000 (22:07 +0000)
Patch thanks to Christian Wailes!

llvm-svn: 188940

clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp

index 2cf364933ce7279bc35c9d09374484b765206d95..dd0c540cbb56bd39da2a2cf25a7d052f5649f976 100644 (file)
@@ -2189,9 +2189,6 @@ def warn_use_while_consumed : Warning<
 def warn_use_of_temp_while_consumed : Warning<
   "invocation of method '%0' on a temporary object while it is in the "
   "'consumed' state">, InGroup<Consumed>, DefaultIgnore;
-def warn_uniqueness_attribute_wrong_decl_type : Warning<
-  "%0 attribute only applies to methods">,
-  InGroup<Consumed>, DefaultIgnore;
 
 // ConsumedStrict warnings
 def warn_use_in_unknown_state : Warning<
index 67059b2ace4b967d2785c88ddac37ac8bb9e2d70..0292a1312d5c913294ca23ce497f0dad2e2dfc28 100644 (file)
@@ -974,8 +974,8 @@ static void handleConsumesAttr(Sema &S, Decl *D,
   if (!checkAttributeNumArgs(S, Attr, 0)) return;
 
   if (!(isa<CXXMethodDecl>(D) || isa<CXXConstructorDecl>(D))) {
-    S.Diag(Attr.getLoc(), diag::warn_uniqueness_attribute_wrong_decl_type) <<
-      Attr.getName();
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedMethod;
     return;
   }
   
@@ -989,8 +989,8 @@ static void handleCallableWhenUnconsumedAttr(Sema &S, Decl *D,
   if (!checkAttributeNumArgs(S, Attr, 0)) return;
 
   if (!isa<CXXMethodDecl>(D)) {
-    S.Diag(Attr.getLoc(), diag::warn_uniqueness_attribute_wrong_decl_type) <<
-      Attr.getName();
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedMethod;
     return;
   }
   
@@ -1004,8 +1004,8 @@ static void handleTestsConsumedAttr(Sema &S, Decl *D,
   if (!checkAttributeNumArgs(S, Attr, 0)) return;
 
   if (!isa<CXXMethodDecl>(D)) {
-    S.Diag(Attr.getLoc(), diag::warn_uniqueness_attribute_wrong_decl_type) <<
-      Attr.getName();
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedMethod;
     return;
   }
   
@@ -1019,8 +1019,8 @@ static void handleTestsUnconsumedAttr(Sema &S, Decl *D,
   if (!checkAttributeNumArgs(S, Attr, 0)) return;
 
   if (!isa<CXXMethodDecl>(D)) {
-    S.Diag(Attr.getLoc(), diag::warn_uniqueness_attribute_wrong_decl_type) <<
-      Attr.getName();
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedMethod;
     return;
   }