summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ProgramPoint.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-15 23:59:48 +0000
committerChris Lattner <sabre@nondot.org>2008-03-15 23:59:48 +0000
commit7a51313d8a0a358bb92eb5dbf8fd846b7c48e7fe (patch)
treef34d8e560a6abbae809b7dbee85606becf47dfd0 /clang/lib/Analysis/ProgramPoint.cpp
parentd3f989ccd302d53e327c030347313fbd8d23a344 (diff)
downloadbcm5719-llvm-7a51313d8a0a358bb92eb5dbf8fd846b7c48e7fe.tar.gz
bcm5719-llvm-7a51313d8a0a358bb92eb5dbf8fd846b7c48e7fe.zip
Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
Diffstat (limited to 'clang/lib/Analysis/ProgramPoint.cpp')
-rw-r--r--clang/lib/Analysis/ProgramPoint.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/clang/lib/Analysis/ProgramPoint.cpp b/clang/lib/Analysis/ProgramPoint.cpp
new file mode 100644
index 00000000000..c089e486988
--- /dev/null
+++ b/clang/lib/Analysis/ProgramPoint.cpp
@@ -0,0 +1,65 @@
+//= 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);
+ Data = reinterpret_cast<uintptr_t>(B1) | BlockEdgeSrcKind;
+ }
+ else if (B2->pred_size() == 1) {
+ assert (*(B2->pred_begin()) == B1);
+ Data = reinterpret_cast<uintptr_t>(B2) | BlockEdgeDstKind;
+ }
+ else
+ Data = reinterpret_cast<uintptr_t>(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;
+ }
+}
OpenPOWER on IntegriCloud