summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-12 18:48:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-12 18:48:43 +0000
commit62157e534289eb9f8c8afa567c8fc5a3fa45672a (patch)
tree63a3aeaf965c4d575381542ad1bf6577f7950bed
parent7e1a30c0d3ee9d29f03273f14947e8380335f69d (diff)
downloadbcm5719-llvm-62157e534289eb9f8c8afa567c8fc5a3fa45672a.tar.gz
bcm5719-llvm-62157e534289eb9f8c8afa567c8fc5a3fa45672a.zip
Downgrade error about nonnull attribute bbeing applied to a function without point arguments to a warning
llvm-svn: 110939
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp2
-rw-r--r--clang/test/SemaObjC/nonnull.m2
3 files changed, 4 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f6987e8e3af..a9e976f434a 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -845,7 +845,7 @@ def err_attribute_argument_out_of_bounds : Error<
"'%0' attribute parameter %1 is out of bounds">;
def err_attribute_requires_objc_interface : Error<
"attribute may only be applied to an Objective-C interface">;
-def err_nonnull_pointers_only : Error<
+def warn_nonnull_pointers_only : Warning<
"nonnull attribute only applies to pointer arguments">;
def err_ownership_type : Error<
"%0 attribute only applies to %1 arguments">;
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 54ffa95ce1b..b26fd64719d 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -321,7 +321,7 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {
QualType T = getFunctionOrMethodArgType(d, x);
if (!T->isAnyPointerType() && !T->isBlockPointerType()) {
// FIXME: Should also highlight argument in decl.
- S.Diag(Attr.getLoc(), diag::err_nonnull_pointers_only)
+ S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only)
<< "nonnull" << Ex->getSourceRange();
continue;
}
diff --git a/clang/test/SemaObjC/nonnull.m b/clang/test/SemaObjC/nonnull.m
index 642f50f9e4d..15fee74a3b5 100644
--- a/clang/test/SemaObjC/nonnull.m
+++ b/clang/test/SemaObjC/nonnull.m
@@ -43,3 +43,5 @@ foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
func6((NSObject*) 0); // no-warning
func7((NSObject*) 0); // no-warning
}
+
+void func5(int) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}
OpenPOWER on IntegriCloud