Summary: public This expression is used to value-initialize non-class types. Per definition of value initialization for non-class types: 1. If it's an array, value-initialize each of its elements 2. Otherwise, zero-initialize it http://en.cppreference.com/w/cpp/language/value_initialization I was unable to reproduce (1) in a way that produced CXXScalarValueInitExpr and so this diff deals with case (2) Reviewed By: jvillard Differential Revision: D2901311 fb-gh-sync-id: beeafa2master
parent
359ad9dd4b
commit
49d7bdb6bd
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum ENUM {
|
||||
val1,
|
||||
val2
|
||||
};
|
||||
|
||||
template<class T> T get() {
|
||||
return T();
|
||||
}
|
||||
|
||||
void test() {
|
||||
int i = get<int>();
|
||||
float f = get<float>();
|
||||
float* fp = get<float*>();
|
||||
get<void>();
|
||||
ENUM x = get<ENUM>();
|
||||
float f2 = float();
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
digraph iCFG {
|
||||
23 [label="23: DeclStmt \n n$3=_fun_get<int>() [line 20]\n *&i:int =n$3 [line 20]\n REMOVE_TEMPS(n$3); [line 20]\n NULLIFY(&i,false); [line 20]\n " shape="box"]
|
||||
|
||||
|
||||
23 -> 22 ;
|
||||
22 [label="22: DeclStmt \n n$2=_fun_get<float>() [line 21]\n *&f:float =n$2 [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n NULLIFY(&f,false); [line 21]\n " shape="box"]
|
||||
|
||||
|
||||
22 -> 21 ;
|
||||
21 [label="21: DeclStmt \n n$1=_fun_get<float *>() [line 22]\n *&fp:float *=n$1 [line 22]\n REMOVE_TEMPS(n$1); [line 22]\n NULLIFY(&fp,false); [line 22]\n " shape="box"]
|
||||
|
||||
|
||||
21 -> 20 ;
|
||||
20 [label="20: Call _fun_get<void> \n _fun_get<void>() [line 23]\n " shape="box"]
|
||||
|
||||
|
||||
20 -> 19 ;
|
||||
19 [label="19: DeclStmt \n n$0=_fun_get<ENUM>() [line 24]\n *&x:int =n$0 [line 24]\n REMOVE_TEMPS(n$0); [line 24]\n NULLIFY(&x,false); [line 24]\n " shape="box"]
|
||||
|
||||
|
||||
19 -> 18 ;
|
||||
18 [label="18: DeclStmt \n *&f2:float =0.000000 [line 25]\n NULLIFY(&f2,false); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"]
|
||||
|
||||
|
||||
18 -> 17 ;
|
||||
17 [label="17: Exit test \n " color=yellow style=filled]
|
||||
|
||||
|
||||
16 [label="16: Start test\nFormals: \nLocals: f2:float x:int fp:float * f:float i:int \n DECLARE_LOCALS(&return,&f2,&x,&fp,&f,&i); [line 19]\n NULLIFY(&f,false); [line 19]\n NULLIFY(&f2,false); [line 19]\n NULLIFY(&fp,false); [line 19]\n NULLIFY(&i,false); [line 19]\n NULLIFY(&x,false); [line 19]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
16 -> 23 ;
|
||||
15 [label="15: Return Stmt \n *&return:int =0 [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||
|
||||
|
||||
15 -> 14 ;
|
||||
14 [label="14: Exit get<ENUM> \n " color=yellow style=filled]
|
||||
|
||||
|
||||
13 [label="13: Start get<ENUM>\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
13 -> 15 ;
|
||||
12 [label="12: Return Stmt \n *&return:void =-1 [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||
|
||||
|
||||
12 -> 11 ;
|
||||
11 [label="11: Exit get<void> \n " color=yellow style=filled]
|
||||
|
||||
|
||||
10 [label="10: Start get<void>\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
10 -> 12 ;
|
||||
9 [label="9: Return Stmt \n *&return:float *=null [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||
|
||||
|
||||
9 -> 8 ;
|
||||
8 [label="8: Exit get<float *> \n " color=yellow style=filled]
|
||||
|
||||
|
||||
7 [label="7: Start get<float *>\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
7 -> 9 ;
|
||||
6 [label="6: Return Stmt \n *&return:float =0.000000 [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||
|
||||
|
||||
6 -> 5 ;
|
||||
5 [label="5: Exit get<float> \n " color=yellow style=filled]
|
||||
|
||||
|
||||
4 [label="4: Start get<float>\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
4 -> 6 ;
|
||||
3 [label="3: Return Stmt \n *&return:int =0 [line 16]\n APPLY_ABSTRACTION; [line 16]\n " shape="box"]
|
||||
|
||||
|
||||
3 -> 2 ;
|
||||
2 [label="2: Exit get<int> \n " color=yellow style=filled]
|
||||
|
||||
|
||||
1 [label="1: Start get<int>\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 15]\n " color=yellow style=filled]
|
||||
|
||||
|
||||
1 -> 3 ;
|
||||
}
|
Loading…
Reference in new issue