summaryrefslogtreecommitdiffstats
path: root/include/clang/Analysis/PathSensitive/GRWorkList.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /include/clang/Analysis/PathSensitive/GRWorkList.h
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'include/clang/Analysis/PathSensitive/GRWorkList.h')
-rw-r--r--include/clang/Analysis/PathSensitive/GRWorkList.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRWorkList.h b/include/clang/Analysis/PathSensitive/GRWorkList.h
new file mode 100644
index 0000000..c765322
--- /dev/null
+++ b/include/clang/Analysis/PathSensitive/GRWorkList.h
@@ -0,0 +1,76 @@
+//==- GRWorkList.h - Worklist class used by GRCoreEngine -----------*- C++ -*-//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines GRWorkList, a pure virtual class that represents an opaque
+// worklist used by GRCoreEngine to explore the reachability state space.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_ANALYSIS_GRWORKLIST
+#define LLVM_CLANG_ANALYSIS_GRWORKLIST
+
+#include "clang/Analysis/PathSensitive/GRBlockCounter.h"
+
+namespace clang {
+
+class ExplodedNodeImpl;
+
+class GRWorkListUnit {
+ ExplodedNodeImpl* Node;
+ GRBlockCounter Counter;
+ CFGBlock* Block;
+ unsigned BlockIdx;
+
+public:
+ GRWorkListUnit(ExplodedNodeImpl* N, GRBlockCounter C,
+ CFGBlock* B, unsigned idx)
+ : Node(N),
+ Counter(C),
+ Block(B),
+ BlockIdx(idx) {}
+
+ explicit GRWorkListUnit(ExplodedNodeImpl* N, GRBlockCounter C)
+ : Node(N),
+ Counter(C),
+ Block(NULL),
+ BlockIdx(0) {}
+
+ ExplodedNodeImpl* getNode() const { return Node; }
+ GRBlockCounter getBlockCounter() const { return Counter; }
+ CFGBlock* getBlock() const { return Block; }
+ unsigned getIndex() const { return BlockIdx; }
+};
+
+class GRWorkList {
+ GRBlockCounter CurrentCounter;
+public:
+ virtual ~GRWorkList();
+ virtual bool hasWork() const = 0;
+
+ virtual void Enqueue(const GRWorkListUnit& U) = 0;
+
+ void Enqueue(ExplodedNodeImpl* N, CFGBlock& B, unsigned idx) {
+ Enqueue(GRWorkListUnit(N, CurrentCounter, &B, idx));
+ }
+
+ void Enqueue(ExplodedNodeImpl* N) {
+ Enqueue(GRWorkListUnit(N, CurrentCounter));
+ }
+
+ virtual GRWorkListUnit Dequeue() = 0;
+
+ void setBlockCounter(GRBlockCounter C) { CurrentCounter = C; }
+ GRBlockCounter getBlockCounter() const { return CurrentCounter; }
+
+ static GRWorkList *MakeDFS();
+ static GRWorkList *MakeBFS();
+ static GRWorkList *MakeBFSBlockDFSContents();
+};
+} // end clang namespace
+#endif
OpenPOWER on IntegriCloud