Index: CodeGen/CodeGenTypes.cpp =================================================================== --- CodeGen/CodeGenTypes.cpp (revision 46593) +++ CodeGen/CodeGenTypes.cpp (working copy) @@ -97,7 +97,7 @@ static bool isOpaqueTypeDefinition(QualType T, const llvm::Type *LT) { if (T->isPointerType()) { return - isOpaqueTypeDefinition(cast(*T).getPointeeType(), + isOpaqueTypeDefinition(T->getAsPointerType()->getPointeeType(), cast(LT)->getElementType()); } if (!isa(LT)) @@ -279,7 +279,7 @@ case Type::Tagged: const TagType &TT = cast(Ty); const TagDecl *TD = TT.getDecl(); - llvm::Type *&ResultType = TagDeclTypes[TD]; + llvm::Type *ResultType = TagDeclTypes[TD]; // If corresponding llvm type is not a opaque struct type // then use it. @@ -287,7 +287,7 @@ return ResultType; if (!TD->isDefinition()) { - ResultType = llvm::OpaqueType::get(); + ResultType = TagDeclTypes[TD] = llvm::OpaqueType::get(); } else if (TD->getKind() == Decl::Enum) { return ConvertType(cast(TD)->getIntegerType()); } else if (TD->getKind() == Decl::Struct) { @@ -324,7 +324,7 @@ // Get llvm::StructType. CGRecordLayout *RLI = new CGRecordLayout(RO.getLLVMType()); - ResultType = RLI->getLLVMType(); + ResultType = TagDeclTypes[TD] = RLI->getLLVMType(); CGRecordLayouts[ResultType] = RLI; // Refine any OpaqueType associated with this RecordDecl. @@ -347,11 +347,11 @@ // Get llvm::StructType. CGRecordLayout *RLI = new CGRecordLayout(RO.getLLVMType()); - ResultType = RLI->getLLVMType(); + ResultType = TagDeclTypes[TD] = RLI->getLLVMType(); CGRecordLayouts[ResultType] = RLI; } else { std::vector Fields; - ResultType = llvm::StructType::get(Fields); + ResultType = TagDeclTypes[TD] = llvm::StructType::get(Fields); } } else { assert(0 && "FIXME: Implement tag decl kind!");