aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/IR/DebugInfoTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/IR/DebugInfoTest.cpp')
-rw-r--r--llvm/unittests/IR/DebugInfoTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index 439c0d0..1930ecd 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -190,6 +190,24 @@ TEST(MetadataTest, DeleteInstUsedByDbgValue) {
EXPECT_TRUE(isa<UndefValue>(DVIs[0]->getValue(0)));
}
+TEST(DIBuiler, CreateFile) {
+ LLVMContext Ctx;
+ std::unique_ptr<Module> M(new Module("MyModule", Ctx));
+ DIBuilder DIB(*M);
+
+ DIFile *F = DIB.createFile("main.c", "/");
+ EXPECT_EQ(std::nullopt, F->getSource());
+
+ std::optional<DIFile::ChecksumInfo<StringRef>> Checksum = std::nullopt;
+ std::optional<StringRef> Source = std::nullopt;
+ F = DIB.createFile("main.c", "/", Checksum, Source);
+ EXPECT_EQ(Source, F->getSource());
+
+ Source = "";
+ F = DIB.createFile("main.c", "/", Checksum, Source);
+ EXPECT_EQ(Source, F->getSource());
+}
+
TEST(DIBuilder, CreateFortranArrayTypeWithAttributes) {
LLVMContext Ctx;
std::unique_ptr<Module> M(new Module("MyModule", Ctx));