aboutsummaryrefslogtreecommitdiff
path: root/lib/IR
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
parentd73dc544f5e37e6d58befc71e57da3c132804543 (diff)
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')
-rw-r--r--lib/IR/DIBuilder.cpp20
-rw-r--r--lib/IR/DebugInfo.cpp9
2 files changed, 15 insertions, 14 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index c29ca01f78..f435bba0da 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -266,7 +266,7 @@ DIDerivedType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File,
assert(Ty.Verify() && "Invalid typedef type!");
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_typedef),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Context),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
@@ -328,7 +328,7 @@ DIDerivedType DIBuilder::createMemberType(
// TAG_member is encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_member),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Scope),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -351,7 +351,7 @@ DIType DIBuilder::createStaticMemberType(DIDescriptor Scope, StringRef Name,
Flags |= DIDescriptor::FlagStaticMember;
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_member),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Scope),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -377,7 +377,7 @@ DIType DIBuilder::createObjCIVar(StringRef Name,
// TAG_member is encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_member),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(File),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -404,7 +404,7 @@ DIType DIBuilder::createObjCIVar(StringRef Name,
// TAG_member is encoded in DIDerivedType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_member),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(File),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -490,7 +490,7 @@ DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
// TAG_class_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_class_type),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Context),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -522,7 +522,7 @@ DICompositeType DIBuilder::createStructType(DIDescriptor Context,
// TAG_structure_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_structure_type),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Context),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -549,7 +549,7 @@ DICompositeType DIBuilder::createUnionType(
// TAG_union_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_union_type),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Scope),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -596,7 +596,7 @@ DICompositeType DIBuilder::createEnumerationType(
// TAG_enumeration_type is encoded in DICompositeType format.
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
- File,
+ File.getFileNode(),
getNonCompileUnitScope(Scope),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
@@ -733,7 +733,7 @@ DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
// Create a temporary MDNode.
Value *Elts[] = {
GetTagConstant(VMContext, Tag),
- F,
+ F.getFileNode(),
getNonCompileUnitScope(Scope),
MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
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);
}