aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler_wrapper/android_config_test.go4
-rw-r--r--compiler_wrapper/command.go7
-rw-r--r--compiler_wrapper/testdata/android_golden/clang_path.json21
3 files changed, 31 insertions, 1 deletions
diff --git a/compiler_wrapper/android_config_test.go b/compiler_wrapper/android_config_test.go
index 6d51bfe9..4e2f1f5c 100644
--- a/compiler_wrapper/android_config_test.go
+++ b/compiler_wrapper/android_config_test.go
@@ -56,6 +56,10 @@ func createAndroidClangPathGoldenInputs(ctx *testContext) goldenFile {
Cmds: okResults,
},
{
+ WrapperCmd: newGoldenCmd(filepath.Join(ctx.tempDir, "clang-tidy"), mainCc),
+ Cmds: okResults,
+ },
+ {
WrapperCmd: newGoldenCmd(deepPath, mainCc),
Cmds: okResults,
},
diff --git a/compiler_wrapper/command.go b/compiler_wrapper/command.go
index 6c5beae1..26f85568 100644
--- a/compiler_wrapper/command.go
+++ b/compiler_wrapper/command.go
@@ -91,7 +91,12 @@ func getAbsCmdPath(env env, cmd *command) string {
func newCommandBuilder(env env, cfg *config, cmd *command) (*commandBuilder, error) {
basename := filepath.Base(cmd.Path)
- nameParts := strings.Split(basename, "-")
+ var nameParts []string
+ if basename == "clang-tidy" {
+ nameParts = []string{basename}
+ } else {
+ nameParts = strings.Split(basename, "-")
+ }
target := builderTarget{}
switch len(nameParts) {
case 1:
diff --git a/compiler_wrapper/testdata/android_golden/clang_path.json b/compiler_wrapper/testdata/android_golden/clang_path.json
index cab712b5..b784feb5 100644
--- a/compiler_wrapper/testdata/android_golden/clang_path.json
+++ b/compiler_wrapper/testdata/android_golden/clang_path.json
@@ -72,6 +72,27 @@
"wd": "/tmp/stable",
"wrapper": {
"cmd": {
+ "path": "/tmp/stable/clang-tidy",
+ "args": [
+ "main.cc"
+ ]
+ }
+ },
+ "cmds": [
+ {
+ "cmd": {
+ "path": "/tmp/stable/clang-tidy.real",
+ "args": [
+ "main.cc"
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "wd": "/tmp/stable",
+ "wrapper": {
+ "cmd": {
"path": "a/b/c/d/e/f/g/clang",
"args": [
"main.cc"