Add tidy_disabled_srcs property.
Used as a supplement to C/C++ srcs to disable
clang-tidy for selected srcs, when a library
contains many files in srcs and only some of them
are too large to compile with clang-tidy.
Test: WITH_TIDY=1 TIDY_TIMEOUT=90 make tidy-soong
Bug: 198098397
Change-Id: Ib32eb0e46ddbc717999797717bfd8c57e182ee88
diff --git a/cc/builder.go b/cc/builder.go
index 4b0a4b6..b494f7b 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -454,15 +454,19 @@
}
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
-func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles android.Paths,
+func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, noTidySrcs android.Paths,
flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
// Source files are one-to-one with tidy, coverage, or kythe files, if enabled.
objFiles := make(android.Paths, len(srcFiles))
var tidyFiles android.Paths
+ noTidySrcsMap := make(map[android.Path]bool)
var tidyVars string
if flags.tidy {
tidyFiles = make(android.Paths, 0, len(srcFiles))
+ for _, path := range noTidySrcs {
+ noTidySrcsMap[path] = true
+ }
tidyTimeout := ctx.Config().Getenv("TIDY_TIMEOUT")
if len(tidyTimeout) > 0 {
tidyVars += "TIDY_TIMEOUT=" + tidyTimeout
@@ -673,7 +677,8 @@
kytheFiles = append(kytheFiles, kytheFile)
}
- if tidy {
+ // Even with tidy, some src file could be skipped by noTidySrcsMap.
+ if tidy && !noTidySrcsMap[srcFile] {
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
tidyFiles = append(tidyFiles, tidyFile)