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 | be6c6869a993536d4cd007f04e84ef74a1c3b229 (patch) | |
tree | d813e6732ac8420cca01cc25a7ea5c61ab5ca908 /lib/CodeGen | |
parent | 6ce48a70ace62eb0eaf7b2769d05c5f13b7c7b6c (diff) |
Enable debug info for objective c implementations that may not have
an explicit instance variable.
rdar://10590352
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 12 | ||||
-rw-r--r-- | lib/CodeGen/CGDebugInfo.h | 6 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 587ab8a357..23e922de6b 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index a071b06c26..ec7705c054 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/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/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index c9f1066032..c0ccf4de4c 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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: { |