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 | 3148eb4a75f70f2636075c364d03104223f004d3 (patch) | |
tree | 5b7f56dc02c2201a7fed6502e57845b1bfec6a04 /lib/Analysis/ExplodedGraph.cpp | |
parent | aa23b570b059e8d29c69a656bbdc42f652f7c308 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ExplodedGraph.cpp')
-rw-r--r-- | lib/Analysis/ExplodedGraph.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/Analysis/ExplodedGraph.cpp b/lib/Analysis/ExplodedGraph.cpp index 945416b1b5..4e41b60da3 100644 --- a/lib/Analysis/ExplodedGraph.cpp +++ b/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. |