Updated the consumed analysis warnings to use a more standardized diagnostic.

Patch thanks to Christian Wailes!

llvm-svn: 188940
This commit is contained in:
Aaron Ballman 2013-08-21 22:07:20 +00:00
parent eb26547177
commit 925b0e53f3
2 changed files with 8 additions and 11 deletions

View 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<

View 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;
}