mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 00:20:25 +08:00
Don't warn about address-to-member used as part of initialisation, if
the member expression is in parentheses. llvm-svn: 158651
This commit is contained in:
@@ -6232,7 +6232,7 @@ namespace {
|
||||
void VisitUnaryOperator(UnaryOperator *E) {
|
||||
// For POD record types, addresses of its own members are well-defined.
|
||||
if (E->getOpcode() == UO_AddrOf && isRecordType && isPODType &&
|
||||
isa<MemberExpr>(E->getSubExpr())) return;
|
||||
isa<MemberExpr>(E->getSubExpr()->IgnoreParens())) return;
|
||||
Inherited::VisitUnaryOperator(E);
|
||||
}
|
||||
|
||||
|
||||
@@ -438,6 +438,10 @@ void test54() {
|
||||
ASSIGN(int, c, d); // expected-warning {{variable 'c' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
// Taking the address is fine
|
||||
struct { struct { void *p; } a; } test55 = { { &test55.a }}; // no-warning
|
||||
struct { struct { void *p; } a; } test56 = { { &(test56.a) }}; // no-warning
|
||||
|
||||
void uninit_in_loop() {
|
||||
int produce(void);
|
||||
void consume(int);
|
||||
|
||||
Reference in New Issue
Block a user