summaryrefslogtreecommitdiff
path: root/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-03-20 00:26:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-03-20 00:26:26 +0000
commit4776bce28cb7d669329222c3d9cf6a97d6881c96 (patch)
treea1d9119248131b6d76b9339230b856df0d10197e /lib/IR/DebugInfo.cpp
parentd73dc544f5e37e6d58befc71e57da3c132804543 (diff)
downloadllvm-4776bce28cb7d669329222c3d9cf6a97d6881c96.tar.gz
llvm-4776bce28cb7d669329222c3d9cf6a97d6881c96.tar.bz2
llvm-4776bce28cb7d669329222c3d9cf6a97d6881c96.tar.xz
Refactor the DIFile (2nd) parameter to DITypes to be an MDNode reference to a raw directory/file pair
This makes DIType's first non-tag parameter the same as DIFile's, allowing them to both share the common implementation of getFilename/getDirectory in DIScope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DebugInfo.cpp')
-rw-r--r--lib/IR/DebugInfo.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index 1a5454e16f..d1db3ab53a 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -539,6 +539,11 @@ bool DINameSpace::Verify() const {
return DbgNode->getNumOperands() == 5;
}
+/// \brief Retrieve the MDNode for the directory/file pair.
+MDNode *DIFile::getFileNode() const {
+ return const_cast<MDNode*>(getNodeField(DbgNode, 1));
+}
+
/// \brief Verify that the file descriptor is well formed.
bool DIFile::Verify() const {
return isFile() && DbgNode->getNumOperands() == 2;
@@ -669,8 +674,6 @@ StringRef DIScope::getFilename() const {
return DICompileUnit(DbgNode).getFilename();
if (isNameSpace())
return DINameSpace(DbgNode).getFilename();
- if (isType())
- return DIType(DbgNode).getFilename();
return ::getStringField(getNodeField(DbgNode, 1), 0);
}
@@ -687,8 +690,6 @@ StringRef DIScope::getDirectory() const {
return DICompileUnit(DbgNode).getDirectory();
if (isNameSpace())
return DINameSpace(DbgNode).getDirectory();
- if (isType())
- return DIType(DbgNode).getDirectory();
return ::getStringField(getNodeField(DbgNode, 1), 1);
}