Open llvmbot opened 6 years ago
The clang that I am using is an unpatched version of clang-6.0.0 build using mingw64. I lost the exact build configuration. The GCC used for building is GCC-6.3.0-1 packaged by mingw64. You find a log of simple demo project in the attachements that shows that clang strips the backslashes from the path and cannot read the compile_commands.json because of this (build directory was located under p:/dev/test). The project directory including all generated files are also attached.
Please specify what you want to know exactly if this specification is too vague and I will try to answer your questions.
Also I am leaving my company until Jan. 26 so we might want to close the ticket if the bug is unclear and no one else has the problem.
The build tree from which the log was taken A build tree with a hello world program and a simple CMakeLists.txt to create a compile_commands.json file. I needed to strip all executables and binaries from the tree to pass our firewall.
Build log showing the bug A build log showing the bug. clang-tidy cannot open the source code files because it strips all the backslashes from the path.
Please provide detailed steps to reproduce this in case someone wants to tackle this. It's not clear yet where the problem is. At least, it seems that both CMake and LLVM's YAMLParser support escaped backslashes and double quotes.
Hi Tim,
thank you for reporting the bug!
I believe Daniel did write the parsing parts for the compilation part (at least he is in the blame there). He is already in the mail-CC.
+Daniel Jasper
All the best, Jonas
Extended Description
I created a build of LLVM 6.0.0 including clang and clang-tools-extra. The build was created under Windows using mingw64. CMake produces compilation databases with backslashes as a path separator under Windows. When clang-tidy parses compilation databases from CMake any path separators are stripped and clang-tidy can not find the files specified.
Using GNU sed to replace all pairs of backslashes with a single forward slash resolves the problem and clang-tidy works as expected.
I do not know whether this is real bug probably passing the wrong ::clang::tooling::JSONCommandLineSyntax or it is a problem with build scripts not detecting the correct platform. But simply skipping backslashes in JSON format is not valid for a compliant JSON parser to my understanding.