aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-06-29 14:24:16 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-06-30 15:11:05 +0200
commita18add1613574a15c81f60bde847c5d7b2bedcb5 (patch)
tree103fa812c66403f5e8caefb898ea3f18107865dc /third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java
parent14c7964b8bc0da2bab65b1c28aa8c302846d7720 (diff)
Adds the source of the checker framework
This needs to predate the rest of the changes to the checker framework to keep the build green. Also add the source of javacutil part of the checker framework, that will be included in the next change. Change-Id: Ie18d0e8e21035ce5141416e552a83d893f71b88b
Diffstat (limited to 'third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java')
-rw-r--r--third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java b/third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java
new file mode 100644
index 0000000000..15c3842bad
--- /dev/null
+++ b/third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/cfg/block/ConditionalBlockImpl.java
@@ -0,0 +1,87 @@
+package org.checkerframework.dataflow.cfg.block;
+
+import org.checkerframework.dataflow.analysis.Store;
+
+/**
+ * Implementation of a conditional basic block.
+ *
+ * @author Stefan Heule
+ *
+ */
+public class ConditionalBlockImpl extends BlockImpl implements ConditionalBlock {
+
+ /** Successor of the then branch. */
+ protected BlockImpl thenSuccessor;
+
+ /** Successor of the else branch. */
+ protected BlockImpl elseSuccessor;
+
+ /**
+ * The rules below say that the THEN store before a conditional
+ * block flows to BOTH of the stores of the then successor, while
+ * the ELSE store before a conditional block flows to BOTH of the
+ * stores of the else successor.
+ */
+ protected Store.FlowRule thenFlowRule = Store.FlowRule.THEN_TO_BOTH;
+
+ protected Store.FlowRule elseFlowRule = Store.FlowRule.ELSE_TO_BOTH;
+
+ /**
+ * Initialize an empty conditional basic block to be filled with contents
+ * and linked to other basic blocks later.
+ */
+ public ConditionalBlockImpl() {
+ type = BlockType.CONDITIONAL_BLOCK;
+ }
+
+ /**
+ * Set the then branch successor.
+ */
+ public void setThenSuccessor(BlockImpl b) {
+ thenSuccessor = b;
+ b.addPredecessor(this);
+ }
+
+ /**
+ * Set the else branch successor.
+ */
+ public void setElseSuccessor(BlockImpl b) {
+ elseSuccessor = b;
+ b.addPredecessor(this);
+ }
+
+ @Override
+ public Block getThenSuccessor() {
+ return thenSuccessor;
+ }
+
+ @Override
+ public Block getElseSuccessor() {
+ return elseSuccessor;
+ }
+
+ @Override
+ public Store.FlowRule getThenFlowRule() {
+ return thenFlowRule;
+ }
+
+ @Override
+ public Store.FlowRule getElseFlowRule() {
+ return elseFlowRule;
+ }
+
+ @Override
+ public void setThenFlowRule(Store.FlowRule rule) {
+ thenFlowRule = rule;
+ }
+
+ @Override
+ public void setElseFlowRule(Store.FlowRule rule) {
+ elseFlowRule = rule;
+ }
+
+ @Override
+ public String toString() {
+ return "ConditionalBlock()";
+ }
+}