diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-01-24 00:55:43 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-01-24 00:55:43 +0000 |
| commit | f08ac278ed1ac4c00cb28434b0a22b48b75ddb2c (patch) | |
| tree | 95f105e218f131adb39572638c07c1fd30739ab7 /clang/lib/Analysis/ExplodedGraph.cpp | |
| parent | 82221d62a98511e71b5a98bd8f2a05106c045936 (diff) | |
| download | bcm5719-llvm-f08ac278ed1ac4c00cb28434b0a22b48b75ddb2c.tar.gz bcm5719-llvm-f08ac278ed1ac4c00cb28434b0a22b48b75ddb2c.zip | |
More hacking on static analyzer diagnostics. When emitting summary diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup.
llvm-svn: 62903
Diffstat (limited to 'clang/lib/Analysis/ExplodedGraph.cpp')
| -rw-r--r-- | clang/lib/Analysis/ExplodedGraph.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/clang/lib/Analysis/ExplodedGraph.cpp b/clang/lib/Analysis/ExplodedGraph.cpp index 945416b1b56..4e41b60da37 100644 --- a/clang/lib/Analysis/ExplodedGraph.cpp +++ b/clang/lib/Analysis/ExplodedGraph.cpp @@ -120,36 +120,35 @@ ExplodedNodeImpl::NodeGroup::~NodeGroup() { if (getKind() == SizeOther) delete &getVector(getPtr()); } -ExplodedGraphImpl* ExplodedGraphImpl::Trim(ExplodedNodeImpl** BeginSources, - ExplodedNodeImpl** EndSources) const{ +ExplodedGraphImpl* +ExplodedGraphImpl::Trim(const ExplodedNodeImpl* const* BeginSources, + const ExplodedNodeImpl* const* EndSources) const{ - typedef llvm::DenseMap<ExplodedNodeImpl*, ExplodedNodeImpl*> Pass1Ty; - typedef llvm::DenseMap<ExplodedNodeImpl*, ExplodedNodeImpl*> Pass2Ty; + typedef llvm::DenseMap<const ExplodedNodeImpl*, const ExplodedNodeImpl*> Pass1Ty; + typedef llvm::DenseMap<const ExplodedNodeImpl*, ExplodedNodeImpl*> Pass2Ty; Pass1Ty Pass1; Pass2Ty Pass2; - llvm::SmallVector<ExplodedNodeImpl*, 10> WL2; + llvm::SmallVector<const ExplodedNodeImpl*, 10> WL2; { // ===- Pass 1 (reverse BFS) -=== // Enqueue the source nodes to the first worklist. - std::list<std::pair<ExplodedNodeImpl*, ExplodedNodeImpl*> > WL1; - std::list<std::pair<ExplodedNodeImpl*, ExplodedNodeImpl*> > WL1_Loops; + std::list<std::pair<const ExplodedNodeImpl*, + const ExplodedNodeImpl*> > WL1, WL1_Loops; - for (ExplodedNodeImpl** I = BeginSources; I != EndSources; ++I) + for (const ExplodedNodeImpl* const* I = BeginSources; I != EndSources; ++I) WL1.push_back(std::make_pair(*I, *I)); // Process the worklist. while (! (WL1.empty() && WL1_Loops.empty())) { - - ExplodedNodeImpl *N, *Src; - // Only dequeue from the "loops" worklist if WL1 has no items. // Thus we prioritize for paths that don't span loop boundaries. - + const ExplodedNodeImpl *N, *Src; + if (WL1.empty()) { N = WL1_Loops.back().first; Src = WL1_Loops.back().second; @@ -227,7 +226,7 @@ ExplodedGraphImpl* ExplodedGraphImpl::Trim(ExplodedNodeImpl** BeginSources, while (!WL2.empty()) { - ExplodedNodeImpl* N = WL2.back(); + const ExplodedNodeImpl* N = WL2.back(); WL2.pop_back(); // Skip this node if we have already processed it. |

