summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-21 22:09:15 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-21 22:09:15 +0000
commit5224e6a81d110faeba866ab2fef8458b6bcac111 (patch)
tree8c71db9302ccbadc4e035f818e803c313dee5c0f /clang/lib/Sema/SemaDeclAttr.cpp
parent2d63bc1e9975ae222bafd6ae9b74e3bdb9000410 (diff)
downloadbcm5719-llvm-5224e6a81d110faeba866ab2fef8458b6bcac111.tar.gz
bcm5719-llvm-5224e6a81d110faeba866ab2fef8458b6bcac111.zip
Add test case for nonnull attribute.
Fix indexing bug. llvm-svn: 53882
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3800fa35681..edf9a664e24 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/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()) {
OpenPOWER on IntegriCloud