diff options
author | Anna Zaks <ganna@apple.com> | 2012-03-21 19:45:01 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-03-21 19:45:01 +0000 |
commit | 6797d6ee237ab6903fc526c66e69a8a159556860 (patch) | |
tree | 39132b4068c604e0dc83124226da75d7b248ad62 /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | d42e8287209fe026b9a1011f82301f8ab71e77df (diff) | |
download | bcm5719-llvm-6797d6ee237ab6903fc526c66e69a8a159556860.tar.gz bcm5719-llvm-6797d6ee237ab6903fc526c66e69a8a159556860.zip |
[analyser] Factor out FindUniqueBinding from RetainCount checker.
So that others could use it as well. No functionality change.
llvm-svn: 153211
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index b06a50d856b..4f21c2a16b2 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2106,38 +2106,6 @@ PathDiagnosticPiece *CFRefReportVisitor::VisitNode(const ExplodedNode *N, return P; } -namespace { - class FindUniqueBinding : - public StoreManager::BindingsHandler { - SymbolRef Sym; - const MemRegion* Binding; - bool First; - - public: - FindUniqueBinding(SymbolRef sym) : Sym(sym), Binding(0), First(true) {} - - bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R, - SVal val) { - - SymbolRef SymV = val.getAsSymbol(); - if (!SymV || SymV != Sym) - return true; - - if (Binding) { - First = false; - return false; - } - else - Binding = R; - - return true; - } - - operator bool() { return First && Binding; } - const MemRegion *getRegion() { return Binding; } - }; -} - // Find the first node in the current function context that referred to the // tracked symbol and the memory location that value was stored to. Note, the // value is only reported if the allocation occurred in the same function as @@ -2156,7 +2124,7 @@ GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N, if (!B.lookup(Sym)) break; - FindUniqueBinding FB(Sym); + StoreManager::FindUniqueBinding FB(Sym); StateMgr.iterBindings(St, FB); if (FB) FirstBinding = FB.getRegion(); |