From 03f5ad9a7707e098f601921fcec17ed65eb355a7 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 15 Apr 2009 22:08:45 +0000 Subject: Defer generation of tentative definitions. - PR3980. - [irgen] crash when generating tentative definition of incomplete structure - This also avoids creating common definitions for things which are later overwritten. - XFAIL'ed external-defs.c, it isn't completing types properly yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69231 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index a1fc715344..e7a587fc8c 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -117,6 +117,14 @@ class CodeGenModule : public BlockModule { /// that *are* actually referenced. These get code generated when the module /// is done. std::vector DeferredDeclsToEmit; + + /// TentativeDefinitions - A list of declarations which are + /// tentative definitions. Code generation for these must be + /// deferred because they are allowed to have incomplete type when + /// they are seen. This also allows us to avoid generating an extra + /// common definiton in situations where the tentative definition is + /// followed by an actual definition. + std::vector TentativeDefinitions; /// LLVMUsed - List of global values which are required to be /// present in the object file; bitcast to i8*. This is used for @@ -357,6 +365,7 @@ private: void EmitGlobalDefinition(const ValueDecl *D); void EmitGlobalFunctionDefinition(const FunctionDecl *D); + void EmitTentativeDefinition(const VarDecl *D); void EmitGlobalVarDefinition(const VarDecl *D); void EmitAliasDefinition(const ValueDecl *D); void EmitObjCPropertyImplementations(const ObjCImplementationDecl *D); -- cgit v1.2.3-18-g5258