Translate GenericSelectionExpr

Reviewed By: ddino

Differential Revision: D3005671

fb-gh-sync-id: aa5d942
shipit-source-id: aa5d942
master
Dulma Rodriguez 9 years ago committed by Facebook Github Bot 8
parent ef3e516f6f
commit 6c567f1104

@ -2253,6 +2253,8 @@ struct
| ImplicitValueInitExpr (_, _, expr_info) ->
implicitValueInitExpr_trans trans_state expr_info
| GenericSelectionExpr _ -> (* to be fixed when we dump the right info in the ast *)
{ empty_res_trans with exps = [(Sil.exp_get_undefined false, Sil.Tvoid)] }
| s -> (Printing.log_stats
"\n!!!!WARNING: found statement %s. \nACTION REQUIRED: Translation need to be defined. Statement ignored.... \n"

@ -0,0 +1,16 @@
/*
* Copyright (c) 2016 - 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.
*/
#define test(x) _Generic((x), _Bool : 1, char : 2, int : 3, default : 4)
int test_typename(void) {
char s;
int y;
int x = test(s);
int z = test(y);

@ -0,0 +1,17 @@
digraph iCFG {
4 [label="4: DeclStmt \n *&x:void =_t$1 [line 15]\n NULLIFY(&x,false); [line 15]\n " shape="box"]
4 -> 3 ;
3 [label="3: DeclStmt \n *&z:void =_t$0 [line 16]\n NULLIFY(&z,false); [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
3 -> 2 ;
2 [label="2: Exit test_typename \n " color=yellow style=filled]
1 [label="1: Start test_typename\nFormals: \nLocals: z:int x:int y:int s:char \n DECLARE_LOCALS(&return,&z,&x,&y,&s); [line 12]\n NULLIFY(&s,false); [line 12]\n NULLIFY(&x,false); [line 12]\n NULLIFY(&y,false); [line 12]\n NULLIFY(&z,false); [line 12]\n " color=yellow style=filled]
1 -> 4 ;
}

@ -0,0 +1,32 @@
/*
* Copyright (c) 2013 - 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.
*/
package frontend.c;
import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
import utils.DebuggableTemporaryFolder;
import utils.InferException;
import utils.ClangFrontendUtils;
public class UnusualExprTest {
@Rule
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
@Test
public void whenCaptureRunEnumThenDotFilesAreTheSame()
throws InterruptedException, IOException, InferException {
String src = "infer/tests/codetoanalyze/c/frontend/unusual_exps/generic_exp.c";
ClangFrontendUtils.createAndCompareCDotFiles(folder, src);
}
}
Loading…
Cancel
Save