summaryrefslogtreecommitdiff
path: root/unittests/IR
diff options
context:
space:
mode:
authorScott Linder <scott@scottlinder.com>2018-02-23 23:01:06 +0000
committerScott Linder <scott@scottlinder.com>2018-02-23 23:01:06 +0000
commit5e4b515c4bb332df9c3a063e888f9124a1cd0965 (patch)
treea0d87835c338da5ffc054324ff431e31fa4351ce /unittests/IR
parentf021d3eee1afac9bcdd253b2d475465426c2670e (diff)
[DebugInfo] Support DWARF v5 source code embedding extension
In DWARF v5 the Line Number Program Header is extensible, allowing values with new content types. In this extension a content type is added, DW_LNCT_LLVM_source, which contains the embedded source code of the file. Add new optional attribute for !DIFile IR metadata called source which contains source text. Use this to output the source to the DWARF line table of code objects. Analogously extend METADATA_FILE in Bitcode and .file directive in ASM to support optional source. Teach llvm-dwarfdump and llvm-objdump about the new values. Update the output format of llvm-dwarfdump to make room for the new attribute on file_names entries, and support embedded sources for the -source option in llvm-objdump. Differential Revision: https://reviews.llvm.org/D42765 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR')
-rw-r--r--unittests/IR/MetadataTest.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp
index a039b1ee60d..c400ddc95fb 100644
--- a/unittests/IR/MetadataTest.cpp
+++ b/unittests/IR/MetadataTest.cpp
@@ -1450,19 +1450,24 @@ TEST_F(DIFileTest, get) {
DIFile::ChecksumKind CSKind = DIFile::ChecksumKind::CSK_MD5;
StringRef ChecksumString = "000102030405060708090a0b0c0d0e0f";
DIFile::ChecksumInfo<StringRef> Checksum(CSKind, ChecksumString);
- auto *N = DIFile::get(Context, Filename, Directory, Checksum);
+ StringRef Source = "source";
+ auto *N = DIFile::get(Context, Filename, Directory, Checksum, Source);
EXPECT_EQ(dwarf::DW_TAG_file_type, N->getTag());
EXPECT_EQ(Filename, N->getFilename());
EXPECT_EQ(Directory, N->getDirectory());
EXPECT_EQ(Checksum, N->getChecksum());
- EXPECT_EQ(N, DIFile::get(Context, Filename, Directory, Checksum));
+ EXPECT_EQ(Source, N->getSource());
+ EXPECT_EQ(N, DIFile::get(Context, Filename, Directory, Checksum, Source));
- EXPECT_NE(N, DIFile::get(Context, "other", Directory, Checksum));
- EXPECT_NE(N, DIFile::get(Context, Filename, "other", Checksum));
+ EXPECT_NE(N, DIFile::get(Context, "other", Directory, Checksum, Source));
+ EXPECT_NE(N, DIFile::get(Context, Filename, "other", Checksum, Source));
DIFile::ChecksumInfo<StringRef> OtherChecksum(DIFile::ChecksumKind::CSK_SHA1, ChecksumString);
EXPECT_NE(
N, DIFile::get(Context, Filename, Directory, OtherChecksum));
+ StringRef OtherSource = "other";
+ EXPECT_NE(N, DIFile::get(Context, Filename, Directory, Checksum, OtherSource));
+ EXPECT_NE(N, DIFile::get(Context, Filename, Directory, Checksum));
EXPECT_NE(N, DIFile::get(Context, Filename, Directory));
TempDIFile Temp = N->clone();