diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-14 01:20:56 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-14 01:20:56 +0000 |
commit | f5c79709bc08b99f4eb3e61b51e408c77a0bc046 (patch) | |
tree | de4c94d8f549d53aeb9d7f1eb147adedd2925a32 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | b1f9128c721a2ac1cb99803800bc8e24cd018ffc (diff) | |
download | bcm5719-llvm-f5c79709bc08b99f4eb3e61b51e408c77a0bc046.tar.gz bcm5719-llvm-f5c79709bc08b99f4eb3e61b51e408c77a0bc046.zip |
Update debug info generation for ObjCObjectPointer changes.
- Previously this would crash on recursive types, and it was also incorrectly
stripping off a level of indirection.
- I'm not 100% convinced this is all correct, but it should be a monotonic
improvment.
llvm-svn: 75582
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 3d7417df30e..0344f562a7b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -200,6 +200,19 @@ llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) { 0, 0, 0, 0, 0, FromTy); } +llvm::DIType CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty, + llvm::DICompileUnit Unit) { + llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit); + + // Bit size, align and offset of the type. + uint64_t Size = M->getContext().getTypeSize(Ty); + uint64_t Align = M->getContext().getTypeAlign(Ty); + + return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type, Unit, + "", llvm::DICompileUnit(), + 0, Size, Align, 0, 0, EltTy); +} + llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty, llvm::DICompileUnit Unit) { llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit); @@ -764,11 +777,8 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, case Type::QualifiedName: // Unsupported types return llvm::DIType(); - case Type::ObjCObjectPointer: // Encode id<p> in debug info just like id. - { - ObjCObjectPointerType *OPT = cast<ObjCObjectPointerType>(Ty); - return Slot = CreateType(OPT->getInterfaceType(), Unit); - } + case Type::ObjCObjectPointer: + return Slot = CreateType(cast<ObjCObjectPointerType>(Ty), Unit); case Type::ObjCQualifiedInterface: // Drop protocols from interface. case Type::ObjCInterface: return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit); |