[cfe-commits] r120924 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Anders Carlsson
andersca at mac.com
Sat Dec 4 15:59:48 PST 2010
Author: andersca
Date: Sat Dec 4 17:59:48 2010
New Revision: 120924
URL: http://llvm.org/viewvc/llvm-project?rev=120924&view=rev
Log:
Add a LayoutBase member function. No functionality change.
Modified:
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=120924&r1=120923&r2=120924&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Sat Dec 4 17:59:48 2010
@@ -106,6 +106,9 @@
/// Returns false if the operation failed because the struct is not packed.
bool LayoutFields(const RecordDecl *D);
+ /// Layout a single base, virtual or non-virtual
+ void LayoutBase(const CXXRecordDecl *BaseDecl, uint64_t BaseOffset);
+
/// LayoutVirtualBase - layout a single virtual base.
void LayoutVirtualBase(const CXXRecordDecl *BaseDecl, uint64_t BaseOffset);
@@ -490,6 +493,21 @@
AppendPadding(Layout.getSize() / 8, Align);
}
+void CGRecordLayoutBuilder::LayoutBase(const CXXRecordDecl *BaseDecl,
+ uint64_t BaseOffset) {
+ CheckZeroInitializable(BaseDecl);
+
+ const ASTRecordLayout &Layout =
+ Types.getContext().getASTRecordLayout(BaseDecl);
+
+ uint64_t NonVirtualSize = Layout.getNonVirtualSize();
+
+ AppendPadding(BaseOffset / 8, 1);
+
+ // FIXME: Actually use a better type than [sizeof(BaseDecl) x i8] when we can.
+ AppendBytes(NonVirtualSize / 8);
+}
+
void
CGRecordLayoutBuilder::LayoutVirtualBase(const CXXRecordDecl *BaseDecl,
uint64_t BaseOffset) {
@@ -504,13 +522,12 @@
uint64_t NonVirtualSize = Layout.getNonVirtualSize();
- // FIXME: Actually use a better type than [sizeof(BaseDecl) x i8] when we can.
AppendPadding(BaseOffset / 8, 1);
- // FIXME: Add the vbase field info.
-
+ // FIXME: Actually use a better type than [sizeof(BaseDecl) x i8] when we can.
AppendBytes(NonVirtualSize / 8);
+ // FIXME: Add the vbase field info.
}
/// LayoutVirtualBases - layout the non-virtual bases of a record decl.
@@ -548,20 +565,10 @@
if (BaseDecl->isEmpty())
return;
- CheckZeroInitializable(BaseDecl);
-
- const ASTRecordLayout &Layout =
- Types.getContext().getASTRecordLayout(BaseDecl);
+ LayoutBase(BaseDecl, BaseOffset);
- uint64_t NonVirtualSize = Layout.getNonVirtualSize();
-
- // FIXME: Actually use a better type than [sizeof(BaseDecl) x i8] when we can.
- AppendPadding(BaseOffset / 8, 1);
-
// Append the base field.
- LLVMNonVirtualBases.push_back(LLVMBaseInfo(BaseDecl, FieldTypes.size()));
-
- AppendBytes(NonVirtualSize / 8);
+ LLVMNonVirtualBases.push_back(LLVMBaseInfo(BaseDecl, FieldTypes.size() - 1));
}
void
More information about the cfe-commits
mailing list