From 34776d429496601454a817451aede2ea39793b0e 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188940 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 3 --- lib/Sema/SemaDeclAttr.cpp | 16 ++++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 2cf364933c..dd0c540cbb 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/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/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 67059b2ace..0292a1312d 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/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; } -- 2.40.0