Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2015-02-17 01:51:57 -0500
committerAlena Laskavaia2015-02-18 19:08:59 -0500
commit3586267e6b0f97d0787aa143c0e6e2ab5b5e70be (patch)
tree065edb0b1ec35c727830da3f642b82bd76d13e52 /codan/org.eclipse.cdt.codan.core.test
parent340b507e381a07ecfa3152f1e2d935849c1ad9bc (diff)
downloadorg.eclipse.cdt-3586267e6b0f97d0787aa143c0e6e2ab5b5e70be.tar.gz
org.eclipse.cdt-3586267e6b0f97d0787aa143c0e6e2ab5b5e70be.tar.xz
org.eclipse.cdt-3586267e6b0f97d0787aa143c0e6e2ab5b5e70be.zip
Bug 455828 - Proper handling of 'break' inside compound statement in a
case of a switch Change-Id: I73329a8769bc20a4fc4e017faad627e03adce9d9 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/cfg/ControlFlowGraphTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/cfg/ControlFlowGraphTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/cfg/ControlFlowGraphTest.java
index 6a90952327..74c9ae466c 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/cfg/ControlFlowGraphTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/cfg/ControlFlowGraphTest.java
@@ -617,4 +617,25 @@ public class ControlFlowGraphTest extends CodanFastCxxAstTestCase {
IBranchNode trueBranch = (IBranchNode) graph.getUnconnectedNodeIterator().next();
assertEquals("return 1;", data(trueBranch.getOutgoing()));
}
+
+ // int main(int a) {
+ // switch (a) {
+ // case 1: {
+ // break;
+ // }
+ // case 2: {
+ // break;
+ // }
+ // }
+ // }
+ public void test_switch_break_in_compound_statement() {
+ // Test that the target node of the jump for the 'break' in a case
+ // is the connector node at the end of the switch, not the connector
+ // node for the next case.
+ buildAndCheck(getAboveComment());
+ IDecisionNode swittch = (IDecisionNode) graph.getStartNode().getOutgoing();
+ IPlainNode case1Branch = (IPlainNode) swittch.getOutgoingNodes()[0];
+ IJumpNode case1Jump = (IJumpNode) case1Branch.getOutgoing();
+ assertEquals(swittch.getMergeNode(), case1Jump.getJumpNode());
+ }
}

Back to the top