Add clang-tidy.sh to filter out troublesome flags.

* Some flags are accepted by clang but not clang-tidy.
  They could cause the diagnostic-unused-command-line-argument warning.
  Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
  default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.

Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index 3d1a0a0..67f92a2 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -19,18 +19,6 @@
 	"strings"
 )
 
-// clang-tidy doesn't recognize every flag that clang does. This is unlikely to
-// be a complete list, but we can populate this with the ones we know to avoid
-// issues with clang-diagnostic-unused-command-line-argument.
-// b/111885396: -flto affected header include directory;
-// -fsanitize and -fwhole-program-vtables need -flto.
-var ClangTidyUnknownCflags = sorted([]string{
-	"-Wa,%",
-	"-flto",
-	"-fsanitize=%",
-	"-fwhole-program-vtables",
-})
-
 func init() {
 	// Most Android source files are not clang-tidy clean yet.
 	// Global tidy checks include only google*, performance*,
@@ -42,6 +30,7 @@
 		}
 		return strings.Join([]string{
 			"-*",
+			"clang-diagnostic-unused-command-line-argument",
 			"google*",
 			"misc-macro-parentheses",
 			"performance*",
@@ -58,6 +47,7 @@
 		}
 		return strings.Join([]string{
 			"-*",
+			"clang-diagnostic-unused-command-line-argument",
 			"google*",
 			"-google-build-using-namespace",
 			"-google-default-arguments",