aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Tooling/Refactoring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Tooling/Refactoring.cpp')
-rw-r--r--lib/Tooling/Refactoring.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Tooling/Refactoring.cpp b/lib/Tooling/Refactoring.cpp
index f379a9c3bcf6..d45cd8c57f10 100644
--- a/lib/Tooling/Refactoring.cpp
+++ b/lib/Tooling/Refactoring.cpp
@@ -78,7 +78,10 @@ bool formatAndApplyAllReplacements(
const std::string &FilePath = FileAndReplaces.first;
auto &CurReplaces = FileAndReplaces.second;
- const FileEntry *Entry = Files.getFile(FilePath);
+ const FileEntry *Entry = nullptr;
+ if (auto File = Files.getFile(FilePath))
+ Entry = *File;
+
FileID ID = SM.getOrCreateFileID(Entry, SrcMgr::C_User);
StringRef Code = SM.getBufferData(ID);