aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 3800fa3568..edf9a664e2 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -14,6 +14,7 @@
#include "Sema.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/TargetInfo.h"
+#include <sstream>
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -266,10 +267,14 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {
unsigned x = (unsigned) ArgNum.getZExtValue();
if (x < 1 || x > NumArgs) {
+ std::ostringstream os;
+ os << I.getArgNum();
S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds,
- "nonnull", Ex->getSourceRange());
+ "nonnull", os.str(), Ex->getSourceRange());
return;
}
+
+ --x;
// Is the function argument a pointer type?
if (!proto->getArgType(x).getCanonicalType()->isPointerType()) {