From 3dc0509e3c3afb1856ca86205db7f4ed6dc2581c Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Fri, 15 Feb 2013 00:32:10 +0000 Subject: [PATCH] [analyzer] Scan the correct store when finding symbols in a LazyCompoundVal. Previously, we were scanning the current store. Now, we properly scan the store that the LazyCompoundVal came from, which may have very different live symbols. llvm-svn: 175232 --- clang/lib/StaticAnalyzer/Core/ProgramState.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp index 73350d8..a3db376 100644 --- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp +++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp @@ -512,8 +512,16 @@ bool ScanReachableSymbols::scan(SVal val) { if (loc::MemRegionVal *X = dyn_cast(&val)) return scan(X->getRegion()); - if (nonloc::LazyCompoundVal *X = dyn_cast(&val)) - return scan(X->getRegion()); + if (nonloc::LazyCompoundVal *X = dyn_cast(&val)) { + StoreManager &StoreMgr = state->getStateManager().getStoreManager(); + // FIXME: We don't really want to use getBaseRegion() here because pointer + // arithmetic doesn't apply, but scanReachableSymbols only accepts base + // regions right now. + if (!StoreMgr.scanReachableSymbols(X->getStore(), + X->getRegion()->getBaseRegion(), + *this)) + return false; + } if (nonloc::LocAsInteger *X = dyn_cast(&val)) return scan(X->getLoc()); -- 2.7.4