summarylogtreecommitdiffstats
path: root/swift-init-CachedVFile.patch
blob: 37e38edee65c203eb31f8b88c8befe8f169fa372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 09cbffb3e4ed5c4ef8069d273e2d34309abcd2e4 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah@apple.com>
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<const char *, VirtualFile> VirtualFiles;
-  mutable std::pair<const char *, const VirtualFile*> CachedVFile = {};
+  mutable std::pair<const char *, const VirtualFile*> 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(),