aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-06 06:06:49 +0000
committerChris Lattner <sabre@nondot.org>2008-02-06 06:06:49 +0000
commit8fb1dd005f4cb530bca11d622362d39727294420 (patch)
tree56f41f6baa38991fff2cc1a0d6f09b5bd1db8a81 /CodeGen/CodeGenTypes.cpp
parent5de00fcf7c923a14bb79bdbaabb2faeb5633d85a (diff)
now that ConvertTagDeclType is nice and simple, use it from UpdateCompletedType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r--CodeGen/CodeGenTypes.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp
index 24a18334cd..3f5449056a 100644
--- a/CodeGen/CodeGenTypes.cpp
+++ b/CodeGen/CodeGenTypes.cpp
@@ -139,13 +139,11 @@ void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
// Remove it from TagDeclTypes so that it will be regenerated.
TagDeclTypes.erase(TDTI);
- QualType NewTy = Context.getTagDeclType(const_cast<TagDecl*>(TD));
- const llvm::Type *NT = ConvertNewType(NewTy);
+ // Generate the new type.
+ const llvm::Type *NT = ConvertTagDeclType(TD);
- // If getting the type didn't itself refine it, refine it to its actual type
- // now.
- if (llvm::OpaqueType *OT = dyn_cast<llvm::OpaqueType>(OpaqueHolder.get()))
- OT->refineAbstractTypeTo(NT);
+ // Refine the old opaque type to its new definition.
+ cast<llvm::OpaqueType>(OpaqueHolder.get())->refineAbstractTypeTo(NT);
}
@@ -279,7 +277,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
case Type::Tagged: {
const TagDecl *TD = cast<TagType>(Ty).getDecl();
- const llvm::Type *Res = ConvertTagDeclType(T, TD);
+ const llvm::Type *Res = ConvertTagDeclType(TD);
std::string TypeName(TD->getKindName());
TypeName += '.';
@@ -316,8 +314,7 @@ void CodeGenTypes::DecodeArgumentTypes(const FunctionTypeProto &FTP,
/// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
/// enum.
-const llvm::Type *CodeGenTypes::ConvertTagDeclType(QualType T,
- const TagDecl *TD) {
+const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
llvm::DenseMap<const TagDecl*, llvm::PATypeHolder>::iterator TDTI =
TagDeclTypes.find(TD);