[clang] 2793ef6 - [clang] NFCI: Use `FileEntryRef` in `SrcMgr::ContentCache`
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 13 13:55:38 PDT 2023
Author: Jan Svoboda
Date: 2023-09-13T13:55:32-07:00
New Revision: 2793ef6797a406abf983139b2a18b30a9e277687
URL: https://github.com/llvm/llvm-project/commit/2793ef6797a406abf983139b2a18b30a9e277687
DIFF: https://github.com/llvm/llvm-project/commit/2793ef6797a406abf983139b2a18b30a9e277687.diff
LOG: [clang] NFCI: Use `FileEntryRef` in `SrcMgr::ContentCache`
Added:
Modified:
clang/include/clang/Basic/SourceManager.h
clang/lib/Basic/SourceManager.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index 48c6b6611219af9..2f846502d6f3327 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -148,7 +148,7 @@ class alignas(8) ContentCache {
///
/// Can be
diff erent from 'Entry' if we overridden the contents of one file
/// with the contents of another file.
- const FileEntry *ContentsEntry;
+ OptionalFileEntryRef ContentsEntry;
/// The filename that is used to access OrigEntry.
///
@@ -180,13 +180,13 @@ class alignas(8) ContentCache {
mutable unsigned IsBufferInvalid : 1;
ContentCache()
- : OrigEntry(std::nullopt), ContentsEntry(nullptr),
+ : OrigEntry(std::nullopt), ContentsEntry(std::nullopt),
BufferOverridden(false), IsFileVolatile(false), IsTransient(false),
IsBufferInvalid(false) {}
ContentCache(FileEntryRef Ent) : ContentCache(Ent, Ent) {}
- ContentCache(FileEntryRef Ent, const FileEntry *contentEnt)
+ ContentCache(FileEntryRef Ent, FileEntryRef contentEnt)
: OrigEntry(Ent), ContentsEntry(contentEnt), BufferOverridden(false),
IsFileVolatile(false), IsTransient(false), IsBufferInvalid(false) {}
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index b8a9fb7fc16f7a1..0521ac7b30339ab 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -114,7 +114,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
// return paths.
IsBufferInvalid = true;
- auto BufferOrError = FM.getBufferForFile(ContentsEntry, IsFileVolatile);
+ auto BufferOrError = FM.getBufferForFile(*ContentsEntry, IsFileVolatile);
// If we were unable to open the file, then we are in an inconsistent
// situation where the content cache referenced a file which no longer
More information about the cfe-commits
mailing list