[llvm-branch-commits] [clang] 2ea8c69 - Tooling: Migrate to FileEntryRef in clang::tooling::applyAllReplacements, NFC

Duncan P. N. Exon Smith via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 9 16:36:41 PST 2020


Author: Duncan P. N. Exon Smith
Date: 2020-12-09T16:31:38-08:00
New Revision: 2ea8c69eff07c491c7cb14dd46afd30529b89d91

URL: https://github.com/llvm/llvm-project/commit/2ea8c69eff07c491c7cb14dd46afd30529b89d91
DIFF: https://github.com/llvm/llvm-project/commit/2ea8c69eff07c491c7cb14dd46afd30529b89d91.diff

LOG: Tooling: Migrate to FileEntryRef in clang::tooling::applyAllReplacements, NFC

Migrate to the `FileEntryRef` overload of `SourceManager::createFileID`.

Added: 
    

Modified: 
    clang/lib/Tooling/Core/Replacement.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/Core/Replacement.cpp b/clang/lib/Tooling/Core/Replacement.cpp
index ab8e20539559..30e1923bf1cb 100644
--- a/clang/lib/Tooling/Core/Replacement.cpp
+++ b/clang/lib/Tooling/Core/Replacement.cpp
@@ -591,7 +591,7 @@ llvm::Expected<std::string> applyAllReplacements(StringRef Code,
   Rewriter Rewrite(SourceMgr, LangOptions());
   InMemoryFileSystem->addFile(
       "<stdin>", 0, llvm::MemoryBuffer::getMemBuffer(Code, "<stdin>"));
-  FileID ID = SourceMgr.createFileID(*Files.getFile("<stdin>"),
+  FileID ID = SourceMgr.createFileID(*Files.getOptionalFileRef("<stdin>"),
                                      SourceLocation(),
                                      clang::SrcMgr::C_User);
   for (auto I = Replaces.rbegin(), E = Replaces.rend(); I != E; ++I) {


        


More information about the llvm-branch-commits mailing list