diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-07 05:57:35 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-07 05:57:35 +0000 |
commit | 31d8cadc8337b5f90c2e5eddf712d769e99c977b (patch) | |
tree | e28ccd02fb061871c92ab2d782c096ad3e2ead4b /lib/Analysis/LiveVariables.cpp | |
parent | dd35ce9a783dea7e6660f9cb1d973742f3b3c73f (diff) |
Use SaveAndRestore to simplify logic in LiveVariables::runOnAllBlocks(). Patch by Kovarththanan Rajaratnam!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
-rw-r--r-- | lib/Analysis/LiveVariables.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index df7e48dfd4..070481fa14 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -18,6 +18,7 @@ #include "clang/Analysis/CFG.h" #include "clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h" #include "clang/Analysis/FlowSensitive/DataflowSolver.h" +#include "clang/Analysis/Support/SaveAndRestore.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" @@ -301,10 +302,9 @@ void LiveVariables::runOnAllBlocks(const CFG& cfg, LiveVariables::ObserverTy* Obs, bool recordStmtValues) { Solver S(*this); - ObserverTy* OldObserver = getAnalysisData().Observer; - getAnalysisData().Observer = Obs; + SaveAndRestore<LiveVariables::ObserverTy*> SRObs(getAnalysisData().Observer, + Obs); S.runOnAllBlocks(cfg, recordStmtValues); - getAnalysisData().Observer = OldObserver; } //===----------------------------------------------------------------------===// |