diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-23 21:15:56 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-23 21:15:56 +0000 |
commit | 45f7c78ea33e0b1b1575ca6e6f7a094be5f77e32 (patch) | |
tree | ac1a09fe3b414983f010f2167ad2bddc121ad295 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 673745ff71889df736458f68b8fcca43d794b2b8 (diff) |
Reinstate the code for emitting an initial debug type for a struct,
to handle the case where the struct is only forward-declared. In
this case, a temporary MDNode is not needed and not desired.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 81947f9ba3..6b79b3ed43 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -977,6 +977,17 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, unsigned Line = getLineNumber(ID->getLocation()); unsigned RuntimeLang = TheCU.getLanguage(); + // If this is just a forward declaration, return a special forward-declaration + // debug type. + if (ID->isForwardDecl()) { + llvm::DICompositeType FwdDecl = + DebugFactory.CreateCompositeType(Tag, Unit, ID->getName(), + DefUnit, Line, 0, 0, 0, 0, + llvm::DIType(), llvm::DIArray(), + RuntimeLang); + return FwdDecl; + } + // To handle recursive interface, we // first generate a debug descriptor for the struct as a forward declaration. // Then (if it is a definition) we go through and get debug info for all of @@ -985,10 +996,6 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, // uses of the forward declaration with the final definition. llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType(); - // If this is just a forward declaration, return it. - if (ID->isForwardDecl()) - return FwdDecl; - llvm::MDNode *MN = FwdDecl; llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN; // Otherwise, insert it into the TypeCache so that recursive uses will find |