From 925b0e53f38c7e2c3362e50af610296e89668cbc Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Wed, 21 Aug 2013 22:07:20 +0000 Subject: [PATCH] Updated the consumed analysis warnings to use a more standardized diagnostic. Patch thanks to Christian Wailes! llvm-svn: 188940 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 --- clang/lib/Sema/SemaDeclAttr.cpp | 16 ++++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 2cf364933ce7..dd0c540cbb56 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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, DefaultIgnore; -def warn_uniqueness_attribute_wrong_decl_type : Warning< - "%0 attribute only applies to methods">, - InGroup, DefaultIgnore; // ConsumedStrict warnings def warn_use_in_unknown_state : Warning< diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 67059b2ace4b..0292a1312d5c 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -974,8 +974,8 @@ static void handleConsumesAttr(Sema &S, Decl *D, if (!checkAttributeNumArgs(S, Attr, 0)) return; if (!(isa(D) || isa(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(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(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(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; }