diff options
| author | Eric Christopher <echristo@apple.com> | 2012-04-11 05:56:05 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2012-04-11 05:56:05 +0000 |
| commit | 3d19de9910ab7fb9497933c2136d253295c761b2 (patch) | |
| tree | c2e0e63f7e58af21b8b02ac13e03184a7c7ea47b /clang/lib | |
| parent | 48346c1cd9ba66f1cc8e8e051ecebaa42303eb3d (diff) | |
| download | bcm5719-llvm-3d19de9910ab7fb9497933c2136d253295c761b2.tar.gz bcm5719-llvm-3d19de9910ab7fb9497933c2136d253295c761b2.zip | |
Enable debug info for objective c implementations that may not have
an explicit instance variable.
rdar://10590352
llvm-svn: 154481
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 6 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 587ab8a3571..23e922de6bc 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1181,6 +1181,15 @@ llvm::DIType CGDebugInfo::getOrCreateRecordType(QualType RTy, return T; } +/// getOrCreateInterfaceType - Emit an objective c interface type standalone +/// debug info. +llvm::DIType CGDebugInfo::getOrCreateInterfaceType(QualType D, + SourceLocation Loc) { + llvm::DIType T = getOrCreateType(D, getOrCreateFile(Loc)); + DBuilder.retainType(T); + return T; +} + /// CreateType - get structure or union type. llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { RecordDecl *RD = Ty->getDecl(); @@ -1282,6 +1291,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, RuntimeLang); return FwdDecl; } + ID = Def; // Bit size, align and offset of the type. @@ -1296,7 +1306,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, DBuilder.createStructType(Unit, ID->getName(), DefUnit, Line, Size, Align, Flags, llvm::DIArray(), RuntimeLang); - + // Otherwise, insert it into the CompletedTypeCache so that recursive uses // will find it and we're emitting the complete type. CompletedTypeCache[QualType(Ty, 0).getAsOpaquePtr()] = RealDecl; diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index a071b06c26d..ec7705c0544 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -226,6 +226,12 @@ public: /// getOrCreateRecordType - Emit record type's standalone debug info. llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L); + + /// getOrCreateInterfaceType - Emit an objective c interface type standalone + /// debug info. + llvm::DIType getOrCreateInterfaceType(QualType Ty, + SourceLocation Loc); + private: /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration. void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c9f1066032d..c0ccf4de4c9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2535,6 +2535,11 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { EmitObjCPropertyImplementations(OMD); EmitObjCIvarInitializations(OMD); ObjCRuntime->GenerateClass(OMD); + // Emit global variable debug information. + if (CGDebugInfo *DI = getModuleDebugInfo()) + DI->getOrCreateInterfaceType(getContext().getObjCInterfaceType(OMD->getClassInterface()), + OMD->getLocation()); + break; } case Decl::ObjCMethod: { |

