summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/IRBuilderTest.cpp
diff options
context:
space:
mode:
authorAmjad Aboud <amjad.aboud@intel.com>2016-03-13 11:11:39 +0000
committerAmjad Aboud <amjad.aboud@intel.com>2016-03-13 11:11:39 +0000
commit62f6f5cc80628d335728c6ba24a9c2d03e336d55 (patch)
tree76c0745f20c3c25b0d006cb3372c99754080adab /llvm/unittests/IR/IRBuilderTest.cpp
parent1256125fb73169b8a8a940bce05dd04622955edc (diff)
downloadbcm5719-llvm-62f6f5cc80628d335728c6ba24a9c2d03e336d55.tar.gz
bcm5719-llvm-62f6f5cc80628d335728c6ba24a9c2d03e336d55.zip
Fixed DIBuilder to verify that same imported entity will not be added twice to the "imports" list of the DICompileUnit.
Differential Revision: http://reviews.llvm.org/D17884 llvm-svn: 263379
Diffstat (limited to 'llvm/unittests/IR/IRBuilderTest.cpp')
-rw-r--r--llvm/unittests/IR/IRBuilderTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index bd0eae0399a..6e4e829122d 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -418,4 +418,19 @@ TEST_F(IRBuilderTest, DebugLoc) {
DIB.finalize();
}
+
+TEST_F(IRBuilderTest, DIImportedEntity) {
+ IRBuilder<> Builder(BB);
+ DIBuilder DIB(*M);
+ auto File = DIB.createFile("F.CBL", "/");
+ auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",
+ "llvm-cobol74", true, "", 0);
+ auto IE1 = DIB.createImportedDeclaration(CU, nullptr, 1);
+ auto IE2 = DIB.createImportedDeclaration(CU, nullptr, 1);
+ auto IE3 = DIB.createImportedModule(CU, (DIImportedEntity*)nullptr, 2);
+ auto IE4 = DIB.createImportedModule(CU, (DIImportedEntity*)nullptr, 2);
+ DIB.finalize();
+ EXPECT_TRUE(verifyModule(*M));
+ EXPECT_TRUE(CU->getImportedEntities().size() == 2);
+}
}
OpenPOWER on IntegriCloud