summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-11-18 03:47:20 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-11-18 03:47:20 +0000
commit0b3f201b61b1bcb67c209e9b34d4d42cbd459031 (patch)
tree0422d098d22f40b72acc80c5791b646f60741744 /clang/lib/CodeGen/TargetInfo.cpp
parent6b4d578f5464b5e217311c2696958f4002b5b03c (diff)
downloadbcm5719-llvm-0b3f201b61b1bcb67c209e9b34d4d42cbd459031.tar.gz
bcm5719-llvm-0b3f201b61b1bcb67c209e9b34d4d42cbd459031.zip
Fix the meaning of an "empty" record for the case of a zero-length array. Use isEmptyRecord for arguments on x86-32; there are structs of size 0 which don't count as empty.
llvm-svn: 144971
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 33291dd5527..a2e15107f50 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -117,10 +117,14 @@ static bool isEmptyField(ASTContext &Context, const FieldDecl *FD,
QualType FT = FD->getType();
- // Constant arrays of empty records count as empty, strip them off.
+ // Constant arrays of empty records count as empty, strip them off.
+ // Constant arrays of zero length always count as empty.
if (AllowArrays)
- while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT))
+ while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
+ if (AT->getSize() == 0)
+ return true;
FT = AT->getElementType();
+ }
const RecordType *RT = FT->getAs<RecordType>();
if (!RT)
@@ -684,7 +688,7 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty) const {
}
// Ignore empty structs/unions.
- if (Ty->isRecordType() && getContext().getTypeSize(Ty) == 0)
+ if (isEmptyRecord(Context, Ty, true))
return ABIArgInfo::getIgnore();
// Expand small (<= 128-bit) record types when we know that the stack layout
OpenPOWER on IntegriCloud