diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2014-10-29 13:23:20 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2014-10-29 13:23:20 +0000 |
commit | a094f0428b36eadd1b131aeb045abf6f4ab492db (patch) | |
tree | a71c26b632547302da8ef53bc784887e19e3f1db /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 7acc8a36c76fda537957441fa97e8e8f4ac3c23c (diff) | |
download | bcm5719-llvm-a094f0428b36eadd1b131aeb045abf6f4ab492db.tar.gz bcm5719-llvm-a094f0428b36eadd1b131aeb045abf6f4ab492db.zip |
[PowerPC ABI] Bug 21398 - Consider C++ base classes in HA classification
As discussed in bug 21398, PowerPC ABI code needs to consider C++ base
classes when classifying a class as homogeneous aggregate (or not) for
ABI purposes.
llvm-svn: 220852
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index ea62e4e409d..4fcfc79abd7 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -3208,6 +3208,22 @@ PPC64_SVR4_ABIInfo::isHomogeneousAggregate(QualType Ty, const Type *&Base, return false; Members = 0; + + // If this is a C++ record, check the bases first. + if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) { + for (const auto &I : CXXRD->bases()) { + // Ignore empty records. + if (isEmptyRecord(getContext(), I.getType(), true)) + continue; + + uint64_t FldMembers; + if (!isHomogeneousAggregate(I.getType(), Base, FldMembers)) + return false; + + Members += FldMembers; + } + } + for (const auto *FD : RD->fields()) { // Ignore (non-zero arrays of) empty records. QualType FT = FD->getType(); |