Scan deps tool crashes when called on a C++ file, containing an include
that has the same name as a directory. For example:
test.cpp:
#include <dir>
int main() { return 0; }
In directory foo/ :
dir/ bar/dir(file)
Now if the compile command is:
clang++ -I foo/ -I foo/bar/ -c test.cpp
The tool crashes since it finds foo/dir and tries to read that as a file and fails.
In this change, I add a defence against that scenario in the Dependency Scanning
File system.
This change dropped the createFile call, and didn't fix the issue where the same could happen at the end of the function. Could you please perform this check and return inside of createFile instead? This would ensure that both uses are fixed.