Tooling: Migrate some tests to FileEntryRef, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 9 Dec 2020 21:32:47 +0000 (13:32 -0800)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 11 Dec 2020 02:05:03 +0000 (18:05 -0800)
Migrate to the `FileEntryRef` overload of `SourceManager::createFileID`
(using `FileManager::getOptionalFileRef`) in RefactoringTest.cpp and
RewriterTestContext.h.

No functionality change.

Differential Revision: https://reviews.llvm.org/D92967

clang/unittests/Tooling/RefactoringTest.cpp
clang/unittests/Tooling/RewriterTestContext.h

index 97a26a7..d239aba 100644 (file)
@@ -608,7 +608,7 @@ public:
     llvm::raw_fd_ostream OutStream(FD, true);
     OutStream << Content;
     OutStream.close();
-    auto File = Context.Files.getFile(Path);
+    auto File = Context.Files.getOptionalFileRef(Path);
     assert(File);
 
     StringRef Found =
index ae2d2ba..a618ebd 100644 (file)
@@ -70,7 +70,7 @@ class RewriterTestContext {
         llvm::MemoryBuffer::getMemBuffer(Content);
     InMemoryFileSystem->addFile(Name, 0, std::move(Source));
 
-    auto Entry = Files.getFile(Name);
+    auto Entry = Files.getOptionalFileRef(Name);
     assert(Entry);
     return Sources.createFileID(*Entry, SourceLocation(), SrcMgr::C_User);
   }
@@ -87,7 +87,7 @@ class RewriterTestContext {
     llvm::raw_fd_ostream OutStream(FD, true);
     OutStream << Content;
     OutStream.close();
-    auto File = Files.getFile(Path);
+    auto File = Files.getOptionalFileRef(Path);
     assert(File);
 
     StringRef Found =