[cfe-commits] r126735 - /cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Feb 28 17:59:41 PST 2011
Author: akirtzidis
Date: Mon Feb 28 19:59:41 2011
New Revision: 126735
URL: http://llvm.org/viewvc/llvm-project?rev=126735&view=rev
Log:
[analyzer] Also make sure that the parameter is coming from the current stack frame.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp?rev=126735&r1=126734&r2=126735&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp Mon Feb 28 19:59:41 2011
@@ -191,12 +191,16 @@
C.addTransition(state->set<T>(sym, true));
}
-static QualType parameterTypeFromSVal(SVal val) {
+static QualType parameterTypeFromSVal(SVal val, CheckerContext &C) {
+ const StackFrameContext *
+ SFC = C.getPredecessor()->getLocationContext()->getCurrentStackFrame();
if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(&val)) {
const MemRegion* R = X->getRegion();
if (const VarRegion *VR = R->getAs<VarRegion>())
- if (VR->hasStackParametersStorage())
- return VR->getValueType();
+ if (const StackArgumentsSpaceRegion *
+ stackReg = dyn_cast<StackArgumentsSpaceRegion>(VR->getMemorySpace()))
+ if (stackReg->getStackFrame() == SFC)
+ return VR->getValueType();
}
return QualType();
@@ -218,7 +222,7 @@
// FIXME: Cumbersome! Maybe add hook at construction of SVals at start of
// function ?
- QualType parmT = parameterTypeFromSVal(loc);
+ QualType parmT = parameterTypeFromSVal(loc, C);
if (parmT.isNull())
return;
More information about the cfe-commits
mailing list