Translate SizeOfPackExpr

Reviewed By: akotulski

Differential Revision: D3018506

fb-gh-sync-id: 11eca37
shipit-source-id: 11eca37
master
Dulma Rodriguez 9 years ago committed by Facebook Github Bot 6
parent ddfd35107c
commit edbd7854b2

@ -2272,7 +2272,8 @@ struct
| ImplicitValueInitExpr (_, _, expr_info) ->
implicitValueInitExpr_trans trans_state expr_info
| GenericSelectionExpr _ -> (* to be fixed when we dump the right info in the ast *)
| GenericSelectionExpr _ (* to be fixed when we dump the right info in the ast *)
| SizeOfPackExpr _ ->
{ empty_res_trans with exps = [(Sil.exp_get_undefined false, Sil.Tvoid)] }
| GCCAsmStmt (stmt_info, stmts) ->

@ -0,0 +1,23 @@
/*
* 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.
*/
struct MyHasher {
static int hash(int t) { return 1; }
};
template <class Hasher, typename T, typename... Ts>
int hash_combine_generic(const T& t, const Ts&... ts) {
int seed = Hasher::hash(t);
if (sizeof...(ts) == 0) {
return seed;
}
return 0;
}
int test = hash_combine_generic<MyHasher>(0, 0, 0);

@ -0,0 +1,45 @@
digraph iCFG {
11 [label="11: DeclStmt \n n$1=*&t:int & [line 16]\n n$2=*n$1:int [line 16]\n n$3=_fun_MyHasher_hash(n$2:int ) [line 16]\n *&seed:int =n$3 [line 16]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 16]\n NULLIFY(&t,false); [line 16]\n " shape="box"]
11 -> 8 ;
11 -> 9 ;
10 [label="10: Return Stmt \n n$0=*&seed:int [line 18]\n *&return:int =n$0 [line 18]\n REMOVE_TEMPS(n$0); [line 18]\n NULLIFY(&seed,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"]
10 -> 5 ;
9 [label="9: Prune (false branch) \n PRUNE(((_t$0 == 0) == 0), false); [line 17]\n " shape="invhouse"]
9 -> 7 ;
8 [label="8: Prune (true branch) \n PRUNE(((_t$0 == 0) != 0), true); [line 17]\n " shape="invhouse"]
8 -> 10 ;
7 [label="7: + \n " ]
7 -> 6 ;
6 [label="6: Return Stmt \n NULLIFY(&seed,false); [line 20]\n *&return:int =0 [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"]
6 -> 5 ;
5 [label="5: Exit hash_combine_generic<MyHasher, int, int, int> \n " color=yellow style=filled]
4 [label="4: Start hash_combine_generic<MyHasher, int, int, int>\nFormals: t:int & ts:int & ts:int &\nLocals: seed:int \n DECLARE_LOCALS(&return,&seed); [line 15]\n NULLIFY(&seed,false); [line 15]\n NULLIFY(&ts,false); [line 15]\n " color=yellow style=filled]
4 -> 11 ;
3 [label="3: Return Stmt \n *&return:int =1 [line 11]\n APPLY_ABSTRACTION; [line 11]\n " shape="box"]
3 -> 2 ;
2 [label="2: Exit MyHasher_hash \n " color=yellow style=filled]
1 [label="1: Start MyHasher_hash\nFormals: t:int \nLocals: \n DECLARE_LOCALS(&return); [line 11]\n NULLIFY(&t,false); [line 11]\n " color=yellow style=filled]
1 -> 3 ;
}

@ -52,4 +52,10 @@ public class TemplatesTest {
throws InterruptedException, IOException, InferException {
frontendTest("method.cpp");
}
@Test
public void testSizeofPackDotFilesMatch()
throws InterruptedException, IOException, InferException {
frontendTest("sizeof_pack.cpp");
}
}

Loading…
Cancel
Save