aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/DIBuilder.cpp
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
commit00c5c5d46731834caa0ca3280e0dcc43202dd3c8 (patch)
treef9caa56b0626bd8549f353361e4bd052a62ba7fb /lib/IR/DIBuilder.cpp
parent2adf8ccbf0611df6393c30737d87faaf38cdcd0c (diff)
Debug info: refactor the first field of DICompileUnit to be a raw file/directory pair
This removes the DICompileUnit special case from DIScope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177610 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DIBuilder.cpp')
-rw-r--r--lib/IR/DIBuilder.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index 09d2e07078..63f7ba5df7 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/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));
}