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
This commit is contained in:
Eric Christopher 2012-04-11 05:56:05 +00:00
Родитель 6ce48a70ac
Коммит be6c6869a9
7 изменённых файлов: 42 добавлений и 5 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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: {

Просмотреть файл

@ -2,7 +2,7 @@
// RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s -o - | FileCheck %s
extern void foo(void(^)(void));
// CHECK: !40 = metadata !{i32 {{.*}}, i32 0, metadata !25, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !25, i32 24, metadata !41, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !43, i32 24} ; [ DW_TAG_subprogram ]
// CHECK: !42 = metadata !{i32 {{.*}}, i32 0, metadata !27, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !27, i32 24, metadata !43, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !45, i32 24} ; [ DW_TAG_subprogram ]
@interface NSObject {
struct objc_object *isa;

Просмотреть файл

@ -0,0 +1,16 @@
// RUN: %clang -fverbose-asm -g -S -emit-llvm %s -o - | FileCheck %s
// CHECK: metadata !{i32 786451, metadata !6, metadata !"Circle", metadata !6, i32 11, i64 64, i64 64, i32 0, i32 512, null, metadata !7, i32 16, i32 0} ; [ DW_TAG_structure_type ]
@interface NSObject {
struct objc_object *isa;
}
@end
@interface Shape : NSObject
@end
@interface Circle : Shape
@end
@implementation Circle
@end

Просмотреть файл

@ -1,7 +1,7 @@
// REQUIRES: x86-64-registered-target
// RUN: %clang -cc1 -triple x86_64-apple-darwin10 -g -emit-llvm %s -o - | FileCheck %s
// CHECK: !10 = metadata !{i32 {{.*}}, metadata !6, metadata !"H", metadata !6, i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !2, i32 16, i32 0} ; [ DW_TAG_structure_type ]
// CHECK: !5 = metadata !{i32 {{.*}}, metadata !6, metadata !"H", metadata !6, i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !2, i32 16, i32 0} ; [ DW_TAG_structure_type ]
@interface H
-(void) foo;

Просмотреть файл

@ -30,5 +30,5 @@ int main(int argc, char *argv[]) {
}
}
// CHECK: !11 = metadata !{i32 {{.*}}, metadata !"./foo.h"
// CHECK: !29 = metadata !{i32 {{.*}}, i32 0, metadata !11, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !11, i32 8, metadata !30, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !32, i32 8} ; [ DW_TAG_subprogram ]
// CHECK: !7 = metadata !{i32 {{.*}}, metadata !"./foo.h"
// CHECK: !31 = metadata !{i32 {{.*}}, i32 0, metadata !7, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !7, i32 8, metadata !32, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !34, i32 8} ; [ DW_TAG_subprogram ]