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 | b1537ebdd4b91405ecb4fdb379120f8820e15212 (patch) | |
| tree | 236d44a0be9e1f3959ec38b9a74bb58d003f250d /clang/CodeGen/CodeGenModule.cpp | |
| parent | d8902e06ba940b3a1f6124ffd31ee963a23cbdb9 (diff) | |
| download | bcm5719-llvm-b1537ebdd4b91405ecb4fdb379120f8820e15212.tar.gz bcm5719-llvm-b1537ebdd4b91405ecb4fdb379120f8820e15212.zip | |
rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.
llvm-svn: 46745
Diffstat (limited to 'clang/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/CodeGen/CodeGenModule.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index 9de5d3426f0..eff26f91b12 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/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()) |

