diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-17 08:50:05 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2010-02-17 08:50:05 +0000 |
commit | df3a61bb5148361254c253eccd91aa4517cc8eaa (patch) | |
tree | 1aedde373ebeaac955a82ed8b243c93f3cf541bc /lib/Checker/SymbolManager.cpp | |
parent | c30470dd245e2c3b367d3d806e75bf6cc20fc18c (diff) |
In symbol reaper, a variable is live if its stack frame is the parent of the
current stack frame.
When leaving a callee, remove all bindings belonging to that callee.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/SymbolManager.cpp')
-rw-r--r-- | lib/Checker/SymbolManager.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Checker/SymbolManager.cpp b/lib/Checker/SymbolManager.cpp index 40bdcf65bc..7278b4189c 100644 --- a/lib/Checker/SymbolManager.cpp +++ b/lib/Checker/SymbolManager.cpp @@ -14,6 +14,7 @@ #include "clang/Checker/PathSensitive/SymbolManager.h" #include "clang/Checker/PathSensitive/MemRegion.h" +#include "clang/Analysis/AnalysisContext.h" #include "llvm/Support/raw_ostream.h" using namespace clang; @@ -222,7 +223,11 @@ bool SymbolReaper::isLive(SymbolRef sym) { bool SymbolReaper::isLive(const Stmt *Loc, const VarRegion *VR) const { const StackFrameContext *SFC = VR->getStackFrame(); - return SFC == CurrentStackFrame ? Liveness.isLive(Loc, VR->getDecl()) : true; + + if (SFC == CurrentStackFrame) + return Liveness.isLive(Loc, VR->getDecl()); + else + return SFC->isParentOf(CurrentStackFrame); } SymbolVisitor::~SymbolVisitor() {} |