aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-04-22 06:12:31 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-04-22 06:12:31 +0000
commitc462db6d66e683fb837c03d661483106a869a407 (patch)
tree4f7288cfd2fa6a55021db2a5a0b2176740ee6edd /lib/IR/DIBuilder.cpp
parent80a1caa5cbe1980b861e944533e6d27f6d7e43a6 (diff)
downloadexternal_llvm-c462db6d66e683fb837c03d661483106a869a407.zip
external_llvm-c462db6d66e683fb837c03d661483106a869a407.tar.gz
external_llvm-c462db6d66e683fb837c03d661483106a869a407.tar.bz2
Revert "Revert "PR14606: debug info imported_module support""
This reverts commit r179840 with a fix to test/DebugInfo/two-cus-from-same-file.ll I'm not sure why that test only failed on ARM & MIPS and not X86 Linux, even though the debug info was clearly invalid on all of them, but this ought to fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179996 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DIBuilder.cpp')
-rw-r--r--lib/IR/DIBuilder.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp
index ed9f98f..0980e80 100644
--- a/lib/IR/DIBuilder.cpp
+++ b/lib/IR/DIBuilder.cpp
@@ -61,6 +61,9 @@ void DIBuilder::finalize() {
DIArray GVs = getOrCreateArray(AllGVs);
DIType(TempGVs).replaceAllUsesWith(GVs);
+
+ DIArray IMs = getOrCreateArray(AllImportedModules);
+ DIType(TempImportedModules).replaceAllUsesWith(IMs);
}
/// getNonCompileUnitScope - If N is compile unit return NULL otherwise return
@@ -101,6 +104,8 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
TempGVs = MDNode::getTemporary(VMContext, TElts);
+ TempImportedModules = MDNode::getTemporary(VMContext, TElts);
+
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_compile_unit),
createFilePathPair(VMContext, Filename, Directory),
@@ -113,6 +118,7 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
TempRetainTypes,
TempSubprograms,
TempGVs,
+ TempImportedModules,
MDString::get(VMContext, SplitName)
};
TheCU = DICompileUnit(MDNode::get(VMContext, Elts));
@@ -122,6 +128,21 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
NMD->addOperand(TheCU);
}
+DIImportedModule DIBuilder::createImportedModule(DIScope Context,
+ DINameSpace NS,
+ unsigned Line) {
+ Value *Elts[] = {
+ GetTagConstant(VMContext, dwarf::DW_TAG_imported_module),
+ Context,
+ NS,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Line),
+ };
+ DIImportedModule M(MDNode::get(VMContext, Elts));
+ assert(M.Verify() && "Imported module should be valid");
+ AllImportedModules.push_back(M);
+ return M;
+}
+
/// createFile - Create a file descriptor to hold debugging information
/// for a file.
DIFile DIBuilder::createFile(StringRef Filename, StringRef Directory) {