================ @@ -1986,13 +1984,15 @@ bool SourceManager::isInTheSameTranslationUnitImpl( if (isLoadedFileID(LOffs.first) != isLoadedFileID(ROffs.first)) return false; - // If both are loaded from different AST files. if (isLoadedFileID(LOffs.first) && isLoadedFileID(ROffs.first)) { - auto FindTableSegment = [this](FileID FID) { - return llvm::upper_bound(LoadedSLocEntryTableSegments, -FID.ID - 2); + auto FindSLocEntryAlloc = [this](FileID FID) { + // FileIDs are negative, we store the beginning of each allocation (the + // lowest FileID), later allocations have lower FileIDs. + return llvm::upper_bound(LoadedSLocEntryAllocBegin, FID, std::greater{}); ---------------- benlangmuir wrote:
I would have expected lower_bound; is this related to -2 vs -1? 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