diff options
author | Chris Lattner <sabre@nondot.org> | 2008-02-05 08:06:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-02-05 08:06:13 +0000 |
commit | d86e6bc7ab4388a578daf46e7c76be9122a25072 (patch) | |
tree | 00e1cb94e691418b35d2fe71f1ed5283671af17f /CodeGen/CodeGenModule.cpp | |
parent | 9153f73d1035ddcaac5a253ac2a0570e04e22b1f (diff) |
rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenModule.cpp')
-rw-r--r-- | CodeGen/CodeGenModule.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp index 9de5d3426f..eff26f91b1 100644 --- a/CodeGen/CodeGenModule.cpp +++ b/CodeGen/CodeGenModule.cpp @@ -261,6 +261,27 @@ void CodeGenModule::EmitGlobalVarDeclarator(const FileVarDecl *D) { EmitGlobalVar(D); } +void CodeGenModule::EmitType(const TypeDecl *D) { + if (isa<TypedefDecl>(D)) { + // TODO: Emit debug info. + return; + } + + assert(!isa<ObjCInterfaceDecl>(D) && "FIXME: ADD OBJC SUPPORT"); + + // This must be a tag decl. + const TagDecl *TD = cast<TagDecl>(D); + + // 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 = Types.ConvertType(NewTy); + if (isa<llvm::OpaqueType>(T) && TD->isDefinition()) + // Make sure that this type is translated. + Types.ForceTypeCompilation(NewTy); +} + + /// getBuiltinLibFunction llvm::Function *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) { if (BuiltinID > BuiltinFunctions.size()) |