Summary: public Add support for decl statements inside condition of switch statement Reviewed By: ddino Differential Revision: D2734213 fb-gh-sync-id: d60021dmaster
parent
a8d5f4241d
commit
84549f691d
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int get(int a) {
|
||||||
|
switch (int x = a) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
return 0;
|
||||||
|
case 2:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
digraph iCFG {
|
||||||
|
14 [label="14: Prune (false branch) \n PRUNE(((n$0 == 0) == 0), false); [line 12]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
14 -> 11 ;
|
||||||
|
14 -> 12 ;
|
||||||
|
13 [label="13: Prune (true branch) \n PRUNE(((n$0 == 0) != 0), true); [line 12]\n APPLY_ABSTRACTION; [line 12]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
13 -> 10 ;
|
||||||
|
12 [label="12: Prune (false branch) \n PRUNE(((n$0 == 1) == 0), false); [line 13]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
12 -> 8 ;
|
||||||
|
12 -> 9 ;
|
||||||
|
11 [label="11: Prune (true branch) \n PRUNE(((n$0 == 1) != 0), true); [line 13]\n APPLY_ABSTRACTION; [line 13]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
11 -> 10 ;
|
||||||
|
10 [label="10: Return Stmt \n NULLIFY(&x,false); [line 14]\n *&return:int =0 [line 14]\n APPLY_ABSTRACTION; [line 14]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
10 -> 2 ;
|
||||||
|
9 [label="9: Prune (false branch) \n PRUNE(((n$0 == 2) == 0), false); [line 15]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
9 -> 5 ;
|
||||||
|
8 [label="8: Prune (true branch) \n PRUNE(((n$0 == 2) != 0), true); [line 15]\n " shape="invhouse"]
|
||||||
|
|
||||||
|
|
||||||
|
8 -> 7 ;
|
||||||
|
7 [label="7: Return Stmt \n NULLIFY(&x,false); [line 16]\n *&return:int =1 [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
7 -> 2 ;
|
||||||
|
6 [label="6: Return Stmt \n n$2=*&x:int [line 18]\n *&return:int =n$2 [line 18]\n REMOVE_TEMPS(n$2); [line 18]\n NULLIFY(&x,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
6 -> 2 ;
|
||||||
|
5 [label="5: DefaultStmt_placeholder \n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
5 -> 6 ;
|
||||||
|
4 [label="4: DeclStmt \n n$1=*&a:int [line 11]\n *&x:int =n$1 [line 11]\n REMOVE_TEMPS(n$1); [line 11]\n NULLIFY(&a,false); [line 11]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
4 -> 3 ;
|
||||||
|
3 [label="3: Switch_stmt \n n$0=*&x:int [line 11]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
3 -> 13 ;
|
||||||
|
3 -> 14 ;
|
||||||
|
2 [label="2: Exit get \n REMOVE_TEMPS(n$0); [line 20]\n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
1 [label="1: Start get\nFormals: a:int \nLocals: x:int \n DECLARE_LOCALS(&return,&x); [line 10]\n NULLIFY(&x,false); [line 10]\n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
1 -> 4 ;
|
||||||
|
}
|
Loading…
Reference in new issue