[clang frontent] Fix translation of binary operator

Reviewed By: dulmarod, jvillard

Differential Revision: D8588689

fbshipit-source-id: ef04877
master
Daiva Naudziuniene 7 years ago committed by Facebook Github Bot
parent a8e84d1657
commit 1e2e9b6d11

@ -940,7 +940,14 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
(* translating the operands. *)
let res_trans_e1 = instruction trans_state' s1 in
let (exp1, typ1) as exp_typ1 = res_trans_e1.return in
let trans_state'' = {trans_state' with var_exp_typ= Some exp_typ1} in
let var_exp_typ =
match binary_operator_info.Clang_ast_t.boi_kind with
| `Assign ->
Some exp_typ1
| _ ->
None
in
let trans_state'' = {trans_state' with var_exp_typ} in
let res_trans_e2 =
(* translation of s2 is done taking care of block special case *)
exec_with_block_priority_exception instruction trans_state'' s2 stmt_info

@ -47,4 +47,7 @@ void list_init() {
Y& yref = y;
Y ty[3] = {{1, {2, nullptr}}, y, yref};
}
void init_in_binop(int x) { x = -x & ~int{0}; }
} // namespace init_list

@ -1,5 +1,16 @@
/* @generated */
digraph cfg {
"init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_1" [label="1: Start init_list::init_in_binop\nFormals: x:int\nLocals: 0$?%__sil_tmpSIL_init_list__n$2:int \n DECLARE_LOCALS(&return,&0$?%__sil_tmpSIL_init_list__n$2); [line 51, column 1]\n " color=yellow style=filled]
"init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_1" -> "init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_3" ;
"init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_2" [label="2: Exit init_list::init_in_binop \n " color=yellow style=filled]
"init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_3" [label="3: BinaryOperatorStmt: Assign \n n$1=*&x:int [line 51, column 34]\n *&0$?%__sil_tmpSIL_init_list__n$2:int=0 [line 51, column 42]\n *&x:int=(-n$1 & ~&0$?%__sil_tmpSIL_init_list__n$2) [line 51, column 29]\n " shape="box"]
"init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_3" -> "init_in_binop#init_list#8348250075128359911.7adaa67964536570064366a92056cf46_2" ;
"list_init#init_list#18348854466346904105.0126b9f1f80f91b73d5fbdbf2bc60754_1" [label="1: Start init_list::list_init\nFormals: \nLocals: ty:init_list::Y[3*24] yref:init_list::Y& y:init_list::Y ti:int[4*4] \n DECLARE_LOCALS(&return,&ty,&yref,&y,&ti); [line 44, column 1]\n " color=yellow style=filled]

@ -476,4 +476,6 @@ class Exceptions {
}
};
void init_in_binop_bad(int x) { x = -x & ~int{0}; }
} // namespace dead_stores

@ -10,6 +10,7 @@ codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::dead_then_live_bad, 1,
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::easy_bad, 0, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::init_capture_no_call_bad, 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::init_capture_reassign_bad, 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::init_in_binop_bad, 0, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::lambda_bad::lambda_dead_stores.cpp:145:11_operator(), 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::plus_plus1_bad, 2, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::plus_plus2_bad, 2, DEAD_STORE, no_bucket, ERROR, [Write of unused value]

Loading…
Cancel
Save