diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-28 21:47:02 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-28 21:47:02 +0000 |
commit | 2c6a0a905c89e6e2d3a1335ac54d937c32cc53c1 (patch) | |
tree | e1b1bb05bd9c2bf1eeab6bca09788026219487b9 /llvm/unittests/IR/MetadataTest.cpp | |
parent | a951165e5a28718f129597602981a712fac32264 (diff) | |
download | bcm5719-llvm-2c6a0a905c89e6e2d3a1335ac54d937c32cc53c1.tar.gz bcm5719-llvm-2c6a0a905c89e6e2d3a1335ac54d937c32cc53c1.zip |
IR: Specialize MDScope::getFile() for MDFile
Fix `MDScope::getFile()` so that it correctly returns a valid `MDFile`
even when it's an instance of `MDFile`. This logic is necessary because
of r230057. I'm working on moving the new hierarchy into place
out-of-tree (on track to commit Monday morning, BTW), and this was
exposed by a few failing tests.
llvm-svn: 230871
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r-- | llvm/unittests/IR/MetadataTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index 6f2372d58cb..4de6ecc0f9b 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -1041,6 +1041,12 @@ TEST_F(MDFileTest, get) { EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp))); } +TEST_F(MDFileTest, ScopeGetFile) { + // Ensure that MDScope::getFile() returns itself. + MDScope *N = MDFile::get(Context, "file", "dir"); + EXPECT_EQ(N, N->getFile()); +} + typedef MetadataTest MDCompileUnitTest; TEST_F(MDCompileUnitTest, get) { |