From f08ac278ed1ac4c00cb28434b0a22b48b75ddb2c Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 24 Jan 2009 00:55:43 +0000 Subject: 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 --- clang/lib/Analysis/ExplodedGraph.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'clang/lib/Analysis/ExplodedGraph.cpp') 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 Pass1Ty; - typedef llvm::DenseMap Pass2Ty; + typedef llvm::DenseMap Pass1Ty; + typedef llvm::DenseMap Pass2Ty; Pass1Ty Pass1; Pass2Ty Pass2; - llvm::SmallVector WL2; + llvm::SmallVector WL2; { // ===- Pass 1 (reverse BFS) -=== // Enqueue the source nodes to the first worklist. - std::list > WL1; - std::list > WL1_Loops; + std::list > 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. -- cgit v1.2.3