[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 16:16:19 PDT 2023


================
@@ -701,6 +701,10 @@ class SourceManager : public RefCountedBase<SourceManager> {
   /// use (-ID - 2).
   SmallVector<SrcMgr::SLocEntry, 0> LoadedSLocEntryTable;
 
+  /// For each allocation in LoadedSLocEntryTable, we keep the new size. This
+  /// can be used to determine whether two FileIDs come from the same AST file.
+  SmallVector<size_t, 0> LoadedSLocEntryTableSegments;
----------------
jansvoboda11 wrote:

Or this?

```c++
SmallVector<FileID, 0> LoadedSLocEntryTableSegments{
  FileID(-1),   // represents FileIDs from -10 to -2
  FileID(-10),  // represents FileIDs from -50 to -11
  FileID(-50)}; // represents FileIDs from -90 to -51

llvm::upper_bound(llvm::reverse(LoadedSLocEntryTableSegments), FID);
```

The stored `FileIDs` have pretty weird values, though...

https://github.com/llvm/llvm-project/pull/66962


More information about the cfe-commits mailing list