summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chih-hung Hsieh <chh@google.com> 2022-02-08 22:13:47 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2022-02-08 22:13:47 +0000
commitdef9bf2c1c22e662bec5d0a378b281aa265a1f2c (patch)
tree2ab0c8e55e8109a4dedee01ec0e1df8fc035ebb3
parent3e7f5c411dfed43cb08f7b4a4c0d5220cdcd3c8c (diff)
parent63d59eb77c1a23edabd6e0e92ccefc13f8287be6 (diff)
Merge "Use only single dash for tidy flags"
-rw-r--r--cc/tidy.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cc/tidy.go b/cc/tidy.go
index 1f5f56d5b..750e9de1e 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -102,6 +102,12 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
}
flags.TidyFlags = append(flags.TidyFlags, headerFilter)
}
+ // Work around RBE bug in parsing clang-tidy flags, replace "--flag" with "-flag".
+ // Some C/C++ modules added local tidy flags like --header-filter= and --extra-arg-before=.
+ doubleDash := regexp.MustCompile("^('?)--(.*)$")
+ for i, s := range flags.TidyFlags {
+ flags.TidyFlags[i] = doubleDash.ReplaceAllString(s, "$1-$2")
+ }
// If clang-tidy is not enabled globally, add the -quiet flag.
if !ctx.Config().ClangTidy() {