================
@@ -230,6 +251,26 @@ class DependencyScanningFilesystemLocalCache {
     assert(InsertedEntry == &Entry && "entry already present");
     return *InsertedEntry;
   }
+
+  /// Returns real path associated with the filename or nullptr if none is
+  /// found.
+  const CachedRealPath *findRealPathByFilename(StringRef Filename) const {
+    assert(llvm::sys::path::is_absolute_gnu(Filename));
+    auto It = RealPathCache.find(Filename);
+    return It == RealPathCache.end() ? nullptr : It->getValue();
+  }
+
+  /// Associates the given real path with the filename and returns the given
+  /// entry pointer (for convenience).
+  const CachedRealPath &
+  insertRealPathForFilename(StringRef Filename,
+                            const CachedRealPath &RealPath) {
----------------
jansvoboda11 wrote:

I see your point. I used a reference here to be consistent with existing code 
in this file. I think the original motivation for using references was the 
"non-null pointer" aspect of it. I tried converting all uses of `const 
CachedFileSystemEntry &` in the existing code to pointers, but that's 
impossible to understand. Doing that just for arguments to insert-like 
functions is a bit better, but I'm not sure it's clear win in 
readability/understandability.

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

Reply via email to