summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-03-20 23:58:12 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-03-20 23:58:12 +0000
commitefb0d65ed7a497dce00fb6d171f5fd645d554192 (patch)
tree315c88ccd4249ea27f2433e52c44bfa9273d7800 /llvm/lib/IR
parentd54bb5c192d1b42a0390f220f18d5fe169927cb5 (diff)
downloadbcm5719-llvm-efb0d65ed7a497dce00fb6d171f5fd645d554192.tar.gz
bcm5719-llvm-efb0d65ed7a497dce00fb6d171f5fd645d554192.zip
Debug info: refactor the first field of DICompileUnit to be a raw file/directory pair
This removes the DICompileUnit special case from DIScope. llvm-svn: 177610
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp19
-rw-r--r--llvm/lib/IR/DebugInfo.cpp4
2 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 09d2e070783..63f7ba5df7c 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -71,6 +71,16 @@ static MDNode *getNonCompileUnitScope(MDNode *N) {
return N;
}
+static MDNode *createFilePathPair(LLVMContext &VMContext, StringRef Filename,
+ StringRef Directory) {
+ assert(!Filename.empty() && "Unable to create file without name");
+ Value *Pair[] = {
+ MDString::get(VMContext, Filename),
+ MDString::get(VMContext, Directory),
+ };
+ return MDNode::get(VMContext, Pair);
+}
+
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
@@ -93,7 +103,7 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_compile_unit),
- createFile(Filename, Directory),
+ createFilePathPair(VMContext, Filename, Directory),
ConstantInt::get(Type::getInt32Ty(VMContext), Lang),
MDString::get(VMContext, Producer),
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
@@ -115,14 +125,9 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
/// createFile - Create a file descriptor to hold debugging information
/// for a file.
DIFile DIBuilder::createFile(StringRef Filename, StringRef Directory) {
- assert(!Filename.empty() && "Unable to create file without name");
- Value *Pair[] = {
- MDString::get(VMContext, Filename),
- MDString::get(VMContext, Directory),
- };
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_file_type),
- MDNode::get(VMContext, Pair)
+ createFilePathPair(VMContext, Filename, Directory)
};
return DIFile(MDNode::get(VMContext, Elts));
}
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index e236e1877d5..701cf1fdd30 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -670,8 +670,6 @@ StringRef DIScope::getFilename() const {
return DILexicalBlock(DbgNode).getFilename();
if (isSubprogram())
return DISubprogram(DbgNode).getFilename();
- if (isCompileUnit())
- return DICompileUnit(DbgNode).getFilename();
return ::getStringField(getNodeField(DbgNode, 1), 0);
}
@@ -684,8 +682,6 @@ StringRef DIScope::getDirectory() const {
return DILexicalBlock(DbgNode).getDirectory();
if (isSubprogram())
return DISubprogram(DbgNode).getDirectory();
- if (isCompileUnit())
- return DICompileUnit(DbgNode).getDirectory();
return ::getStringField(getNodeField(DbgNode, 1), 1);
}
OpenPOWER on IntegriCloud