diff options
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r-- | CodeGen/CodeGenTypes.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp index 745ba1d87e..017b65c152 100644 --- a/CodeGen/CodeGenTypes.cpp +++ b/CodeGen/CodeGenTypes.cpp @@ -16,7 +16,6 @@ #include "clang/AST/AST.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/Target/TargetData.h" using namespace clang; using namespace CodeGen; @@ -40,7 +39,7 @@ namespace { /// layoutStructFields - Do the actual work and lay out all fields. Create /// corresponding llvm struct type. This should be invoked only after /// all fields are added. - void layoutStructFields(CodeGenTypes &CGT, const RecordLayout &RL); + void layoutStructFields(CodeGenTypes &CGT); /// layoutUnionFields - Do the actual work and lay out all fields. Create /// corresponding llvm struct type. This should be invoked only after @@ -61,9 +60,8 @@ namespace { }; } -CodeGenTypes::CodeGenTypes(ASTContext &Ctx, llvm::Module& M, - const llvm::TargetData &TD) - : Context(Ctx), Target(Ctx.Target), TheModule(M), TheTargetData(TD) { +CodeGenTypes::CodeGenTypes(ASTContext &Ctx, llvm::Module& M) + : Context(Ctx), Target(Ctx.Target), TheModule(M) { } CodeGenTypes::~CodeGenTypes() { @@ -247,8 +245,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { RecordOrganizer RO; for (unsigned i = 0, e = RD->getNumMembers(); i != e; ++i) RO.addField(RD->getMember(i)); - const RecordLayout &RL = Context.getRecordLayout(RD, SourceLocation()); - RO.layoutStructFields(*this, RL); + RO.layoutStructFields(*this); // Get llvm::StructType. RecordLayoutInfo *RLI = new RecordLayoutInfo(RO.getLLVMType()); @@ -355,21 +352,16 @@ void RecordOrganizer::addField(const FieldDecl *FD) { /// - Ignore bit fields /// - Ignore field aligments /// - Ignore packed structs -void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT, - const RecordLayout &RL) { +void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT) { // FIXME : Use SmallVector std::vector<const llvm::Type*> Fields; unsigned FieldNo = 0; - uint64_t Cursor = 0; - for (llvm::SmallVector<const FieldDecl *, 8>::iterator I = FieldDecls.begin(), E = FieldDecls.end(); I != E; ++I) { const FieldDecl *FD = *I; const llvm::Type *Ty = CGT.ConvertType(FD->getType()); - uint64_t Offset = RL.getFieldOffset(FieldNo); - assert (Offset == Cursor && "FIXME Invalid struct layout"); - Cursor += CGT.getTargetData().getTypeSizeInBits(Ty); + // FIXME : Layout FieldDecl FD Fields.push_back(Ty); CGT.addFieldInfo(FD, FieldNo++); |