diff options
author | Devang Patel <dpatel@apple.com> | 2010-07-28 01:33:15 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-07-28 01:33:15 +0000 |
commit | c8972c61d13c67e69eb7d992560aac7613eacd37 (patch) | |
tree | c6a9208deb48c8409dd27def95722bbbf9b67016 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 413e67778d593215d2f2161a4e712c8568f1ddd0 (diff) |
construct debug info for "id" by hand.
Tested by mi1-var-obj.exp in gdb testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 8e9f416d4f..1bdc91016b 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -251,12 +251,44 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT, default: case BuiltinType::Void: return llvm::DIType(); - case BuiltinType::ObjCId: - // id is struct objc_object *. + case BuiltinType::ObjCClass: return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_structure_type, - Unit, "objc_object", Unit, 0, 0, 0, 0, + Unit, "objc_class", Unit, 0, 0, 0, 0, llvm::DIType::FlagFwdDecl, llvm::DIType(), llvm::DIArray()); + case BuiltinType::ObjCId: { + // typedef struct objc_class *Class; + // typedef struct objc_object { + // Class isa; + // } *id; + + llvm::DIType OCTy = + DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_structure_type, + Unit, "objc_class", Unit, 0, 0, 0, 0, + llvm::DIType::FlagFwdDecl, + llvm::DIType(), llvm::DIArray()); + unsigned Size = CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy); + + llvm::DIType ISATy = + DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type, + Unit, "", Unit, + 0, Size, 0, 0, 0, OCTy); + + llvm::SmallVector<llvm::DIDescriptor, 16> EltTys; + + llvm::DIType FieldTy = + DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_member, Unit, + "isa", Unit, + 0,Size, 0, 0, 0, ISATy); + EltTys.push_back(FieldTy); + llvm::DIArray Elements = + DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size()); + + return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_structure_type, + Unit, "objc_object", Unit, 0, 0, 0, 0, + 0, + llvm::DIType(), Elements); + } case BuiltinType::UChar: case BuiltinType::Char_U: Encoding = llvm::dwarf::DW_ATE_unsigned_char; break; case BuiltinType::Char_S: |