================
@@ -257,27 +291,32 @@ 
DependencyScanningWorkerFilesystem::resolveUIDThroughSharedCache(
     std::lock_guard<std::mutex> ShardLock(UIDShard.CacheLock);
     auto &State = UIDShard.EntriesByUID[Stat.getUniqueID()];
     assert(!State.Entry && "UID slot already published an entry");
-    if (TEntry) {
-      CachedFileContents *StoredContents = nullptr;
-      if (TEntry->Contents)
-        StoredContents = new (UIDShard.ContentsStorage.Allocate())
-            CachedFileContents(std::move(TEntry->Contents));
-      SharedEntry = new (UIDShard.EntryStorage.Allocate())
-          CachedFileSystemEntry(std::move(TEntry->Status), StoredContents);
-    } else {
-      SharedEntry = new (UIDShard.EntryStorage.Allocate())
-          CachedFileSystemEntry(TEntry.getError());
-    }
+    SharedEntry = createSharedEntry(TEntry, UIDShard.ContentsStorage,
+                                    UIDShard.EntryStorage);
     State.Entry = SharedEntry;
     State.InProgress.reset();
   }
   UIDProducer->publish(SharedEntry);
   return SharedEntry;
 }
 
+const CachedFileSystemEntry *
+DependencyScanningWorkerFilesystem::createCachedFSEntryForLocal(
+    StringRef OriginalFilename, const llvm::vfs::Status &Stat) {
+  assert(LocalFS);
+  auto TEntry = Stat.isDirectory() ? TentativeEntry(Stat)
+                                   : readFile(OriginalFilename, *LocalFS);
+  return createSharedEntry(TEntry, LocalContentsStorage, LocalEntryStorage);
----------------
jansvoboda11 wrote:

It's a bit confusing that this function called `*ForLocal()` calls 
`createSharedEntry()`, which makes it sound almost like something global. WDYT 
about just calling this `createEntry()`?

https://github.com/llvm/llvm-project/pull/234393
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to