teemperor added a comment.

If I understand this correctly, then the inode caching logic in FileManager 
isn't just breaking PCMs but all file operations:

  TEST_F(FileManagerTest, InodeReuse) {
    {
      std::ofstream myfile;
      myfile.open("a.cpp");
      myfile << "content\n";
    }
    llvm::ErrorOr<const FileEntry*> fe1 = manager.getFile("a.cpp");
    EXPECT_TRUE(fe1);
    const FileEntry *f1 = *fe1;
    remove("a.cpp");
    {
      std::ofstream myfile;
      myfile.open("b.cpp");
      myfile << "different content\n";
    }
    llvm::ErrorOr<const FileEntry*> fe2 = manager.getFile("b.cpp");
    EXPECT_TRUE(fe2);
    const FileEntry *f2 = *fe2;
    EXPECT_NE(f2->getSize(), f1->getSize());
    EXPECT_NE(f2->getUniqueID().getFile(), f1->getUniqueID().getFile());
  }

This fails consistently for me when running in an empty ext4 directory with:

  Expected: (f2->getSize()) != (f1->getSize()), actual: 8 vs 8
  Expected: (f2->getUniqueID().getFile()) != (f1->getUniqueID().getFile()), 
actual: 57855544 vs 57855544

I guess this wasn't considered a valid use case for the normal `#include` logic 
within Clang (which I believe is the primary beneficiary of this cache and 
doesn't really care about a changing file system). But with PCMs and Clang 
REPLs this is probably causing some strange bugs.

Anyway, I don't think I know the FileManager code well enough to come up with a 
real fix (beside just removing the inode cache).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97850

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

Reply via email to