aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BugReporter.cpp7
-rw-r--r--lib/Analysis/GRCoreEngine.cpp20
-rw-r--r--lib/Analysis/GRExprEngine.cpp9
-rw-r--r--lib/Analysis/ProgramPoint.cpp64
4 files changed, 14 insertions, 86 deletions
diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp
index 7e3db7aba4..b163eea1b8 100644
--- a/lib/Analysis/BugReporter.cpp
+++ b/lib/Analysis/BugReporter.cpp
@@ -689,13 +689,10 @@ bool BugTypeCacheLocation::isCached(BugReport& R) {
}
bool BugTypeCacheLocation::isCached(ProgramPoint P) {
-
- void* p = P.getRawData();
-
- if (CachedErrors.count(p))
+ if (CachedErrors.count(P))
return true;
- CachedErrors.insert(p);
+ CachedErrors.insert(P);
return false;
}
diff --git a/lib/Analysis/GRCoreEngine.cpp b/lib/Analysis/GRCoreEngine.cpp
index a7e1458e7a..84a8d5522d 100644
--- a/lib/Analysis/GRCoreEngine.cpp
+++ b/lib/Analysis/GRCoreEngine.cpp
@@ -69,7 +69,7 @@ bool GRCoreEngineImpl::ExecuteWorkList(unsigned Steps) {
// Construct an edge representing the
// starting location in the function.
- BlockEdge StartLoc(getCFG(), Entry, Succ);
+ BlockEdge StartLoc(Entry, Succ);
// Set the current block counter to being empty.
WList->setBlockCounter(BCounterFactory.GetEmptyCounter());
@@ -230,7 +230,7 @@ void GRCoreEngineImpl::HandleBlockExit(CFGBlock * B, ExplodedNodeImpl* Pred) {
assert (B->succ_size() == 1 &&
"Blocks with no terminator should have at most 1 successor.");
- GenerateNode(BlockEdge(getCFG(),B,*(B->succ_begin())), Pred->State, Pred);
+ GenerateNode(BlockEdge(B, *(B->succ_begin())), Pred->State, Pred);
}
void GRCoreEngineImpl::HandleBranch(Expr* Cond, Stmt* Term, CFGBlock * B,
@@ -350,8 +350,7 @@ ExplodedNodeImpl* GRBranchNodeBuilderImpl::generateNodeImpl(const void* State,
bool IsNew;
ExplodedNodeImpl* Succ =
- Eng.G->getNodeImpl(BlockEdge(Eng.getCFG(), Src, branch ? DstT : DstF),
- State, &IsNew);
+ Eng.G->getNodeImpl(BlockEdge(Src, branch ? DstT : DstF), State, &IsNew);
Succ->addPredecessor(Pred);
@@ -382,8 +381,7 @@ GRIndirectGotoNodeBuilderImpl::generateNodeImpl(const Iterator& I,
bool IsNew;
ExplodedNodeImpl* Succ =
- Eng.G->getNodeImpl(BlockEdge(Eng.getCFG(), Src, I.getBlock(), true),
- St, &IsNew);
+ Eng.G->getNodeImpl(BlockEdge(Src, I.getBlock()), St, &IsNew);
Succ->addPredecessor(Pred);
@@ -407,9 +405,8 @@ GRSwitchNodeBuilderImpl::generateCaseStmtNodeImpl(const Iterator& I,
bool IsNew;
- ExplodedNodeImpl* Succ = Eng.G->getNodeImpl(BlockEdge(Eng.getCFG(), Src,
- I.getBlock()),
- St, &IsNew);
+ ExplodedNodeImpl* Succ = Eng.G->getNodeImpl(BlockEdge(Src, I.getBlock()),
+ St, &IsNew);
Succ->addPredecessor(Pred);
if (IsNew) {
@@ -431,9 +428,8 @@ GRSwitchNodeBuilderImpl::generateDefaultCaseNodeImpl(const void* St,
bool IsNew;
- ExplodedNodeImpl* Succ = Eng.G->getNodeImpl(BlockEdge(Eng.getCFG(), Src,
- DefaultBlock),
- St, &IsNew);
+ ExplodedNodeImpl* Succ = Eng.G->getNodeImpl(BlockEdge(Src, DefaultBlock),
+ St, &IsNew);
Succ->addPredecessor(Pred);
if (IsNew) {
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index d8c0320d66..aa5ab6af7f 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -2324,17 +2324,16 @@ template <typename ITERATOR>
static void AddSources(std::vector<GRExprEngine::NodeTy*>& Sources,
ITERATOR I, ITERATOR E) {
- llvm::SmallPtrSet<void*,10> CachedSources;
+ llvm::SmallSet<ProgramPoint,10> CachedSources;
for ( ; I != E; ++I ) {
GRExprEngine::NodeTy* N = GetGraphNode(I);
- void* p = N->getLocation().getRawData();
+ ProgramPoint P = N->getLocation();
- if (CachedSources.count(p))
+ if (CachedSources.count(P))
continue;
- CachedSources.insert(p);
-
+ CachedSources.insert(P);
Sources.push_back(N);
}
}
diff --git a/lib/Analysis/ProgramPoint.cpp b/lib/Analysis/ProgramPoint.cpp
deleted file mode 100644
index d95680ff38..0000000000
--- a/lib/Analysis/ProgramPoint.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//= ProgramPoint.cpp - Program Points for Path-Sensitive Analysis --*- C++ -*-//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements methods for subclasses of ProgramPoint.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/AST/CFG.h"
-#include "clang/Analysis/ProgramPoint.h"
-
-using namespace clang;
-
-BlockEdge::BlockEdge(CFG& cfg, const CFGBlock* B1, const CFGBlock* B2) {
- if (B1->succ_size() == 1) {
- assert (*(B1->succ_begin()) == B2);
- setRawData(B1, BlockEdgeSrcKind);
- }
- else if (B2->pred_size() == 1) {
- assert (*(B2->pred_begin()) == B1);
- setRawData(B2, BlockEdgeDstKind);
- }
- else
- setRawData(cfg.getBlockEdgeImpl(B1,B2), BlockEdgeAuxKind);
-}
-
-CFGBlock* BlockEdge::getSrc() const {
- switch (getKind()) {
- default:
- assert (false && "Invalid BlockEdgeKind.");
- return NULL;
-
- case BlockEdgeSrcKind:
- return reinterpret_cast<CFGBlock*>(getRawPtr());
-
- case BlockEdgeDstKind:
- return *(reinterpret_cast<CFGBlock*>(getRawPtr())->pred_begin());
-
- case BlockEdgeAuxKind:
- return reinterpret_cast<BPair*>(getRawPtr())->first;
- }
-}
-
-CFGBlock* BlockEdge::getDst() const {
- switch (getKind()) {
- default:
- assert (false && "Invalid BlockEdgeKind.");
- return NULL;
-
- case BlockEdgeSrcKind:
- return *(reinterpret_cast<CFGBlock*>(getRawPtr())->succ_begin());
-
- case BlockEdgeDstKind:
- return reinterpret_cast<CFGBlock*>(getRawPtr());
-
- case BlockEdgeAuxKind:
- return reinterpret_cast<BPair*>(getRawPtr())->second;
- }
-}