aboutsummaryrefslogtreecommitdiffstats
path: root/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-02-05 19:37:40 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-02-05 19:37:40 +0000
commitb3090384227bf61f889b6aaf4230eccaacc85514 (patch)
tree6d36474d5d489e49c094ba806b8b9a65309592bc /lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
parent123063377428540752bad91c7fbd536a762e31bd (diff)
downloadsrc-b3090384227bf61f889b6aaf4230eccaacc85514.tar.gz
src-b3090384227bf61f889b6aaf4230eccaacc85514.zip
Vendor import of clang release_40 branch r294123:vendor/clang/clang-release_40-r294123
Notes
Notes: svn path=/vendor/clang/dist/; revision=313291 svn path=/vendor/clang/clang-release_40-r294123/; revision=313292; tag=vendor/clang/clang-release_40-r294123
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
index 0e0f52af3165..437378e53daa 100644
--- a/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
@@ -94,11 +94,18 @@ void MacOSXAPIChecker::CheckDispatchOnce(CheckerContext &C, const CallExpr *CE,
bool SuggestStatic = false;
os << "Call to '" << FName << "' uses";
if (const VarRegion *VR = dyn_cast<VarRegion>(RB)) {
+ const VarDecl *VD = VR->getDecl();
+ // FIXME: These should have correct memory space and thus should be filtered
+ // out earlier. This branch only fires when we're looking from a block,
+ // which we analyze as a top-level declaration, onto a static local
+ // in a function that contains the block.
+ if (VD->isStaticLocal())
+ return;
// We filtered out globals earlier, so it must be a local variable
// or a block variable which is under UnknownSpaceRegion.
if (VR != R)
os << " memory within";
- if (VR->getDecl()->hasAttr<BlocksAttr>())
+ if (VD->hasAttr<BlocksAttr>())
os << " the block variable '";
else
os << " the local variable '";