[lieveness] Fix false positive to do with a _Generic expression not being translated properly

Reviewed By: sblackshear

Differential Revision: D7169156

fbshipit-source-id: ab79bf9
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent 09ae1f96fc
commit be53bc80e2

@ -1 +1 @@
Subproject commit 5f64a6842e9a85fc222f9a436c3d993cacb891b3 Subproject commit 9d03cb460a30ad02d7b5edfa38f3a1143e642cfe

@ -93,6 +93,8 @@ let infer_skip_fun = "__infer_skip_function"
let infer_skip_gcc_asm_stmt = "__infer_skip_gcc_asm_stmt" let infer_skip_gcc_asm_stmt = "__infer_skip_gcc_asm_stmt"
let infer_generic_selection_expr = "__infer_generic_selection_expr"
let init = "init" let init = "init"
let is_kind_of_class = "isKindOfClass:" let is_kind_of_class = "isKindOfClass:"

@ -88,6 +88,8 @@ val infer_skip_fun : string
val infer_skip_gcc_asm_stmt : string val infer_skip_gcc_asm_stmt : string
val infer_generic_selection_expr : string
val init : string val init : string
val is_kind_of_class : string val is_kind_of_class : string

@ -2943,6 +2943,11 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
call_function_with_args "GCCAsmStmt" pname trans_state call_function_with_args "GCCAsmStmt" pname trans_state
and genericSelectionExprUnknown_trans trans_state =
let pname = Typ.Procname.from_string_c_fun CFrontend_config.infer_generic_selection_expr in
call_function_with_args "GenericSelectionExpr" pname trans_state
and objc_cxx_throw_trans trans_state = and objc_cxx_throw_trans trans_state =
call_function_with_args "ObjCCPPThrow" BuiltinDecl.objc_cpp_throw trans_state call_function_with_args "ObjCCPPThrow" BuiltinDecl.objc_cpp_throw trans_state
@ -3272,8 +3277,12 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
cxxDefaultExpr_trans trans_state default_expr_info cxxDefaultExpr_trans trans_state default_expr_info
| ImplicitValueInitExpr (stmt_info, _, _) -> | ImplicitValueInitExpr (stmt_info, _, _) ->
implicitValueInitExpr_trans trans_state stmt_info implicitValueInitExpr_trans trans_state stmt_info
| GenericSelectionExpr _ | GenericSelectionExpr (stmt_info, stmts, _, gse_info) -> (
(* to be fixed when we dump the right info in the ast *) match gse_info.gse_value with
| Some value ->
instruction trans_state value
| None ->
genericSelectionExprUnknown_trans trans_state stmt_info stmts )
| SizeOfPackExpr _ -> | SizeOfPackExpr _ ->
{empty_res_trans with exps= [(Exp.get_undefined false, Typ.mk Tvoid)]} {empty_res_trans with exps= [(Exp.get_undefined false, Typ.mk Tvoid)]}
| GCCAsmStmt (stmt_info, stmts) -> | GCCAsmStmt (stmt_info, stmts) ->

@ -7,11 +7,11 @@ digraph cfg {
"test_typename.b2359812ef4a83b4e2638a11e6c522b3_2" [label="2: Exit test_typename \n " color=yellow style=filled] "test_typename.b2359812ef4a83b4e2638a11e6c522b3_2" [label="2: Exit test_typename \n " color=yellow style=filled]
"test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" [label="3: DeclStmt \n *&z:void=_t$0 [line 16, column 3]\n " shape="box"] "test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" [label="3: DeclStmt \n *&z:int=3 [line 16, column 3]\n " shape="box"]
"test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" -> "test_typename.b2359812ef4a83b4e2638a11e6c522b3_2" ; "test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" -> "test_typename.b2359812ef4a83b4e2638a11e6c522b3_2" ;
"test_typename.b2359812ef4a83b4e2638a11e6c522b3_4" [label="4: DeclStmt \n *&x:void=_t$1 [line 15, column 3]\n " shape="box"] "test_typename.b2359812ef4a83b4e2638a11e6c522b3_4" [label="4: DeclStmt \n *&x:int=2 [line 15, column 3]\n " shape="box"]
"test_typename.b2359812ef4a83b4e2638a11e6c522b3_4" -> "test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" ; "test_typename.b2359812ef4a83b4e2638a11e6c522b3_4" -> "test_typename.b2359812ef4a83b4e2638a11e6c522b3_3" ;

@ -0,0 +1,14 @@
/*
* Copyright (c) 2018 - 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.
*/
#import <Foundation/Foundation.h>
static float generic_expr_ok() {
NSString* currentValue = [NSString new];
return _Generic(0.2f, float : [currentValue floatValue]);
};
Loading…
Cancel
Save