[PATCH] D74488: [VFS] Fix vfsoverlay assertion due to RedirectingFileSystem path handling.

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 04:55:37 PST 2020


john.brawn added a comment.

I've attached a standalone example: F11337770: example.zip <https://reviews.llvm.org/F11337770>
This should be extracted to c:\work\example, and I see it hitting an assertion using clang-scan-deps built from commit 81cebfd0080e3873d0cef5ee5215b8c97332ff96 <https://reviews.llvm.org/rG81cebfd0080e3873d0cef5ee5215b8c97332ff96> using the command-line "clang-scan-deps.exe -compilation-database example.cdb"

I've done some debugging and the chain of events that leads to the assertion being hit is:

- getDirectoryFromFile (clang/lib/Basic/Filemanager.cpp) called with Filename=vfsoverlay_input.cpp
- That calls FileManager::getDirectory with DirName="."
- That calls FileManager::getDirectoryRef, which calls FileManager::getStatValue, which calls FileManager::FixupRelativePath
- FileManager::FixupRelativePath uses path::append to append "." onto the working directory and gets "C:/work/example\." because path::append uses the preferred native separator which is "\"
- Further down the call chain we end up in RedirectingFileSystem::lookupPath with a path of "C:/work/example\.", and the "\." isn't removed because canonicalize thinks "/" is the directory separator.
- path::begin uses the native path style, which on windows means both "/" and "\" are treated as directory separators, so we get the path components ["C:", "/", "work", "example", "."] and on the "." we hit the assertion failure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74488





More information about the llvm-commits mailing list