Ignore type change in DerivedToBase cast

Summary:
public
Backend needs to know whether parameter has Derived* type - otherwise subtyping in backend doesn't work. Skipping `DerivedToBase` does that

Reviewed By: dulmarod

Differential Revision: D2890673

fb-gh-sync-id: a79abbc
master
Andrzej Kotulski 9 years ago committed by facebook-github-bot-5
parent b08acedf29
commit 75f4947cb1

@ -398,7 +398,7 @@ let dereference_value_from_result sil_loc trans_result ~strip_pointer =
let cast_operation context cast_kind exps cast_typ sil_loc is_objc_bridged =
let (exp, typ) = extract_exp_from_list exps "" in
let exp_typ = match cast_kind with
| `UncheckedDerivedToBase -> typ (* This cast ignores change of type *)
| `UncheckedDerivedToBase | `DerivedToBase -> typ (* These casts ignore change of type *)
| _ -> cast_typ (* by default use the return type of cast expr *) in
if is_objc_bridged then
let id, instr, exp = create_cast_instrs context exp typ cast_typ sil_loc in

@ -3,7 +3,7 @@ digraph iCFG {
24 -> 23 ;
23 [label="23: DeclStmt \n n$13=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Base *=n$13 [line 23]\n REMOVE_TEMPS(n$13); [line 23]\n " shape="box"]
23 [label="23: DeclStmt \n n$13=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Sub *=n$13 [line 23]\n REMOVE_TEMPS(n$13); [line 23]\n " shape="box"]
23 -> 22 ;

@ -3,7 +3,7 @@ digraph iCFG {
41 -> 40 ;
40 [label="40: DeclStmt \n n$2=*&s:class Sub * [line 68]\n *&b:struct Base1 *=n$2 [line 68]\n REMOVE_TEMPS(n$2); [line 68]\n NULLIFY(&s,false); [line 68]\n " shape="box"]
40 [label="40: DeclStmt \n n$2=*&s:class Sub * [line 68]\n *&b:class Sub *=n$2 [line 68]\n REMOVE_TEMPS(n$2); [line 68]\n NULLIFY(&s,false); [line 68]\n " shape="box"]
40 -> 39 ;
@ -75,7 +75,7 @@ digraph iCFG {
22 -> 21 ;
21 [label="21: DeclStmt \n *&b:struct Base1 &=&s [line 45]\n " shape="box"]
21 [label="21: DeclStmt \n *&b:class Sub &=&s [line 45]\n " shape="box"]
21 -> 20 ;
@ -94,7 +94,7 @@ digraph iCFG {
17 -> 16 ;
16 [label="16: DeclStmt \n n$2=*&s:class Sub * [line 39]\n *&b:struct Base1 *=n$2 [line 39]\n REMOVE_TEMPS(n$2); [line 39]\n NULLIFY(&s,false); [line 39]\n " shape="box"]
16 [label="16: DeclStmt \n n$2=*&s:class Sub * [line 39]\n *&b:class Sub *=n$2 [line 39]\n REMOVE_TEMPS(n$2); [line 39]\n NULLIFY(&s,false); [line 39]\n " shape="box"]
16 -> 15 ;

Loading…
Cancel
Save