================
@@ -1384,10 +1384,10 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, 
ASTContext &Context,
       SmallVector<FileEntryRef, 1> ModMaps(AdditionalModMaps->begin(),
                                            AdditionalModMaps->end());
       llvm::sort(ModMaps, [](FileEntryRef A, FileEntryRef B) {
-        return A.getName() < B.getName();
+        return A.getNameAsRequested() < B.getNameAsRequested();
       });
       for (FileEntryRef F : ModMaps)
-        AddPath(F.getName(), Record);
+        AddPath(F.getNameAsRequested(), Record);
----------------
jansvoboda11 wrote:

Yeah, this is a bit suspicious. This test started failing downstream after 
de85739ded2 and this change appeared to be required to fix things.

Turns out `llvm::SmallPtrSet<FileEntryRef, 1>` determines equality of elements 
based on the equality of their `void *` representation, not based on 
`FileEntryRef::operator==()`. This means that when we find the module map 
through a VFS, but serialize the on-disk path, we aren't able to correctly 
match them together in `ASTReader`.

I don't want to go messing with the `SmallPtrSet` implementation, so I'll 
probably just revert [D154905](https://reviews.llvm.org/D154905) (making the 
types unusable in `SmallPtrSet`) and switch from 
`llvm::SmallPtrSet<FileEntryRef, 1>` to  `llvm::DenseMap<FileEntryRef>`.

https://github.com/llvm/llvm-project/pull/68957
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to