diff options
author | David Blaikie <dblaikie@gmail.com> | 2013-05-20 22:50:35 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2013-05-20 22:50:35 +0000 |
commit | 7b72cc7782716f469eb1b0963423a5b414215705 (patch) | |
tree | b18df12eeda228fd007724f791d0ada10e989083 /lib/IR/DIBuilder.cpp | |
parent | ff2515ef2cb17f32b8a68f6b8b9719365f068295 (diff) | |
download | external_llvm-7b72cc7782716f469eb1b0963423a5b414215705.zip external_llvm-7b72cc7782716f469eb1b0963423a5b414215705.tar.gz external_llvm-7b72cc7782716f469eb1b0963423a5b414215705.tar.bz2 |
PR14606: Debug Info for namespace aliases/DW_TAG_imported_module
This resolves the last of the PR14606 failures in the GDB 7.5 test
suite by implementing an optional name field for
DW_TAG_imported_modules/DIImportedEntities and using that to implement
C++ namespace aliases (eg: "namespace X = Y;").
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/DIBuilder.cpp')
-rw-r--r-- | lib/IR/DIBuilder.cpp | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 4bb87c9..1c79945 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -128,21 +128,50 @@ void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename, NMD->addOperand(TheCU); } -DIImportedEntity 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), - }; - DIImportedEntity M(MDNode::get(VMContext, Elts)); +static DIImportedEntity +createImportedModule(LLVMContext &C, DIScope Context, DIDescriptor NS, + unsigned Line, StringRef Name, + SmallVectorImpl<Value *> &AllImportedModules) { + const MDNode *R; + if (Name.empty()) { + Value *Elts[] = { + GetTagConstant(C, dwarf::DW_TAG_imported_module), + Context, + NS, + ConstantInt::get(Type::getInt32Ty(C), Line), + }; + R = MDNode::get(C, Elts); + } else { + Value *Elts[] = { + GetTagConstant(C, dwarf::DW_TAG_imported_module), + Context, + NS, + ConstantInt::get(Type::getInt32Ty(C), Line), + MDString::get(C, Name) + }; + R = MDNode::get(C, Elts); + } + DIImportedEntity M(R); assert(M.Verify() && "Imported module should be valid"); AllImportedModules.push_back(M); return M; } +DIImportedEntity DIBuilder::createImportedModule(DIScope Context, + DINameSpace NS, unsigned Line, + StringRef Name) { + return ::createImportedModule(VMContext, Context, NS, Line, Name, + AllImportedModules); +} + +DIImportedEntity DIBuilder::createImportedModule(DIScope Context, + DIImportedEntity NS, + unsigned Line, + StringRef Name) { + return ::createImportedModule(VMContext, Context, NS, Line, Name, + AllImportedModules); +} + DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context, DIDescriptor Decl, unsigned Line) { |