From 0c7cc1caa1c88c945449238daa93e7f6c8b8bdb3 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 2 Oct 2018 11:19:46 -0700 Subject: [PATCH] Don't include empty-string arguments in compile_commands.json compdb.go was incorrectly splitting compiler arguments. This could cause empty strings to be included in compile_commands.json, potentially confusing tools. Bug: 117124308 Test: m checkbuild Test: m SOONG_GEN_COMPDB=1 \ SOONG_GEN_COMPDB_DEBUG=1 \ SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing Examine $ANDROID_BUILD_TOP/compile_commands.json Change-Id: I375baf255c50a1329cd644ac584d200aba9daa69 --- cc/compdb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cc/compdb.go b/cc/compdb.go index a9c5b5e9f..acfc924fd 100644 --- a/cc/compdb.go +++ b/cc/compdb.go @@ -181,7 +181,7 @@ func generateCompdbProject(compiledModule CompiledInterface, ctx android.Singlet func evalAndSplitVariable(ctx android.SingletonContext, str string) ([]string, error) { evaluated, err := ctx.Eval(pctx, str) if err == nil { - return strings.Split(evaluated, " "), nil + return strings.Fields(evaluated), nil } return []string{""}, err }