diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-10-05 01:43:03 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-10-05 01:43:03 +0000 |
commit | c664d76716ba87577b6c2a513ce4fe0712a2d3e2 (patch) | |
tree | 4b0fd93928b742ceb7221f837dff9eac2a78192f /include | |
parent | af76b1601cc1568aa7c672bca6383760b56d2ac4 (diff) | |
download | external_llvm-c664d76716ba87577b6c2a513ce4fe0712a2d3e2.zip external_llvm-c664d76716ba87577b6c2a513ce4fe0712a2d3e2.tar.gz external_llvm-c664d76716ba87577b6c2a513ce4fe0712a2d3e2.tar.bz2 |
Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_type
is updated to use DITypeRef.
Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static
helper functions in DwarfCompileUnit. We already have a static helper function
"isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to
resolve the derived-from field. All three functions need to go across link
for derived-from fields, so we need to get hold of a type identifier map.
A pointer to DwarfDebug is also added to DbgVariable in order to resolve the
derived-from field.
Debug info verifier is updated to check a derived-from field is a TypeRef.
Verifier will not go across link for derived-from fields, in debug info finder,
we go across the link to add derived-from fields to types.
Function getDICompositeType is only used by dragonegg and since dragonegg does
not generate identifier for types, we use an empty map to resolve the
derived-from field.
When printing a derived-from field, we use DITypeRef::getName to either return
the type identifier or getName of the DIType.
A paired commit at clang is required due to changes to DIBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/DebugInfo.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index ad01494..506b84c 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -22,6 +22,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/IR/Metadata.h" #include "llvm/Support/Dwarf.h" namespace llvm { @@ -204,6 +205,8 @@ public: /// Gets the parent scope for this scope node or returns a /// default constructed scope. DIScopeRef getContext() const; + /// If the scope node has a name, return that, else return an empty string. + StringRef getName() const; StringRef getFilename() const; StringRef getDirectory() const; @@ -227,6 +230,16 @@ template <typename T> class DIRef { public: T resolve(const DITypeIdentifierMap &Map) const; + StringRef getName() const { + if (!Val) + return StringRef(); + + if (const MDNode *MD = dyn_cast<MDNode>(Val)) + return T(MD).getName(); + + const MDString *MS = cast<MDString>(Val); + return MS->getString(); + } operator Value *() const { return const_cast<Value *>(Val); } }; @@ -300,9 +313,6 @@ public: bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; } bool isValid() const { return DbgNode && isType(); } - /// isUnsignedDIType - Return true if type encoding is unsigned. - bool isUnsignedDIType(); - /// replaceAllUsesWith - Replace all uses of debug info referenced by /// this descriptor. void replaceAllUsesWith(DIDescriptor &D); @@ -330,11 +340,7 @@ class DIDerivedType : public DIType { public: explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {} - DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); } - - /// getOriginalTypeSize - If this type is derived from a base type then - /// return base type size. - uint64_t getOriginalTypeSize() const; + DITypeRef getTypeDerivedFrom() const { return getFieldAs<DITypeRef>(9); } /// getObjCProperty - Return property node, if this ivar is /// associated with one. |