================ @@ -226,9 +247,28 @@ class DependencyScanningFilesystemLocalCache { insertEntryForFilename(StringRef Filename, const CachedFileSystemEntry &Entry) { assert(llvm::sys::path::is_absolute_gnu(Filename)); - const auto *InsertedEntry = Cache.insert({Filename, &Entry}).first->second; - assert(InsertedEntry == &Entry && "entry already present"); - return *InsertedEntry; + assert(Cache[Filename].first == nullptr && "entry already present"); + Cache[Filename].first = &Entry; + return Entry; ---------------- benlangmuir wrote:
Nit: I think the original way this was written is slightly better, because in a no-asserts build if this is ever hit, it returns the entry that's actually in the map and in an asserts build it is cheaper to only lookup in the map once instead of twice. I would just keep the old way but insert a pair(&Entry, nullptr) https://github.com/llvm/llvm-project/pull/68645 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits