Renamed ProgramEdge to ProgramPoint and changed subclasses of ProgramEdge
to have a much simpler, cleaner interpretation of what is a "location"
in a function (as encoded by a CFG).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45846 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/CFG.cpp b/AST/CFG.cpp
index 3be5f7c..befd840 100644
--- a/AST/CFG.cpp
+++ b/AST/CFG.cpp
@@ -21,10 +21,12 @@
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/Compiler.h"
+#include <set>
#include <iomanip>
#include <algorithm>
#include <sstream>
+
using namespace clang;
namespace {
@@ -1030,8 +1032,21 @@
}
}
+typedef std::set<std::pair<CFGBlock*,CFGBlock*> > BlkEdgeSetTy;
+
+const std::pair<CFGBlock*,CFGBlock*>*
+CFG::getBlockEdgeImpl(const CFGBlock* B1, const CFGBlock* B2) {
+
+ BlkEdgeSetTy*& p = reinterpret_cast<BlkEdgeSetTy*&>(BlkEdgeSet);
+ if (!p) p = new BlkEdgeSetTy();
+
+ return &*(p->insert(std::make_pair(const_cast<CFGBlock*>(B1),
+ const_cast<CFGBlock*>(B2))).first);
+}
+
CFG::~CFG() {
delete reinterpret_cast<const BlkExprMapTy*>(BlkExprMap);
+ delete reinterpret_cast<BlkEdgeSetTy*>(BlkEdgeSet);
}
//===----------------------------------------------------------------------===//