aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-06 05:08:19 +0000
committerChris Lattner <sabre@nondot.org>2008-02-06 05:08:19 +0000
commitc5b8806cda286cf41866176ef98011fdaa68da01 (patch)
treef196dd8e2f678dddc4c34878db50dc360fc1258d /CodeGen/CodeGenTypes.cpp
parent352ffde2f04183083fc00427df81d1b25f8c750c (diff)
sink more of the type related code into CodeGenTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46801 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r--CodeGen/CodeGenTypes.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp
index 2e10cfc971..6ef11dba04 100644
--- a/CodeGen/CodeGenTypes.cpp
+++ b/CodeGen/CodeGenTypes.cpp
@@ -125,11 +125,15 @@ const llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T) {
}
-/// ForceTypeCompilation - When we find the definition for a type, we require
-/// it to be recompiled, to update the lazy understanding of what it is in our
-/// maps.
-void CodeGenTypes::ForceTypeCompilation(QualType T) {
- const TagDecl *TD = cast<TagType>(T)->getDecl();
+/// UpdateCompletedType - When we find the full definition for a TagDecl,
+/// replace the 'opaque' type we previously made for it if applicable.
+void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
+ // Get the LLVM type for this TagDecl. If it is non-opaque or if this decl
+ // is still a forward declaration, just return.
+ QualType NewTy = Context.getTagDeclType(const_cast<TagDecl *>(TD));
+ const llvm::Type *T = ConvertType(NewTy);
+ if (!isa<llvm::OpaqueType>(T))
+ return;
// Remember the opaque LLVM type for this tagdecl.
llvm::DenseMap<const TagDecl*, llvm::PATypeHolder>::iterator TDTI =
@@ -141,7 +145,7 @@ void CodeGenTypes::ForceTypeCompilation(QualType T) {
// Remove it from TagDeclTypes so that it will be regenerated.
TagDeclTypes.erase(TDTI);
- const llvm::Type *NT = ConvertNewType(T);
+ const llvm::Type *NT = ConvertNewType(NewTy);
// If getting the type didn't itself refine it, refine it to its actual type
// now.