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

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 11:27:43 PDT 2016


rnk added a comment.

In https://reviews.llvm.org/D23455#515486, @brad.king wrote:

> > the feasibility of emitting 'arguments' instead of 'command' into the JSON compilation database.
>
>
> CMake constructs the command lines internally using string replacement on templates.  We never actually know the exact arguments.  Therefore providing arguments instead of the whole command would require parsing to be done on the CMake side instead.  This is theoretically possible because we do know the shell for which we are generating (Windows `cmd` versus MSYS `sh`).  However, it may also require a bunch of logic we don't have yet but that LLVM does.
>
> Alternatively, the JSON could have an additional `command_shell="..."` field that indicates the shell for which the command line is encoded.


Bummer. Given that this is hard to do in CMake, then I think we should just tokenize in Clang. Let's use llvm::sys::getProcessTriple() instead of LLVM_ON_WIN32 and check if that is an MSVC environment as a proxy for the shell type.


https://reviews.llvm.org/D23455





More information about the cfe-commits mailing list