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
This commit is contained in:
David Blaikie
2013-03-20 00:26:26 +00:00
parent d73dc544f5
commit 4776bce28c
43 changed files with 261 additions and 265 deletions

View File

@@ -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);
}