summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-27 19:05:51 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-27 19:05:51 +0000
commitcb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f (patch)
treed0baf2804035148aa4e177542089cf905801265c /clang/lib
parent415a7a6fec10d45de07c56ba693523d173028324 (diff)
downloadbcm5719-llvm-cb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f.tar.gz
bcm5719-llvm-cb67d7b7c22be6dfc93a2eed3f27b43e7dda0e3f.zip
Issue warning for trivial cases of nonnull attributes
(on functions with no pointer arguments) but only when the attribute has not been coming from a macro instantiation in a header file. Fixes first part of radar 6857843. llvm-svn: 114860
Diffstat (limited to 'clang/lib')
-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 dce1bf84fcc..09feb50bd30 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -375,8 +375,13 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// No pointer arguments? The attribute in this case is
// trivially satisfied.
- if (NonNullArgs.empty())
+ if (NonNullArgs.empty()) {
+ // Warn the trivial case only if attribute is not coming from a
+ // macro instantiation.
+ if (Attr.getLoc().isFileID())
+ S.Diag(Attr.getLoc(), diag::warn_attribute_nonnull_no_pointers);
return;
+ }
}
unsigned* start = &NonNullArgs[0];
OpenPOWER on IntegriCloud