summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/ClangFormat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/clang-format/ClangFormat.cpp')
-rw-r--r--clang/tools/clang-format/ClangFormat.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index 60a7feb7119..c0c8dc0e2c7 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -117,7 +117,8 @@ static FileID createInMemoryFile(StringRef FileName, MemoryBuffer *Source,
SourceManager &Sources, FileManager &Files,
llvm::vfs::InMemoryFileSystem *MemFS) {
MemFS->addFileNoOwn(FileName, 0, Source);
- return Sources.createFileID(Files.getFile(FileName), SourceLocation(),
+ auto File = Files.getFile(FileName);
+ return Sources.createFileID(File ? *File : nullptr, SourceLocation(),
SrcMgr::C_User);
}
OpenPOWER on IntegriCloud