summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-12-11 19:35:42 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-12-11 19:35:42 +0000
commitc41e03addf008ecc03cec42596db7fa55dd95329 (patch)
treec069ac4c21095e286c527c54230827161e321db3 /lib/Sema/SemaChecking.cpp
parentb13e6793c22b2fabc614dd46e912fa9c18769645 (diff)
When checking for nonnull parameter attributes, also check the ParmVarDecl since the attribute may reside there, instead of just on the FunctionDecl. Fixes PR21668.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224039 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 8e5592564f..57fc14e786 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -6766,7 +6766,8 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
}
if (!AttrNonNull.empty())
for (unsigned i = 0; i < NumArgs; ++i)
- if (FD->getParamDecl(i) == PV && AttrNonNull[i]) {
+ if (FD->getParamDecl(i) == PV &&
+ (AttrNonNull[i] || PV->hasAttr<NonNullAttr>())) {
std::string Str;
llvm::raw_string_ostream S(Str);
E->printPretty(S, nullptr, getPrintingPolicy());