[llvm] [clang] Fix handling of adding a file with the same name as an existing dir to VFS (PR #94461)

kadir çetinkaya via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 21:55:40 PDT 2024


================
@@ -1138,6 +1138,8 @@ TEST_F(InMemoryFileSystemTest, DuplicatedFile) {
   ASSERT_FALSE(FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("a")));
   ASSERT_TRUE(FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("a")));
   ASSERT_FALSE(FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("b")));
+  ASSERT_TRUE(FS.addFile("/b/c/d", 0, MemoryBuffer::getMemBuffer("a")));
+  ASSERT_FALSE(FS.addFile("/b/c", 0, MemoryBuffer::getMemBuffer("a")));
----------------
kadircet wrote:

can you also have a test for inserting `/b/c` as a directory? i think we should `return true` in that case (similar to inserting an existing file with same contents).

https://github.com/llvm/llvm-project/pull/94461


More information about the llvm-commits mailing list