Merge two attribute diagnostics into one
Summary:
Merged the recently added `err_attribute_argument_negative` diagnostic
with existing `err_attribute_requires_positive_integer` diagnostic:
the former allows only strictly positive integer, while the latter
also allows zero.
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51853
llvm-svn: 342367
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index b58976a..f921d3e 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -254,7 +254,8 @@
}
if (StrictlyUnsigned && I.isSigned() && I.isNegative()) {
- S.Diag(getAttrLoc(AI), diag::err_attribute_argument_negative) << AI;
+ S.Diag(getAttrLoc(AI), diag::err_attribute_requires_positive_integer)
+ << AI << /*non-negative*/ 1;
return false;
}
diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp
index ba96ba9..c720aff 100644
--- a/clang/lib/Sema/SemaStmtAttr.cpp
+++ b/clang/lib/Sema/SemaStmtAttr.cpp
@@ -304,7 +304,7 @@
if (Val <= 0) {
S.Diag(A.getRange().getBegin(),
diag::err_attribute_requires_positive_integer)
- << A;
+ << A << /* positive */ 0;
return nullptr;
}
UnrollFactor = Val;