forked from OSchip/llvm-project
Darwin x86_32: Ignore padding bit-fields when looking for "single
element" structures. llvm-svn: 71266
This commit is contained in:
parent
2e55cc5a4a
commit
fdda3501a0
|
@ -204,11 +204,15 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
|
|||
if (AT->getSize().getZExtValue() == 1)
|
||||
FT = AT->getElementType();
|
||||
|
||||
if (isEmptyRecord(Context, FT)) {
|
||||
// Ignore
|
||||
} else if (Found) {
|
||||
// Ignore empty records and padding bit-fields.
|
||||
if (isEmptyRecord(Context, FT) ||
|
||||
(FD->isBitField() && !FD->getIdentifier()))
|
||||
continue;
|
||||
|
||||
if (Found)
|
||||
return 0;
|
||||
} else if (!CodeGenFunction::hasAggregateLLVMType(FT)) {
|
||||
|
||||
if (!CodeGenFunction::hasAggregateLLVMType(FT)) {
|
||||
Found = FT.getTypePtr();
|
||||
} else {
|
||||
Found = isSingleElementStruct(FT, Context);
|
||||
|
|
|
@ -130,4 +130,7 @@ struct s29 { struct { } a[1]; char b; char c; } f29(void) {}
|
|||
// RUN: grep 'define i16 @f30()' %t &&
|
||||
struct s30 { char a; char b : 4; } f30(void) {}
|
||||
|
||||
// RUN: grep 'define float @f31()' %t &&
|
||||
struct s31 { char : 0; float b; char : 0} f31(void) {}
|
||||
|
||||
// RUN: true
|
||||
|
|
Loading…
Reference in New Issue