Summary: When a typedef-ed structure is defined in another source file, `tenv` returns a structure with empty fields. Reviewed By: mbouaziz Differential Revision: D9629200 fbshipit-source-id: 8859803f9master
parent
87d2f67c91
commit
da51a736ec
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "my_typedef.h"
|
||||||
|
|
||||||
|
struct st {
|
||||||
|
int field;
|
||||||
|
};
|
||||||
|
|
||||||
|
int get_field(t* x) { return x->field; }
|
||||||
|
|
||||||
|
void FN_call_get_field_cond_Bad() {
|
||||||
|
int a[5];
|
||||||
|
t x = {0};
|
||||||
|
if (get_field_wrapper(&x)) {
|
||||||
|
a[10] = 0;
|
||||||
|
} else {
|
||||||
|
a[10] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void call_get_field_Good() {
|
||||||
|
int a[5];
|
||||||
|
t x = {0};
|
||||||
|
a[get_field_wrapper(&x)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FN_call_get_field_Bad() {
|
||||||
|
int a[5];
|
||||||
|
t x = {10};
|
||||||
|
a[get_field_wrapper(&x)] = 0;
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "my_typedef.h"
|
||||||
|
|
||||||
|
int get_field_wrapper(t* x) { return get_field(x); }
|
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-present, Facebook, Inc.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct st t;
|
||||||
|
int get_field(t* x);
|
||||||
|
int get_field_wrapper(t* x);
|
Loading…
Reference in new issue