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 | 66427b1fcfaa4f2b6f5af33b1c35389f4d95bfdd (patch) | |
| tree | 3de1da4781e15f929b57668d7de5f3d95e94465e /clang/lib | |
| parent | e31e323c021ea505b5bef67db3e6d66044a8892e (diff) | |
| download | bcm5719-llvm-66427b1fcfaa4f2b6f5af33b1c35389f4d95bfdd.tar.gz bcm5719-llvm-66427b1fcfaa4f2b6f5af33b1c35389f4d95bfdd.zip | |
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.
llvm-svn: 111842
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 81947f9ba34..6b79b3ed43b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/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 |

