summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-12 21:36:12 +0800
committerGitHub <[email protected]>2021-07-12 21:36:12 +0800
commit6947f79ae1d345849789934501933e9edb8c1f07 (patch)
tree3f8f3fa7014f2ddcad48816803426370d32edba9
parent8529c642e58d116a9dc01c6d0935d503639148ac (diff)
parent9b80e00fcf444c52a1afe25be9aa8be0a1fc6084 (diff)
Merge pull request #1508 from Nats-ji/master
fix double quote escape for defines in compile_commands.json
-rw-r--r--xmake/plugins/project/clang/compile_commands.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua
index 59e4fcaa5..eb30a1ee4 100644
--- a/xmake/plugins/project/clang/compile_commands.lua
+++ b/xmake/plugins/project/clang/compile_commands.lua
@@ -42,6 +42,10 @@ function _translate_arguments(arguments)
arg = arg:gsub("[%-/]external:I", "-I")
elseif arg:find("[%-/]external:W") or arg:find("[%-/]experimental:external") then
arg = nil
+ -- escape '"' for the defines
+ -- https://github.com/xmake-io/xmake/issues/1506
+ elseif arg:find("^-D") then
+ arg = arg:gsub("\"", "\\\"")
end
-- @see use msvc-style flags for msvc to support language-server better
-- https://github.com/xmake-io/xmake/issues/1284