================ @@ -458,14 +458,12 @@ SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, CurrentLoadedOffset - TotalSize < NextLocalOffset) { return std::make_pair(0, 0); } - - unsigned NewTableSize = LoadedSLocEntryTable.size() + NumSLocEntries; - LoadedSLocEntryTableSegments.push_back(NewTableSize); - LoadedSLocEntryTable.resize(NewTableSize); - SLocEntryLoaded.resize(NewTableSize); - + LoadedSLocEntryTable.resize(LoadedSLocEntryTable.size() + NumSLocEntries); + SLocEntryLoaded.resize(LoadedSLocEntryTable.size()); CurrentLoadedOffset -= TotalSize; - return std::make_pair(-NewTableSize - 1, CurrentLoadedOffset); + int ID = LoadedSLocEntryTable.size(); + LoadedSLocEntryAllocBegin.push_back(FileID::get(-ID - 2)); ---------------- jansvoboda11 wrote:
Yeah, I think the ID `AllocateLoadedSLocEntries()` returns is incorrect. It's stored in `ModuleFile::SLocEntryBaseID` and used in `ASTReader::TranslateFileID()` where we actually do `- 1` again (to get the correct `ID - 2`). I do want to fix this, but there are places in `ASTWriter` that rely on this being wrong, so it's a bit more involved to make it into this PR. https://github.com/llvm/llvm-project/pull/66962 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits