[PATCH] D23455: [Tooling] Parse compilation database command lines properly on Windows

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 17 11:14:22 PDT 2016


rnk added a comment.

So, I actually went ahead and generated some MSYS makefiles and made a compile_commands.json, and it doesn't work with clang-tidy. You get this kind of output:

  [
  {
    "directory": "C:/src/test_proj",
    "command": "\"/C/Program Files/mingw-w64/x86_64-6.1.0-win32-seh-rt_v5-rev0/mingw64/bin/g++.exe\"    -Dsomething\\evil -o CMakeFiles/foo.dir/foo.obj -c /C/src/test_proj/foo.cpp",
    "file": "C:/src/test_proj/foo.cpp"
  }
  ]
  ...
  $ clang-tidy foo.cpp
  1 error generated.
  Error while processing C:\src\test_proj\foo.cpp.
  error: error reading '/C/src/test_proj/foo.cpp' [clang-diagnostic-error]

Hypothetically we could make this work, but there are bigger problems here. In that light, I think we should go with this patch. Long term, we should solve this problem by emitting "arguments" or "command_shell" in cmake.


https://reviews.llvm.org/D23455





More information about the cfe-commits mailing list