diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-07-19 00:09:54 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-07-19 00:09:54 +0000 |
commit | d63bfd218b67a9a33f16c6a7317f56c833826e62 (patch) | |
tree | 557a5d7870d98b40127f7e65bb47c33560fdfa8b /llvm/unittests/IR/IRBuilderTest.cpp | |
parent | 9a1a1aa2adf1f385adf8b15689808d8a73fc44ec (diff) | |
download | bcm5719-llvm-d63bfd218b67a9a33f16c6a7317f56c833826e62.tar.gz bcm5719-llvm-d63bfd218b67a9a33f16c6a7317f56c833826e62.zip |
Debug Info: Add a file: field to DIImportedEntity.
DIImportedEntity has a line number, but not a file field. To determine
the decl_line/decl_file we combine the line number from the
DIImportedEntity with the file from the DIImportedEntity's scope. This
does not work correctly when the parent scope is a DINamespace or a
DIModule, both of which do not have a source file.
This patch adds a file field to DIImportedEntity to unambiguously
identify the source location of the using/import declaration. Most
testcase updates are mechanical, the interesting one is the removal of
the FIXME in test/DebugInfo/Generic/namespace.ll.
This fixes PR33822. See https://bugs.llvm.org/show_bug.cgi?id=33822
for more context.
<rdar://problem/33357889>
https://bugs.llvm.org/show_bug.cgi?id=33822
Differential Revision: https://reviews.llvm.org/D35583
llvm-svn: 308398
Diffstat (limited to 'llvm/unittests/IR/IRBuilderTest.cpp')
-rw-r--r-- | llvm/unittests/IR/IRBuilderTest.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index 186330f1057..d361107cc0d 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -463,13 +463,14 @@ TEST_F(IRBuilderTest, DebugLoc) { TEST_F(IRBuilderTest, DIImportedEntity) { IRBuilder<> Builder(BB); DIBuilder DIB(*M); + auto F = DIB.createFile("F.CBL", "/"); auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, - DIB.createFile("F.CBL", "/"), "llvm-cobol74", + F, "llvm-cobol74", true, "", 0); - DIB.createImportedDeclaration(CU, nullptr, 1); - DIB.createImportedDeclaration(CU, nullptr, 1); - DIB.createImportedModule(CU, (DIImportedEntity *)nullptr, 2); - DIB.createImportedModule(CU, (DIImportedEntity *)nullptr, 2); + DIB.createImportedDeclaration(CU, nullptr, F, 1); + DIB.createImportedDeclaration(CU, nullptr, F, 1); + DIB.createImportedModule(CU, (DIImportedEntity *)nullptr, F, 2); + DIB.createImportedModule(CU, (DIImportedEntity *)nullptr, F, 2); DIB.finalize(); EXPECT_TRUE(verifyModule(*M)); EXPECT_TRUE(CU->getImportedEntities().size() == 2); |