[llvm-branch-commits] [clang] 494aacd - Tooling: Migrate some tests to FileEntryRef, NFC

Duncan P. N. Exon Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 10 18:09:16 PST 2020


Author: Duncan P. N. Exon Smith
Date: 2020-12-10T18:05:03-08:00
New Revision: 494aacd72c6a85a6d586fa58a8481e13b68acf24

URL: https://github.com/llvm/llvm-project/commit/494aacd72c6a85a6d586fa58a8481e13b68acf24
DIFF: https://github.com/llvm/llvm-project/commit/494aacd72c6a85a6d586fa58a8481e13b68acf24.diff

LOG: Tooling: Migrate some tests to FileEntryRef, NFC

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp
index 97a26a71deec..d239aba31d1d 100644
--- a/clang/unittests/Tooling/RefactoringTest.cpp
+++ b/clang/unittests/Tooling/RefactoringTest.cpp
@@ -608,7 +608,7 @@ class FlushRewrittenFilesTest : public ::testing::Test {
     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 =

diff  --git a/clang/unittests/Tooling/RewriterTestContext.h b/clang/unittests/Tooling/RewriterTestContext.h
index ae2d2baa0fdc..a618ebd3a865 100644
--- a/clang/unittests/Tooling/RewriterTestContext.h
+++ b/clang/unittests/Tooling/RewriterTestContext.h
@@ -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 =


        


More information about the llvm-branch-commits mailing list