From 09cbffb3e4ed5c4ef8069d273e2d34309abcd2e4 Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Fri, 14 Oct 2016 15:29:18 -0700 Subject: [PATCH] Initialize CachedVFile with nullptr --- include/swift/Basic/SourceManager.h | 2 +- lib/Basic/SourceLoc.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/swift/Basic/SourceManager.h b/include/swift/Basic/SourceManager.h index 1072b8b..e5149f1 100644 --- a/include/swift/Basic/SourceManager.h +++ b/include/swift/Basic/SourceManager.h @@ -40,7 +40,7 @@ class SourceManager { int LineOffset; }; std::map VirtualFiles; - mutable std::pair CachedVFile = {}; + mutable std::pair CachedVFile = {nullptr, nullptr}; public: llvm::SourceMgr &getLLVMSourceMgr() { diff --git a/lib/Basic/SourceLoc.cpp b/lib/Basic/SourceLoc.cpp index 9bc484c..b6e0873 100644 --- a/lib/Basic/SourceLoc.cpp +++ b/lib/Basic/SourceLoc.cpp @@ -82,7 +82,7 @@ bool SourceManager::openVirtualFile(SourceLoc loc, StringRef name, CharSourceRange range = CharSourceRange(*this, loc, end); VirtualFiles[end.Value.getPointer()] = { range, name, lineOffset }; - CachedVFile = {}; + CachedVFile = {nullptr, nullptr}; return true; } @@ -99,7 +99,7 @@ void SourceManager::closeVirtualFile(SourceLoc end) { #endif return; } - CachedVFile = {}; + CachedVFile = {nullptr, nullptr}; CharSourceRange oldRange = virtualFile->Range; virtualFile->Range = CharSourceRange(*this, virtualFile->Range.getStart(),