From d014f5d2a0c20d4e08eb0f5c2b609b874add322b Mon Sep 17 00:00:00 2001 From: Riatre Foo Date: Tue, 9 Oct 2018 22:02:37 +0800 Subject: [PATCH] Updated compile_commands.json (markdown) --- compile_commands.json.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compile_commands.json.md b/compile_commands.json.md index 529ec7b..bd35a95 100644 --- a/compile_commands.json.md +++ b/compile_commands.json.md @@ -8,6 +8,12 @@ % ln -s build/compile_commands.json ``` +Caveat on Windows: CMake dumps Windows shell command line directly into `command`, depends on how ccls was built, it may confuse this field as command line from a POSIX shell, in which Windows path separator '\\' is a escape character. You can use jq to convert such entries to use `arguments` which does not have this issue: + +```sh +jq '[.[] | {directory: .directory, file: .file, arguments: .command | split(" ") | map(select(length > 0)) | map(sub("\\\\\""; "\""; "g"))}]' < compile_commands.json +``` + ### [Build EAR](https://github.com/rizsotto/Bear) Bear is a tool that generates a compilation database for clang tooling. It can be used for any project based on `Makefile`.