dexonsmith added inline comments.

================
Comment at: clang/include/clang/Basic/FileEntry.h:332-334
+  FileEntry();
+  FileEntry(const FileEntry &) = delete;
+  FileEntry &operator=(const FileEntry &) = delete;
----------------
Aha, now I understand why you needed a factory in the FileEntryTest: because 
you made the constructor private.

Instead, can we add an initializing constructor to `FileEntry`? It'd be fine 
for that to be public; it seems implausible for someone to misuse it.


================
Comment at: clang/lib/Basic/FileManager.cpp:422-462
   if (!getStatValue(InterndFileName, Status, true, nullptr)) {
     Status = llvm::vfs::Status(
       Status.getName(), Status.getUniqueID(),
       llvm::sys::toTimePoint(ModificationTime),
       Status.getUser(), Status.getGroup(), Size,
       Status.getType(), Status.getPermissions());
 
----------------
This dance'll be a bit different if there's an initializing constructor, but 
maybe it'd be cleaner anyway:
```
lang=c++
FileEntry **Slot = nullptr;
if (!getStat...) {
  Status = ...; // and update name in Status with fillRealPathName()
  Slot = &UniqueRealFiles[Status.getUniqueID()];
  if (*Slot) return early;
} else {
  Status = ...;
  VirtualFileEntries.push_back(nullptr);
  Slot = &VirtualFileEntries.back();
}
UFE = *Slot = new (FilesAlloc.Allocate()) FileEntry(Status, Dir, NextFileUID++);
NamedFileEnt.second = FileEntryRef::MapValue(*UFE, *DirInfo);
UFE->LastRef = UFE;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123197/new/

https://reviews.llvm.org/D123197

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to