summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/BugReporterVisitors.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-16 07:46:53 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-16 07:46:53 +0000
commit8219b821259e6b3d6980d87760db589b54996579 (patch)
treece1c9e66472f4ca6b2a27c6a7097a97df33357aa /clang/lib/Checker/BugReporterVisitors.cpp
parent2115a3f0337a4d731191ed91cbdd06bbcca18a77 (diff)
downloadbcm5719-llvm-8219b821259e6b3d6980d87760db589b54996579.tar.gz
bcm5719-llvm-8219b821259e6b3d6980d87760db589b54996579.zip
Start migration of static analyzer to using the
implicit lvalue-to-rvalue casts that John McCall recently introduced. This causes a whole bunch of logic in the analyzer for handling lvalues to vanish. It does, however, raise a few issues in the analyzer w.r.t to modeling various constructs (e.g., field accesses to compound literals). The .c/.m analysis test cases that fail are due to a missing lvalue-to-rvalue cast that will get introduced into the AST. The .cpp failures were more than I could investigate in one go, and the patch was already getting huge. I have XFAILED some of these tests, and they should obviously be further investigated. Some highlights of this patch include: - CFG no longer requires an lvalue bit for CFGElements - StackFrameContext doesn't need an 'asLValue' flag - The "VisitLValue" path from GRExprEngine has been eliminated. Besides the test case failures (XFAILed), there are surely other bugs that are fallout from this change. llvm-svn: 121960
Diffstat (limited to 'clang/lib/Checker/BugReporterVisitors.cpp')
-rw-r--r--clang/lib/Checker/BugReporterVisitors.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Checker/BugReporterVisitors.cpp b/clang/lib/Checker/BugReporterVisitors.cpp
index d466abe0684..20e1296997f 100644
--- a/clang/lib/Checker/BugReporterVisitors.cpp
+++ b/clang/lib/Checker/BugReporterVisitors.cpp
@@ -318,13 +318,14 @@ void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
GRStateManager &StateMgr = BRC.getStateManager();
const GRState *state = N->getState();
+ // Walk through lvalue-to-rvalue conversions.
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S)) {
if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
const VarRegion *R =
- StateMgr.getRegionManager().getVarRegion(VD, N->getLocationContext());
+ StateMgr.getRegionManager().getVarRegion(VD, N->getLocationContext());
// What did we load?
- SVal V = state->getSVal(S);
+ SVal V = state->getSVal(loc::MemRegionVal(R));
if (isa<loc::ConcreteInt>(V) || isa<nonloc::ConcreteInt>(V)
|| V.isUndef()) {
OpenPOWER on IntegriCloud