Translate TypeTraitExpr

Reviewed By: akotulski

Differential Revision: D3476378

fbshipit-source-id: 721f535
master
Dulma Churchill 9 years ago committed by Facebook Github Bot 1
parent 95a12d9706
commit 8bfa983716

@ -1 +1 @@
Subproject commit 3267da67afe81c99394f22226bad294922de0875 Subproject commit 1b6e6183affe497bcbe3cb6c37c3065d4ecbb91e

@ -75,6 +75,8 @@ let fst3 (x,_,_) = x
let snd3 (_,x,_) = x let snd3 (_,x,_) = x
let trd3 (_,_,x) = x let trd3 (_,_,x) = x
let int_of_bool b = if b then 1 else 0
(** {2 Useful Modules} *) (** {2 Useful Modules} *)
(** Set of integers *) (** Set of integers *)

@ -71,6 +71,9 @@ val snd3 : 'a * 'b * 'c -> 'b
(** Return the third component of a triple. *) (** Return the third component of a triple. *)
val trd3 : 'a * 'b * 'c -> 'c val trd3 : 'a * 'b * 'c -> 'c
(** Convert a bool into an int *)
val int_of_bool : bool -> int
(** {2 Useful Modules} *) (** {2 Useful Modules} *)
(** Set of integers *) (** Set of integers *)

@ -2585,6 +2585,10 @@ struct
| AttributedStmt (_, stmts, attrs) -> | AttributedStmt (_, stmts, attrs) ->
attributedStmt_trans trans_state stmts attrs attributedStmt_trans trans_state stmts attrs
| TypeTraitExpr (_, _, expr_info, type_trait_info) ->
let b = type_trait_info.Clang_ast_t.xtti_value in
characterLiteral_trans trans_state expr_info (Utils.int_of_bool b)
| s -> (Printing.log_stats | s -> (Printing.log_stats
"\n!!!!WARNING: found statement %s. \nACTION REQUIRED: \ "\n!!!!WARNING: found statement %s. \nACTION REQUIRED: \
Translation need to be defined. Statement ignored.... \n" Translation need to be defined. Statement ignored.... \n"

@ -0,0 +1,12 @@
/*
* 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.
*/
int is_trivial_example() { return __is_trivial(int); }
int is_pointer_example() { return __is_pointer(int); }

@ -0,0 +1,25 @@
/* @generated */
digraph iCFG {
6 [label="6: Return Stmt \n *&return:int =0 [line 12]\n " shape="box"]
6 -> 5 ;
5 [label="5: Exit is_pointer_example \n " color=yellow style=filled]
4 [label="4: Start is_pointer_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled]
4 -> 6 ;
3 [label="3: Return Stmt \n *&return:int =1 [line 10]\n " shape="box"]
3 -> 2 ;
2 [label="2: Exit is_trivial_example \n " color=yellow style=filled]
1 [label="1: Start is_trivial_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 10]\n " color=yellow style=filled]
1 -> 3 ;
}

@ -40,4 +40,10 @@ public class TypesTest {
throws InterruptedException, IOException, InferException { throws InterruptedException, IOException, InferException {
frontendTest("struct_pass_by_value.cpp"); frontendTest("struct_pass_by_value.cpp");
} }
@Test
public void typeTraitExprDotFilesMatch()
throws InterruptedException, IOException, InferException {
frontendTest("type_trait_expr.cpp");
}
} }

Loading…
Cancel
Save