Switch to clang-r407598 (12.0.1).
Also suppress a clang-tidy warning and a ubsan check to pass compilation.
Bug: 171348143
Test: build.
Change-Id: Ie5162c15df172cefd7cff9776e54531fd620bc23
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 0e2d01a..bb92a88 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -458,6 +458,22 @@
return false
}
+func toDisableUnsignedShiftBaseChange(flags []string) bool {
+ // Returns true if any flag is fsanitize*integer, and there is
+ // no explicit flag about sanitize=unsigned-shift-base.
+ for _, f := range flags {
+ if strings.Contains(f, "sanitize=unsigned-shift-base") {
+ return false
+ }
+ }
+ for _, f := range flags {
+ if strings.HasPrefix(f, "-fsanitize") && strings.Contains(f, "integer") {
+ return true
+ }
+ }
+ return false
+}
+
func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
minimalRuntimeLib := config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(ctx.toolchain()) + ".a"
minimalRuntimePath := "${config.ClangAsanLibDir}/" + minimalRuntimeLib
@@ -614,6 +630,10 @@
if toDisableImplicitIntegerChange(flags.Local.CFlags) {
flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize=implicit-integer-sign-change")
}
+ // http://b/171275751, Android doesn't build with this sanitizer yet.
+ if toDisableUnsignedShiftBaseChange(flags.Local.CFlags) {
+ flags.Local.CFlags = append(flags.Local.CFlags, "-fno-sanitize=unsigned-shift-base")
+ }
}
if len(sanitize.Properties.DiagSanitizers) > 0 {