Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package config |
| 16 | |
| 17 | import ( |
Dan Willemsen | 318af8b | 2016-11-02 14:50:21 -0700 | [diff] [blame] | 18 | "android/soong/android" |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 19 | "strings" |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 20 | ) |
| 21 | |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 22 | var ( |
Chih-Hung Hsieh | 9f876e9 | 2022-06-12 20:28:00 -0700 | [diff] [blame] | 23 | // Some clang-tidy checks have bugs or don't work for Android. |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 24 | // They are disabled here, overriding any locally selected checks. |
| 25 | globalNoCheckList = []string{ |
| 26 | // https://b.corp.google.com/issues/153464409 |
| 27 | // many local projects enable cert-* checks, which |
| 28 | // trigger bugprone-reserved-identifier. |
| 29 | "-bugprone-reserved-identifier*,-cert-dcl51-cpp,-cert-dcl37-c", |
| 30 | // http://b/153757728 |
| 31 | "-readability-qualified-auto", |
| 32 | // http://b/193716442 |
| 33 | "-bugprone-implicit-widening-of-multiplication-result", |
| 34 | // Too many existing functions trigger this rule, and fixing it requires large code |
| 35 | // refactoring. The cost of maintaining this tidy rule outweighs the benefit it brings. |
| 36 | "-bugprone-easily-swappable-parameters", |
| 37 | // http://b/216364337 - TODO: Follow-up after compiler update to |
| 38 | // disable or fix individual instances. |
| 39 | "-cert-err33-c", |
Chih-Hung Hsieh | 3b93ac6 | 2022-08-08 22:40:50 -0700 | [diff] [blame] | 40 | // http://b/241125373 |
| 41 | "-bugprone-unchecked-optional-access", |
Yi Kong | df456b5 | 2023-01-14 02:37:21 +0900 | [diff] [blame] | 42 | // http://b/265438407 |
| 43 | "-misc-use-anonymous-namespace", |
Yabin Cui | 2c336fe | 2023-05-31 19:25:49 +0000 | [diff] [blame] | 44 | // http://b/285005947 |
| 45 | "-performance-avoid-endl", |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | // Some clang-tidy checks are included in some tidy_checks_as_errors lists, |
| 49 | // but not all warnings are fixed/suppressed yet. These checks are not |
| 50 | // disabled in the TidyGlobalNoChecks list, so we can see them and fix/suppress them. |
| 51 | globalNoErrorCheckList = []string{ |
Chih-Hung Hsieh | 3b93ac6 | 2022-08-08 22:40:50 -0700 | [diff] [blame] | 52 | // http://b/241997913 |
| 53 | "-bugprone-assignment-in-if-condition", |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 54 | // http://b/155034972 |
| 55 | "-bugprone-branch-clone", |
Chih-Hung Hsieh | 3b93ac6 | 2022-08-08 22:40:50 -0700 | [diff] [blame] | 56 | // http://b/155034563 |
| 57 | "-bugprone-signed-char-misuse", |
| 58 | // http://b/241819232 |
| 59 | "-misc-const-correctness", |
Yabin Cui | c31c2fb | 2023-06-01 18:19:39 +0000 | [diff] [blame] | 60 | // http://b/285356805 |
| 61 | "-bugprone-unsafe-functions", |
| 62 | "-cert-msc24-c", |
| 63 | "-cert-msc33-c", |
| 64 | // http://b/285356799 |
| 65 | "-modernize-type-traits", |
| 66 | // http://b/285361108 |
| 67 | "-readability-avoid-unconditional-preprocessor-if", |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 68 | } |
Sam Delmerico | ee030d2 | 2022-11-10 14:33:40 -0500 | [diff] [blame] | 69 | |
| 70 | extraArgFlags = []string{ |
| 71 | // We might be using the static analyzer through clang tidy. |
| 72 | // https://bugs.llvm.org/show_bug.cgi?id=32914 |
| 73 | "-D__clang_analyzer__", |
| 74 | |
| 75 | // A recent change in clang-tidy (r328258) enabled destructor inlining, which |
| 76 | // appears to cause a number of false positives. Until that's resolved, this turns |
| 77 | // off the effects of r328258. |
| 78 | // https://bugs.llvm.org/show_bug.cgi?id=37459 |
| 79 | "-Xclang", |
| 80 | "-analyzer-config", |
| 81 | "-Xclang", |
| 82 | "c++-temp-dtor-inlining=false", |
| 83 | } |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 84 | ) |
| 85 | |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 86 | func init() { |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 87 | // The global default tidy checks should include clang-tidy |
| 88 | // default checks and tested groups, but exclude known noisy checks. |
Chih-Hung Hsieh | 34850d3 | 2021-01-14 16:51:49 -0800 | [diff] [blame] | 89 | // See https://clang.llvm.org/extra/clang-tidy/checks/list.html |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 90 | pctx.VariableConfigMethod("TidyDefaultGlobalChecks", func(config android.Config) string { |
Sam Delmerico | b9b6c67 | 2022-10-21 11:52:18 -0400 | [diff] [blame] | 91 | if override := config.Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" { |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 92 | return override |
Dan Willemsen | 318af8b | 2016-11-02 14:50:21 -0700 | [diff] [blame] | 93 | } |
Chih-Hung Hsieh | 04f8d37 | 2021-01-19 18:28:18 -0800 | [diff] [blame] | 94 | checks := strings.Join([]string{ |
Chih-Hung Hsieh | 34850d3 | 2021-01-14 16:51:49 -0800 | [diff] [blame] | 95 | "android-*", |
| 96 | "bugprone-*", |
| 97 | "cert-*", |
Chris Li | 46cad06 | 2021-01-14 19:48:49 +0000 | [diff] [blame] | 98 | "clang-diagnostic-unused-command-line-argument", |
Chih-Hung Hsieh | 8212621 | 2022-05-17 15:26:34 -0700 | [diff] [blame] | 99 | // Select only google-* checks that do not have thousands of warnings. |
| 100 | // Add more such checks when we clean up source code. |
| 101 | // "google-build-using-namespace", |
| 102 | // "google-default-arguments", |
| 103 | // "google-explicit-constructor", |
| 104 | // "google-global-names-in-headers", |
| 105 | // "google-runtime-int", |
| 106 | "google-build-explicit-make-pair", |
| 107 | "google-build-namespaces", |
| 108 | "google-runtime-operator", |
| 109 | "google-upgrade-*", |
Chih-Hung Hsieh | 34850d3 | 2021-01-14 16:51:49 -0800 | [diff] [blame] | 110 | "misc-*", |
| 111 | "performance-*", |
| 112 | "portability-*", |
Chih-Hung Hsieh | 3b93ac6 | 2022-08-08 22:40:50 -0700 | [diff] [blame] | 113 | "-bugprone-assignment-in-if-condition", |
Stephen Hines | 4b72145 | 2021-09-11 01:14:36 -0700 | [diff] [blame] | 114 | "-bugprone-easily-swappable-parameters", |
Chih-Hung Hsieh | 70b9316 | 2020-03-03 12:05:22 -0800 | [diff] [blame] | 115 | "-bugprone-narrowing-conversions", |
Chih-Hung Hsieh | 3b93ac6 | 2022-08-08 22:40:50 -0700 | [diff] [blame] | 116 | "-misc-const-correctness", |
Chih-Hung Hsieh | 34850d3 | 2021-01-14 16:51:49 -0800 | [diff] [blame] | 117 | "-misc-no-recursion", |
| 118 | "-misc-non-private-member-variables-in-classes", |
| 119 | "-misc-unused-parameters", |
Chih-Hung Hsieh | 5d46cd3 | 2022-05-09 16:01:10 -0700 | [diff] [blame] | 120 | "-performance-no-int-to-ptr", |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 121 | // the following groups are not in clang-tidy default checks. |
Chih-Hung Hsieh | 34850d3 | 2021-01-14 16:51:49 -0800 | [diff] [blame] | 122 | // -altera-* |
| 123 | // -cppcoreguidelines-* |
| 124 | // -darwin-* |
| 125 | // -fuchsia-* |
| 126 | // -hicpp-* |
| 127 | // -llvm-* |
| 128 | // -llvmlibc-* |
| 129 | // -modernize-* |
| 130 | // -mpi-* |
| 131 | // -objc-* |
| 132 | // -readability-* |
| 133 | // -zircon-* |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 134 | }, ",") |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 135 | // clang-analyzer-* checks are slow for large files, but we have TIDY_TIMEOUT to |
| 136 | // limit clang-tidy runtime. We allow clang-tidy default clang-analyzer-* checks, |
| 137 | // and add it explicitly when CLANG_ANALYZER_CHECKS is set. |
Chih-Hung Hsieh | 9bcce2e | 2022-02-07 16:44:13 -0800 | [diff] [blame] | 138 | // The insecureAPI.DeprecatedOrUnsafeBufferHandling warning does not apply to Android. |
Sam Delmerico | b9b6c67 | 2022-10-21 11:52:18 -0400 | [diff] [blame] | 139 | if config.IsEnvTrue("CLANG_ANALYZER_CHECKS") { |
Chih-Hung Hsieh | 9bcce2e | 2022-02-07 16:44:13 -0800 | [diff] [blame] | 140 | checks += ",clang-analyzer-*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling" |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 141 | } else { |
| 142 | checks += ",-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling" |
Chih-Hung Hsieh | 04f8d37 | 2021-01-19 18:28:18 -0800 | [diff] [blame] | 143 | } |
| 144 | return checks |
Dan Willemsen | 318af8b | 2016-11-02 14:50:21 -0700 | [diff] [blame] | 145 | }) |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 146 | |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 147 | // The external and vendor projects do not run clang-tidy unless TIDY_EXTERNAL_VENDOR is set. |
| 148 | // We do not add "-*" to the check list to avoid suppressing the check list in .clang-tidy config files. |
| 149 | // There are too many clang-tidy warnings in external and vendor projects, so we only |
| 150 | // enable some google checks for these projects. Users can add more checks locally with the |
| 151 | // "tidy_checks" list in .bp files, or the "Checks" list in .clang-tidy config files. |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 152 | pctx.VariableConfigMethod("TidyExternalVendorChecks", func(config android.Config) string { |
Sam Delmerico | b9b6c67 | 2022-10-21 11:52:18 -0400 | [diff] [blame] | 153 | if override := config.Getenv("DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS"); override != "" { |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 154 | return override |
Dan Willemsen | 318af8b | 2016-11-02 14:50:21 -0700 | [diff] [blame] | 155 | } |
| 156 | return strings.Join([]string{ |
Chih-Hung Hsieh | a7aa958 | 2018-08-15 11:28:38 -0700 | [diff] [blame] | 157 | "clang-diagnostic-unused-command-line-argument", |
Chih-Hung Hsieh | 8212621 | 2022-05-17 15:26:34 -0700 | [diff] [blame] | 158 | "google-build-explicit-make-pair", |
| 159 | "google-build-namespaces", |
| 160 | "google-runtime-operator", |
| 161 | "google-upgrade-*", |
Chih-Hung Hsieh | d21c46a | 2022-10-11 12:27:17 -0700 | [diff] [blame] | 162 | "-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling", |
Dan Willemsen | 54daaf0 | 2018-03-12 13:24:09 -0700 | [diff] [blame] | 163 | }, ",") |
Dan Willemsen | 318af8b | 2016-11-02 14:50:21 -0700 | [diff] [blame] | 164 | }) |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 165 | |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 166 | pctx.StaticVariable("TidyGlobalNoChecks", strings.Join(globalNoCheckList, ",")) |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 167 | |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 168 | pctx.StaticVariable("TidyGlobalNoErrorChecks", strings.Join(globalNoErrorCheckList, ",")) |
Chih-Hung Hsieh | 43b920e | 2022-06-09 17:58:41 -0700 | [diff] [blame] | 169 | |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 170 | pctx.StaticVariable("TidyExtraArgFlags", strings.Join(extraArgFlags, " ")) |
Sam Delmerico | ee030d2 | 2022-11-10 14:33:40 -0500 | [diff] [blame] | 171 | |
Chih-Hung Hsieh | 9f94c36 | 2021-02-10 21:56:03 -0800 | [diff] [blame] | 172 | // To reduce duplicate warnings from the same header files, |
| 173 | // header-filter will contain only the module directory and |
| 174 | // those specified by DEFAULT_TIDY_HEADER_DIRS. |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 175 | pctx.VariableConfigMethod("TidyDefaultHeaderDirs", func(config android.Config) string { |
Sam Delmerico | b9b6c67 | 2022-10-21 11:52:18 -0400 | [diff] [blame] | 176 | return config.Getenv("DEFAULT_TIDY_HEADER_DIRS") |
Chih-Hung Hsieh | 60bd4bf | 2018-09-21 09:38:17 -0700 | [diff] [blame] | 177 | }) |
Chih-Hung Hsieh | 9e5d8a6 | 2018-09-21 15:12:44 -0700 | [diff] [blame] | 178 | |
| 179 | // Use WTIH_TIDY_FLAGS to pass extra global default clang-tidy flags. |
Cole Faust | 8982b1c | 2024-04-08 16:54:45 -0700 | [diff] [blame] | 180 | pctx.VariableConfigMethod("TidyWithTidyFlags", func(config android.Config) string { |
Sam Delmerico | b9b6c67 | 2022-10-21 11:52:18 -0400 | [diff] [blame] | 181 | return config.Getenv("WITH_TIDY_FLAGS") |
Chih-Hung Hsieh | 9e5d8a6 | 2018-09-21 15:12:44 -0700 | [diff] [blame] | 182 | }) |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | type PathBasedTidyCheck struct { |
| 186 | PathPrefix string |
| 187 | Checks string |
| 188 | } |
| 189 | |
| 190 | const tidyDefault = "${config.TidyDefaultGlobalChecks}" |
| 191 | const tidyExternalVendor = "${config.TidyExternalVendorChecks}" |
Chih-Hung Hsieh | 062e934 | 2021-08-30 13:32:29 -0700 | [diff] [blame] | 192 | const tidyDefaultNoAnalyzer = "${config.TidyDefaultGlobalChecks},-clang-analyzer-*" |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 193 | |
| 194 | // This is a map of local path prefixes to the set of default clang-tidy checks |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 195 | // to be used. This is like android.IsThirdPartyPath, but with more patterns. |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 196 | // The last matched local_path_prefix should be the most specific to be used. |
| 197 | var DefaultLocalTidyChecks = []PathBasedTidyCheck{ |
| 198 | {"external/", tidyExternalVendor}, |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 199 | {"frameworks/compile/mclinker/", tidyExternalVendor}, |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 200 | {"hardware/", tidyExternalVendor}, |
| 201 | {"hardware/google/", tidyDefault}, |
| 202 | {"hardware/interfaces/", tidyDefault}, |
| 203 | {"hardware/ril/", tidyDefault}, |
| 204 | {"hardware/libhardware", tidyDefault}, // all 'hardware/libhardware*' |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 205 | {"vendor/", tidyExternalVendor}, |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 206 | {"vendor/google", tidyDefault}, // all 'vendor/google*' |
| 207 | {"vendor/google/external/", tidyExternalVendor}, |
Chih-Hung Hsieh | 47e35bb | 2022-05-05 14:09:12 -0700 | [diff] [blame] | 208 | {"vendor/google_arc/libs/org.chromium.arc.mojom", tidyExternalVendor}, |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 209 | {"vendor/google_devices/", tidyExternalVendor}, // many have vendor code |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | var reversedDefaultLocalTidyChecks = reverseTidyChecks(DefaultLocalTidyChecks) |
| 213 | |
| 214 | func reverseTidyChecks(in []PathBasedTidyCheck) []PathBasedTidyCheck { |
| 215 | ret := make([]PathBasedTidyCheck, len(in)) |
| 216 | for i, check := range in { |
| 217 | ret[len(in)-i-1] = check |
| 218 | } |
| 219 | return ret |
| 220 | } |
| 221 | |
| 222 | func TidyChecksForDir(dir string) string { |
Chih-Hung Hsieh | f92c715 | 2021-09-05 19:53:15 -0700 | [diff] [blame] | 223 | dir = dir + "/" |
Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 224 | for _, pathCheck := range reversedDefaultLocalTidyChecks { |
| 225 | if strings.HasPrefix(dir, pathCheck.PathPrefix) { |
| 226 | return pathCheck.Checks |
| 227 | } |
| 228 | } |
| 229 | return tidyDefault |
| 230 | } |
Chih-Hung Hsieh | 062e934 | 2021-08-30 13:32:29 -0700 | [diff] [blame] | 231 | |
Chih-Hung Hsieh | ff2efae | 2022-10-18 14:43:27 -0700 | [diff] [blame] | 232 | func neverTidyForDir(dir string) bool { |
| 233 | // This function can be extended if tidy needs to be disabled for more directories. |
| 234 | return strings.HasPrefix(dir, "external/grpc-grpc") |
| 235 | } |
| 236 | |
| 237 | func NoClangTidyForDir(allowExternalVendor bool, dir string) bool { |
| 238 | // Tidy can be disable for a module in dir, if the dir is "neverTidyForDir", |
| 239 | // or if it belongs to external|vendor and !allowExternalVendor. |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 240 | // This function depends on TidyChecksForDir, which selects tidyExternalVendor |
Chih-Hung Hsieh | ff2efae | 2022-10-18 14:43:27 -0700 | [diff] [blame] | 241 | // checks for external/vendor projects. |
| 242 | return neverTidyForDir(dir) || |
| 243 | (!allowExternalVendor && TidyChecksForDir(dir) == tidyExternalVendor) |
Chih-Hung Hsieh | 1a46753 | 2022-09-01 17:14:22 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Chih-Hung Hsieh | 43b920e | 2022-06-09 17:58:41 -0700 | [diff] [blame] | 246 | // Returns a globally disabled tidy checks, overriding locally selected checks. |
| 247 | func TidyGlobalNoChecks() string { |
Chih-Hung Hsieh | 794b81d | 2022-06-11 18:10:58 -0700 | [diff] [blame] | 248 | if len(globalNoCheckList) > 0 { |
| 249 | return ",${config.TidyGlobalNoChecks}" |
| 250 | } |
| 251 | return "" |
| 252 | } |
| 253 | |
| 254 | // Returns a globally allowed/no-error tidy checks, appended to -warnings-as-errors. |
| 255 | func TidyGlobalNoErrorChecks() string { |
| 256 | if len(globalNoErrorCheckList) > 0 { |
| 257 | return ",${config.TidyGlobalNoErrorChecks}" |
| 258 | } |
| 259 | return "" |
Chih-Hung Hsieh | 43b920e | 2022-06-09 17:58:41 -0700 | [diff] [blame] | 260 | } |
| 261 | |
Sam Delmerico | ee030d2 | 2022-11-10 14:33:40 -0500 | [diff] [blame] | 262 | func TidyExtraArgFlags() []string { |
| 263 | return extraArgFlags |
| 264 | } |
| 265 | |
Chih-Hung Hsieh | 062e934 | 2021-08-30 13:32:29 -0700 | [diff] [blame] | 266 | func TidyFlagsForSrcFile(srcFile android.Path, flags string) string { |
| 267 | // Disable clang-analyzer-* checks globally for generated source files |
| 268 | // because some of them are too huge. Local .bp files can add wanted |
| 269 | // clang-analyzer checks through the tidy_checks property. |
| 270 | // Need to do this patch per source file, because some modules |
| 271 | // have both generated and organic source files. |
| 272 | if _, ok := srcFile.(android.WritablePath); ok { |
| 273 | if strings.Contains(flags, tidyDefault) { |
| 274 | return strings.ReplaceAll(flags, tidyDefault, tidyDefaultNoAnalyzer) |
| 275 | } |
| 276 | } |
| 277 | return flags |
| 278 | } |