diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-03-13 00:01:35 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-03-13 00:01:35 +0000 |
commit | de3077ae6b5ad8e6f417a8f6aa0ca1ae980f6272 (patch) | |
tree | 54b7fc0b810ea78b5cd7c0a16bbaea5b1e7f1796 /include | |
parent | b79d25ca9c3b895d8fdc88c3acefec1202ca9da3 (diff) | |
download | external_llvm-de3077ae6b5ad8e6f417a8f6aa0ca1ae980f6272.zip external_llvm-de3077ae6b5ad8e6f417a8f6aa0ca1ae980f6272.tar.gz external_llvm-de3077ae6b5ad8e6f417a8f6aa0ca1ae980f6272.tar.bz2 |
Refactor filename/directory in DICompileUnit into a DIFile
This is the next step towards making the metadata for DIScopes have a common
prefix rather than having to delegate based on their tag type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/DebugInfo.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index 3737c54..e91df10 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -169,6 +169,20 @@ namespace llvm { StringRef getDirectory() const; }; + /// DIFile - This is a wrapper for a file. + class DIFile : public DIScope { + friend class DIDescriptor; + void printInternal(raw_ostream &OS) const {} // FIXME: Output something? + public: + explicit DIFile(const MDNode *N = 0) : DIScope(N) { + if (DbgNode && !isFile()) + DbgNode = 0; + } + StringRef getFilename() const { return getStringField(1); } + StringRef getDirectory() const { return getStringField(2); } + bool Verify() const; + }; + /// DICompileUnit - A wrapper for a compile unit. class DICompileUnit : public DIScope { friend class DIDescriptor; @@ -176,40 +190,30 @@ namespace llvm { public: explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {} - unsigned getLanguage() const { return getUnsignedField(2); } - StringRef getFilename() const { return getStringField(3); } - StringRef getDirectory() const { return getStringField(4); } - StringRef getProducer() const { return getStringField(5); } + unsigned getLanguage() const { return getUnsignedField(2); } + StringRef getFilename() const { + return getFieldAs<DIFile>(3).getFilename(); + } + StringRef getDirectory() const { + return getFieldAs<DIFile>(3).getDirectory(); + } + StringRef getProducer() const { return getStringField(4); } - bool isOptimized() const { return getUnsignedField(6) != 0; } - StringRef getFlags() const { return getStringField(7); } - unsigned getRunTimeVersion() const { return getUnsignedField(8); } + bool isOptimized() const { return getUnsignedField(5) != 0; } + StringRef getFlags() const { return getStringField(6); } + unsigned getRunTimeVersion() const { return getUnsignedField(7); } DIArray getEnumTypes() const; DIArray getRetainedTypes() const; DIArray getSubprograms() const; DIArray getGlobalVariables() const; - StringRef getSplitDebugFilename() const { return getStringField(13); } + StringRef getSplitDebugFilename() const { return getStringField(12); } /// Verify - Verify that a compile unit is well formed. bool Verify() const; }; - /// DIFile - This is a wrapper for a file. - class DIFile : public DIScope { - friend class DIDescriptor; - void printInternal(raw_ostream &OS) const {} // FIXME: Output something? - public: - explicit DIFile(const MDNode *N = 0) : DIScope(N) { - if (DbgNode && !isFile()) - DbgNode = 0; - } - StringRef getFilename() const { return getStringField(1); } - StringRef getDirectory() const { return getStringField(2); } - bool Verify() const; - }; - /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}'). /// FIXME: it seems strange that this doesn't have either a reference to the /// type/precision or a file/line pair for location info. |