[cfe-commits] r77246 - in /cfe/trunk/lib/CodeGen: CGRecordLayoutBuilder.cpp CodeGenTypes.cpp TargetABIInfo.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Jul 27 13:57:46 PDT 2009
Author: fjahanian
Date: Mon Jul 27 15:57:45 2009
New Revision: 77246
URL: http://llvm.org/viewvc/llvm-project?rev=77246&view=rev
Log:
Some minor changes toward support of data
member access in the presense of non-virtual bases.
Modified:
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=77246&r1=77245&r2=77246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Mon Jul 27 15:57:45 2009
@@ -199,6 +199,10 @@
const ASTRecordLayout &Layout = Types.getContext().getASTRecordLayout(D);
unsigned FieldNo = 0;
+ // FIXME. This will probably change when virtual bases are supported.
+ if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(D))
+ FieldNo += CXXRD->getNumBases();
+
for (RecordDecl::field_iterator Field = D->field_begin(),
FieldEnd = D->field_end(); Field != FieldEnd; ++Field, ++FieldNo) {
if (!LayoutField(*Field, Layout.getFieldOffset(FieldNo))) {
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=77246&r1=77245&r2=77246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Mon Jul 27 15:57:45 2009
@@ -415,6 +415,21 @@
/// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
/// enum.
const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
+
+ // FIXME. This may have to move to a better place.
+ if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(TD)) {
+ assert(!RD->isPolymorphic() &&
+ "FIXME: We don't support polymorphic classes yet!");
+ for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
+ e = RD->bases_end(); i != e; ++i) {
+ if (!i->isVirtual()) {
+ const CXXRecordDecl *Base =
+ cast<CXXRecordDecl>(i->getType()->getAsRecordType()->getDecl());
+ ConvertTagDeclType(Base);
+ }
+ }
+ }
+
// TagDecl's are not necessarily unique, instead use the (clang)
// type connected to the decl.
const Type *Key =
Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=77246&r1=77245&r2=77246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Mon Jul 27 15:57:45 2009
@@ -723,6 +723,10 @@
// Reset Lo class, this will be recomputed.
Current = NoClass;
unsigned idx = 0;
+ // FIXME. This will probably change when virtual bases are supported.
+ if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
+ idx += CXXRD->getNumBases();
+
for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
i != e; ++i, ++idx) {
uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
More information about the cfe-commits
mailing list