Skip to content

Commit 2793ef6

Browse files
committed
[clang] NFCI: Use FileEntryRef in SrcMgr::ContentCache
1 parent 3fb63c2 commit 2793ef6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/include/clang/Basic/SourceManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class alignas(8) ContentCache {
148148
///
149149
/// Can be different from 'Entry' if we overridden the contents of one file
150150
/// with the contents of another file.
151-
const FileEntry *ContentsEntry;
151+
OptionalFileEntryRef ContentsEntry;
152152

153153
/// The filename that is used to access OrigEntry.
154154
///
@@ -180,13 +180,13 @@ class alignas(8) ContentCache {
180180
mutable unsigned IsBufferInvalid : 1;
181181

182182
ContentCache()
183-
: OrigEntry(std::nullopt), ContentsEntry(nullptr),
183+
: OrigEntry(std::nullopt), ContentsEntry(std::nullopt),
184184
BufferOverridden(false), IsFileVolatile(false), IsTransient(false),
185185
IsBufferInvalid(false) {}
186186

187187
ContentCache(FileEntryRef Ent) : ContentCache(Ent, Ent) {}
188188

189-
ContentCache(FileEntryRef Ent, const FileEntry *contentEnt)
189+
ContentCache(FileEntryRef Ent, FileEntryRef contentEnt)
190190
: OrigEntry(Ent), ContentsEntry(contentEnt), BufferOverridden(false),
191191
IsFileVolatile(false), IsTransient(false), IsBufferInvalid(false) {}
192192

clang/lib/Basic/SourceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
114114
// return paths.
115115
IsBufferInvalid = true;
116116

117-
auto BufferOrError = FM.getBufferForFile(ContentsEntry, IsFileVolatile);
117+
auto BufferOrError = FM.getBufferForFile(*ContentsEntry, IsFileVolatile);
118118

119119
// If we were unable to open the file, then we are in an inconsistent
120120
// situation where the content cache referenced a file which no longer

0 commit comments

Comments
 (0)