Merge "Remove flags rejected by RBE input processor"

This commit is contained in:
Chih-hung Hsieh
2022-10-05 18:19:37 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -672,11 +672,16 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs
tidyCmd := "${config.ClangBin}/clang-tidy"
rule := clangTidy
reducedCFlags := moduleFlags
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CLANG_TIDY") {
rule = clangTidyRE
// b/248371171, work around RBE input processor problem
// some cflags rejected by input processor, but usually
// do not affect included files or clang-tidy
reducedCFlags = config.TidyReduceCFlags(reducedCFlags)
}
sharedCFlags := shareFlags("cFlags", moduleFlags)
sharedCFlags := shareFlags("cFlags", reducedCFlags)
srcRelPath := srcFile.Rel()
// Add the .tidy rule

View File

@@ -16,6 +16,7 @@ package config
import (
"android/soong/android"
"regexp"
"strings"
)
@@ -237,3 +238,11 @@ func TidyFlagsForSrcFile(srcFile android.Path, flags string) string {
}
return flags
}
var (
removedCFlags = regexp.MustCompile(" -fsanitize=[^ ]*memtag-[^ ]* ")
)
func TidyReduceCFlags(flags string) string {
return removedCFlags.ReplaceAllString(flags, " ")
}