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
This commit is contained in:
Alex Light
2018-10-02 11:19:46 -07:00
parent ecdcb52270
commit 0c7cc1caa1

View File

@@ -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
}