================ @@ -1911,18 +1911,22 @@ SourceManager::getDecomposedIncludedLoc(FileID FID) const { return DecompLoc; } -FileID SourceManager::getFirstFIDOfLoadedAST(SourceLocation Loc) const { +unsigned SourceManager::getUniqueLoadedASTID(SourceLocation Loc) const { assert(isLoadedSourceLocation(Loc) && "Must be a source location in a loaded PCH/Module file"); auto [FID, Ignore] = getDecomposedLoc(Loc); + // `LoadedSLocEntryAllocBegin` stores the sorted lowest FID of each loaded + // allocation. Later allocations have lower FileIDs. The call below is to find + // the lowest FID of a loaded allocation from any FID in the same allocation. + // The lowest FID is used to identify a loaded allocation. const FileID *FirstFID = llvm::lower_bound(LoadedSLocEntryAllocBegin, FID, std::greater<FileID>{}); assert(FirstFID && "The failure to find the first FileID of a " "loaded AST from a loaded source location was unexpected."); - return *FirstFID; + return FirstFID->getHashValue(); ---------------- haoNoQ wrote:
Hmm can we go back to returning `FileID` here? We really shouldn't rely on the fact that the _hash_ value is equal to the actual thing we're looking for. https://github.com/llvm/llvm-project/pull/92031 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits