diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-15 18:32:34 -0400 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-22 21:32:28 -0400 |
commit | 168db92465c504974274302a6a1a5d4a1580ccfe (patch) | |
tree | 5350768359d06854b577e0d3f74bdd8a5346e011 /clang/unittests/Basic/SourceManagerTest.cpp | |
parent | b6c6daa95d3aa2206d5a42b46793226f181c3e44 (diff) | |
download | llvm-168db92465c504974274302a6a1a5d4a1580ccfe.zip llvm-168db92465c504974274302a6a1a5d4a1580ccfe.tar.gz llvm-168db92465c504974274302a6a1a5d4a1580ccfe.tar.bz2 |
SourceManager: Change SourceManager::isMainFile to take a FileEntry, NFC
`SourceManager::isMainFile` does not use the filename, so it doesn't
need the full `FileEntryRef`; in fact, it's misleading to take the name
because that makes it look relevant. Simplify the API, and in the
process remove some calls to `FileEntryRef::FileEntryRef` in the unit
tests (which were blocking making that private to `SourceManager`).
Differential Revision: https://reviews.llvm.org/D89507
Diffstat (limited to 'clang/unittests/Basic/SourceManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/SourceManagerTest.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp index 5fd7607f..dadfcc9 100644 --- a/clang/unittests/Basic/SourceManagerTest.cpp +++ b/clang/unittests/Basic/SourceManagerTest.cpp @@ -509,10 +509,9 @@ TEST_F(SourceManagerTest, isMainFile) { FileID MainFileID = SourceMgr.getOrCreateFileID(SourceFile, SrcMgr::C_User); SourceMgr.setMainFileID(MainFileID); - EXPECT_TRUE(SourceMgr.isMainFile(FileEntryRef("mainFile.cpp", *SourceFile))); - EXPECT_TRUE( - SourceMgr.isMainFile(FileEntryRef("anotherName.cpp", *SourceFile))); - EXPECT_FALSE(SourceMgr.isMainFile(FileEntryRef("mainFile.cpp", *SecondFile))); + EXPECT_TRUE(SourceMgr.isMainFile(*SourceFile)); + EXPECT_TRUE(SourceMgr.isMainFile(*SourceFile)); + EXPECT_FALSE(SourceMgr.isMainFile(*SecondFile)); } #endif |