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 15package config 16 17import ( 18 "runtime" 19 "slices" 20 "strings" 21 22 "android/soong/android" 23 "android/soong/remoteexec" 24) 25 26var ( 27 pctx = android.NewPackageContext("android/soong/cc/config") 28 29 // Flags used by lots of devices. Putting them in package static variables 30 // will save bytes in build.ninja so they aren't repeated for every file 31 commonGlobalCflags = []string{ 32 // Enable some optimization by default. 33 "-O2", 34 35 // Warnings enabled by default. Reference: 36 // https://clang.llvm.org/docs/DiagnosticsReference.html 37 "-Wall", 38 "-Wextra", 39 "-Winit-self", 40 "-Wpointer-arith", 41 "-Wunguarded-availability", 42 43 // Warnings treated as errors by default. 44 // See also noOverrideGlobalCflags for errors that cannot be disabled 45 // from Android.bp files. 46 47 // Using __DATE__/__TIME__ causes build nondeterminism. 48 "-Werror=date-time", 49 // Detects forgotten */& that usually cause a crash 50 "-Werror=int-conversion", 51 // Detects unterminated alignment modification pragmas, which often lead 52 // to ABI mismatch between modules and hard-to-debug crashes. 53 "-Werror=pragma-pack", 54 // Same as above, but detects alignment pragmas around a header 55 // inclusion. 56 "-Werror=pragma-pack-suspicious-include", 57 // Detects dividing an array size by itself, which is a common typo that 58 // leads to bugs. 59 "-Werror=sizeof-array-div", 60 // Detects a typo that cuts off a prefix from a string literal. 61 "-Werror=string-plus-int", 62 // Detects for loops that will never execute more than once (for example 63 // due to unconditional break), but have a non-empty loop increment 64 // clause. Often a mistake/bug. 65 "-Werror=unreachable-code-loop-increment", 66 67 // Warnings that should not be errors even for modules with -Werror. 68 69 // Making deprecated usages an error causes extreme pain when trying to 70 // deprecate anything. 71 "-Wno-error=deprecated-declarations", 72 73 // Warnings disabled by default. 74 75 // We should encourage use of C23 features even when the whole project 76 // isn't C23-ready. 77 "-Wno-c23-extensions", 78 // Designated initializer syntax is recommended by the Google C++ style 79 // and is OK to use even if not formally supported by the chosen C++ 80 // version. 81 "-Wno-c99-designator", 82 // Detects uses of a GNU C extension equivalent to a limited form of 83 // constexpr. Enabling this would require replacing many constants with 84 // macros, which is not a good trade-off. 85 "-Wno-gnu-folding-constant", 86 // AIDL generated code redeclares pure virtual methods in each 87 // subsequent version of an interface, so this warning is currently 88 // infeasible to enable. 89 "-Wno-inconsistent-missing-override", 90 // Detects designated initializers that are in a different order than 91 // the fields in the initialized type, which causes the side effects 92 // of initializers to occur out of order with the source code. 93 // In practice, this warning has extremely poor signal to noise ratio, 94 // because it is triggered even for initializers with no side effects. 95 // Individual modules can still opt into it via cflags. 96 "-Wno-error=reorder-init-list", 97 "-Wno-reorder-init-list", 98 // Incompatible with the Google C++ style guidance to use 'int' for loop 99 // indices; poor signal to noise ratio. 100 "-Wno-sign-compare", 101 // Poor signal to noise ratio. 102 "-Wno-unused", 103 104 // Global preprocessor constants. 105 106 "-DANDROID", 107 "-DNDEBUG", 108 "-UDEBUG", 109 "-D__compiler_offsetof=__builtin_offsetof", 110 // Allows the bionic versioning.h to indirectly determine whether the 111 // option -Wunguarded-availability is on or not. 112 "-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__", 113 114 // -f and -g options. 115 116 // Emit address-significance table which allows linker to perform safe ICF. Clang does 117 // not emit the table by default on Android since NDK still uses GNU binutils. 118 "-faddrsig", 119 120 // Emit debugging data in a modern format (DWARF v5). 121 "-fdebug-default-version=5", 122 123 // Force clang to always output color diagnostics. Ninja will strip the ANSI 124 // color codes if it is not running in a terminal. 125 "-fcolor-diagnostics", 126 127 // Turn off FMA which got enabled by default in clang-r445002 (http://b/218805949) 128 "-ffp-contract=off", 129 130 // Google C++ style does not allow exceptions, turn them off by default. 131 "-fno-exceptions", 132 133 // Disable optimizations based on strict aliasing by default. 134 // The performance benefit of enabling them currently does not outweigh 135 // the risk of hard-to-reproduce bugs. 136 "-fno-strict-aliasing", 137 138 // Disable line wrapping for error messages - it interferes with 139 // displaying logs in web browsers. 140 "-fmessage-length=0", 141 142 // Using simple template names reduces the size of debug builds. 143 "-gsimple-template-names", 144 145 // Use zstd to compress debug data. 146 "-gz=zstd", 147 148 // Make paths in deps files relative. 149 "-no-canonical-prefixes", 150 } 151 152 commonGlobalConlyflags = []string{} 153 154 commonGlobalAsflags = []string{ 155 "-D__ASSEMBLY__", 156 // TODO(b/235105792): override global -fdebug-default-version=5, it is causing $TMPDIR to 157 // end up in the dwarf data for crtend_so.S. 158 "-fdebug-default-version=4", 159 } 160 161 // Compilation flags for device code; not applied to host code. 162 deviceGlobalCflags = []string{ 163 "-ffunction-sections", 164 "-fdata-sections", 165 "-fno-short-enums", 166 "-funwind-tables", 167 "-fstack-protector-strong", 168 "-Wa,--noexecstack", 169 "-D_FORTIFY_SOURCE=2", 170 171 "-Wstrict-aliasing=2", 172 173 "-Werror=return-type", 174 "-Werror=non-virtual-dtor", 175 "-Werror=address", 176 "-Werror=sequence-point", 177 "-Werror=format-security", 178 } 179 180 commonGlobalLldflags = []string{ 181 "-fuse-ld=lld", 182 "-Wl,--icf=safe", 183 "-Wl,--no-demangle", 184 } 185 186 deviceGlobalCppflags = []string{ 187 "-fvisibility-inlines-hidden", 188 } 189 190 // Linking flags for device code; not applied to host binaries. 191 deviceGlobalLdflags = []string{ 192 "-Wl,-z,noexecstack", 193 "-Wl,-z,relro", 194 "-Wl,-z,now", 195 "-Wl,--build-id=md5", 196 "-Wl,--fatal-warnings", 197 "-Wl,--no-undefined-version", 198 // TODO: Eventually we should link against a libunwind.a with hidden symbols, and then these 199 // --exclude-libs arguments can be removed. 200 "-Wl,--exclude-libs,libgcc.a", 201 "-Wl,--exclude-libs,libgcc_stripped.a", 202 "-Wl,--exclude-libs,libunwind_llvm.a", 203 "-Wl,--exclude-libs,libunwind.a", 204 } 205 206 deviceGlobalLldflags = append(append(deviceGlobalLdflags, commonGlobalLldflags...), 207 "-Wl,--compress-debug-sections=zstd", 208 ) 209 210 hostGlobalCflags = []string{} 211 212 hostGlobalCppflags = []string{} 213 214 hostGlobalLdflags = []string{} 215 216 hostGlobalLldflags = commonGlobalLldflags 217 218 commonGlobalCppflags = []string{ 219 // -Wimplicit-fallthrough is not enabled by -Wall. 220 "-Wimplicit-fallthrough", 221 222 // Enable clang's thread-safety annotations in libcxx. 223 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", 224 225 // libc++'s math.h has an #include_next outside of system_headers. 226 "-Wno-gnu-include-next", 227 } 228 229 // These flags are appended after the module's cflags, so they cannot be 230 // overridden from Android.bp files. 231 // 232 // NOTE: if you need to disable a warning to unblock a compiler upgrade 233 // and it is only triggered by third party code, add it to 234 // extraExternalCflags (if possible) or noOverrideExternalGlobalCflags 235 // (if the former doesn't work). If the new warning also occurs in first 236 // party code, try adding it to commonGlobalCflags first. Adding it here 237 // should be the last resort, because it prevents all code in Android from 238 // opting into the warning. 239 noOverrideGlobalCflags = []string{ 240 "-Werror=bool-operation", 241 "-Werror=dangling", 242 "-Werror=format-insufficient-args", 243 "-Werror=implicit-int-float-conversion", 244 "-Werror=int-in-bool-context", 245 "-Werror=int-to-pointer-cast", 246 "-Werror=pointer-to-int-cast", 247 "-Werror=xor-used-as-pow", 248 "-Wimplicit-int-float-conversion", 249 // http://b/161386391 for -Wno-void-pointer-to-enum-cast 250 "-Wno-void-pointer-to-enum-cast", 251 // http://b/161386391 for -Wno-void-pointer-to-int-cast 252 "-Wno-void-pointer-to-int-cast", 253 // http://b/161386391 for -Wno-pointer-to-int-cast 254 "-Wno-pointer-to-int-cast", 255 "-Werror=fortify-source", 256 // http://b/315246135 temporarily disabled 257 "-Wno-unused-variable", 258 // Disabled because it produces many false positives. http://b/323050926 259 "-Wno-missing-field-initializers", 260 // http://b/323050889 261 "-Wno-packed-non-pod", 262 263 "-Werror=address-of-temporary", 264 "-Werror=incompatible-function-pointer-types", 265 "-Werror=null-dereference", 266 "-Werror=return-type", 267 268 // http://b/72331526 Disable -Wtautological-* until the instances detected by these 269 // new warnings are fixed. 270 "-Wno-tautological-constant-compare", 271 "-Wno-tautological-type-limit-compare", 272 // http://b/145211066 273 "-Wno-implicit-int-float-conversion", 274 // New warnings to be fixed after clang-r377782. 275 "-Wno-tautological-overlap-compare", // http://b/148815696 276 // New warnings to be fixed after clang-r383902. 277 "-Wno-deprecated-copy", // http://b/153746672 278 "-Wno-range-loop-construct", // http://b/153747076 279 "-Wno-zero-as-null-pointer-constant", // http://b/68236239 280 "-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485 281 "-Wno-deprecated-enum-enum-conversion", 282 "-Wno-error=pessimizing-move", // http://b/154270751 283 // New warnings to be fixed after clang-r399163 284 "-Wno-non-c-typedef-for-linkage", // http://b/161304145 285 // New warnings to be fixed after clang-r428724 286 "-Wno-align-mismatch", // http://b/193679946 287 // New warnings to be fixed after clang-r433403 288 "-Wno-error=unused-but-set-variable", // http://b/197240255 289 "-Wno-error=unused-but-set-parameter", // http://b/197240255 290 // New warnings to be fixed after clang-r468909 291 "-Wno-error=deprecated-builtins", // http://b/241601211 292 "-Wno-error=deprecated", // in external/googletest/googletest 293 // Disabling until the warning is fixed in libc++abi header files b/366180429 294 "-Wno-deprecated-dynamic-exception-spec", 295 // New warnings to be fixed after clang-r522817 296 "-Wno-error=invalid-offsetof", 297 "-Wno-error=thread-safety-reference-return", 298 299 // Allow using VLA CXX extension. 300 "-Wno-vla-cxx-extension", 301 "-Wno-cast-function-type-mismatch", 302 } 303 304 noOverride64GlobalCflags = []string{} 305 306 // Extra cflags applied to third-party code (anything for which 307 // IsThirdPartyPath() in build/soong/android/paths.go returns true; 308 // includes external/, most of vendor/ and most of hardware/) 309 extraExternalCflags = []string{ 310 "-Wno-enum-compare", 311 "-Wno-enum-compare-switch", 312 313 // http://b/72331524 Allow null pointer arithmetic until the instances detected by 314 // this new warning are fixed. 315 "-Wno-null-pointer-arithmetic", 316 317 // Bug: http://b/29823425 Disable -Wnull-dereference until the 318 // new instances detected by this warning are fixed. 319 "-Wno-null-dereference", 320 321 // http://b/145211477 322 "-Wno-pointer-compare", 323 "-Wno-final-dtor-non-final-class", 324 325 // http://b/165945989 326 "-Wno-psabi", 327 328 // http://b/199369603 329 "-Wno-null-pointer-subtraction", 330 331 // http://b/175068488 332 "-Wno-string-concatenation", 333 334 // http://b/239661264 335 "-Wno-deprecated-non-prototype", 336 337 "-Wno-unused", 338 "-Wno-deprecated", 339 340 // http://b/315250603 temporarily disabled 341 "-Wno-error=format", 342 } 343 344 // Similar to noOverrideGlobalCflags, but applies only to third-party code 345 // (see extraExternalCflags). 346 // This section can unblock compiler upgrades when a third party module that 347 // enables -Werror and some group of warnings explicitly triggers newly 348 // added warnings. 349 noOverrideExternalGlobalCflags = []string{ 350 // http://b/151457797 351 "-fcommon", 352 // http://b/191699019 353 "-Wno-format-insufficient-args", 354 // http://b/296321508 355 // Introduced in response to a critical security vulnerability and 356 // should be a hard error - it requires only whitespace changes to fix. 357 "-Wno-misleading-indentation", 358 // Triggered by old LLVM code in external/llvm. Likely not worth 359 // enabling since it's a cosmetic issue. 360 "-Wno-bitwise-instead-of-logical", 361 362 "-Wno-unused", 363 "-Wno-unused-parameter", 364 "-Wno-unused-but-set-parameter", 365 "-Wno-unqualified-std-cast-call", 366 "-Wno-array-parameter", 367 "-Wno-gnu-offsetof-extensions", 368 "-Wno-pessimizing-move", 369 // TODO: Enable this warning http://b/315245071 370 "-Wno-fortify-source", 371 } 372 373 llvmNextExtraCommonGlobalCflags = []string{ 374 // Do not report warnings when testing with the top of trunk LLVM. 375 "-Wno-everything", 376 } 377 378 // Flags that must not appear in any command line. 379 IllegalFlags = []string{ 380 "-w", 381 } 382 383 CStdVersion = "gnu17" 384 CppStdVersion = "gnu++20" 385 ExperimentalCStdVersion = "gnu2x" 386 ExperimentalCppStdVersion = "gnu++2b" 387 388 // prebuilts/clang default settings. 389 ClangDefaultBase = "prebuilts/clang/host" 390 ClangDefaultVersion = "clang-r536225" 391 ClangDefaultShortVersion = "19" 392 393 // Directories with warnings from Android.bp files. 394 WarningAllowedProjects = []string{ 395 "device/", 396 "vendor/", 397 } 398 399 VersionScriptFlagPrefix = "-Wl,--version-script," 400 401 VisibilityHiddenFlag = "-fvisibility=hidden" 402 VisibilityDefaultFlag = "-fvisibility=default" 403) 404 405func init() { 406 if runtime.GOOS == "linux" { 407 commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=") 408 } 409 410 pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " ")) 411 pctx.StaticVariable("CommonGlobalAsflags", strings.Join(commonGlobalAsflags, " ")) 412 pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " ")) 413 pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " ")) 414 pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " ")) 415 pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " ")) 416 pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " ")) 417 pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " ")) 418 419 pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string { 420 flags := slices.Clone(commonGlobalCflags) 421 422 // http://b/131390872 423 // Automatically initialize any uninitialized stack variables. 424 // Prefer zero-init if multiple options are set. 425 if ctx.Config().IsEnvTrue("AUTO_ZERO_INITIALIZE") { 426 flags = append(flags, "-ftrivial-auto-var-init=zero") 427 } else if ctx.Config().IsEnvTrue("AUTO_PATTERN_INITIALIZE") { 428 flags = append(flags, "-ftrivial-auto-var-init=pattern") 429 } else if ctx.Config().IsEnvTrue("AUTO_UNINITIALIZE") { 430 flags = append(flags, "-ftrivial-auto-var-init=uninitialized") 431 } else { 432 // Default to zero initialization. 433 flags = append(flags, "-ftrivial-auto-var-init=zero") 434 } 435 436 // Workaround for ccache with clang. 437 // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html. 438 if ctx.Config().IsEnvTrue("USE_CCACHE") { 439 flags = append(flags, "-Wno-unused-command-line-argument") 440 } 441 442 if ctx.Config().IsEnvTrue("ALLOW_UNKNOWN_WARNING_OPTION") { 443 flags = append(flags, "-Wno-error=unknown-warning-option") 444 } 445 446 switch ctx.Config().Getenv("CLANG_DEFAULT_DEBUG_LEVEL") { 447 case "debug_level_0": 448 flags = append(flags, "-g0") 449 case "debug_level_1": 450 flags = append(flags, "-g1") 451 case "debug_level_2": 452 flags = append(flags, "-g2") 453 case "debug_level_3": 454 flags = append(flags, "-g3") 455 case "debug_level_g": 456 flags = append(flags, "-g") 457 default: 458 flags = append(flags, "-g") 459 } 460 461 return strings.Join(flags, " ") 462 }) 463 464 pctx.VariableFunc("DeviceGlobalCflags", func(ctx android.PackageVarContext) string { 465 return strings.Join(deviceGlobalCflags, " ") 466 }) 467 468 pctx.VariableFunc("NoOverrideGlobalCflags", func(ctx android.PackageVarContext) string { 469 flags := noOverrideGlobalCflags 470 if ctx.Config().IsEnvTrue("LLVM_NEXT") { 471 flags = append(noOverrideGlobalCflags, llvmNextExtraCommonGlobalCflags...) 472 IllegalFlags = []string{} // Don't fail build while testing a new compiler. 473 } 474 return strings.Join(flags, " ") 475 }) 476 477 pctx.StaticVariable("NoOverride64GlobalCflags", strings.Join(noOverride64GlobalCflags, " ")) 478 pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " ")) 479 pctx.StaticVariable("NoOverrideExternalGlobalCflags", strings.Join(noOverrideExternalGlobalCflags, " ")) 480 pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " ")) 481 pctx.StaticVariable("ExternalCflags", strings.Join(extraExternalCflags, " ")) 482 483 // Everything in these lists is a crime against abstraction and dependency tracking. 484 // Do not add anything to this list. 485 commonGlobalIncludes := []string{ 486 "system/core/include", 487 "system/logging/liblog/include", 488 "system/media/audio/include", 489 "hardware/libhardware/include", 490 "hardware/libhardware_legacy/include", 491 "hardware/ril/include", 492 "frameworks/native/include", 493 "frameworks/native/opengl/include", 494 "frameworks/av/include", 495 } 496 pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", commonGlobalIncludes) 497 498 pctx.StaticVariable("CLANG_DEFAULT_VERSION", ClangDefaultVersion) 499 pctx.StaticVariable("CLANG_DEFAULT_SHORT_VERSION", ClangDefaultShortVersion) 500 501 pctx.StaticVariableWithEnvOverride("ClangBase", "LLVM_PREBUILTS_BASE", ClangDefaultBase) 502 pctx.StaticVariableWithEnvOverride("ClangVersion", "LLVM_PREBUILTS_VERSION", ClangDefaultVersion) 503 pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}") 504 pctx.StaticVariable("ClangBin", "${ClangPath}/bin") 505 506 pctx.StaticVariableWithEnvOverride("ClangShortVersion", "LLVM_RELEASE_VERSION", ClangDefaultShortVersion) 507 pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib/clang/${ClangShortVersion}/lib/linux") 508 509 pctx.StaticVariable("WarningAllowedProjects", strings.Join(WarningAllowedProjects, " ")) 510 511 // These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts 512 // being used for the rest of the build process. 513 pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host") 514 pctx.SourcePathVariable("RSClangVersion", "clang-3289846") 515 pctx.SourcePathVariable("RSReleaseVersion", "3.8") 516 pctx.StaticVariable("RSLLVMPrebuiltsPath", "${RSClangBase}/${HostPrebuiltTag}/${RSClangVersion}/bin") 517 pctx.StaticVariable("RSIncludePath", "${RSLLVMPrebuiltsPath}/../lib64/clang/${RSReleaseVersion}/include") 518 519 rsGlobalIncludes := []string{ 520 "external/clang/lib/Headers", 521 "frameworks/rs/script_api/include", 522 } 523 pctx.PrefixedExistentPathsForSourcesVariable("RsGlobalIncludes", "-I", rsGlobalIncludes) 524 525 pctx.VariableFunc("CcWrapper", func(ctx android.PackageVarContext) string { 526 if override := ctx.Config().Getenv("CC_WRAPPER"); override != "" { 527 return override + " " 528 } 529 return "" 530 }) 531 532 pctx.StaticVariableWithEnvOverride("RECXXPool", "RBE_CXX_POOL", remoteexec.DefaultPool) 533 pctx.StaticVariableWithEnvOverride("RECXXLinksPool", "RBE_CXX_LINKS_POOL", remoteexec.DefaultPool) 534 pctx.StaticVariableWithEnvOverride("REClangTidyPool", "RBE_CLANG_TIDY_POOL", remoteexec.DefaultPool) 535 pctx.StaticVariableWithEnvOverride("RECXXLinksExecStrategy", "RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy) 536 pctx.StaticVariableWithEnvOverride("REClangTidyExecStrategy", "RBE_CLANG_TIDY_EXEC_STRATEGY", remoteexec.LocalExecStrategy) 537 pctx.StaticVariableWithEnvOverride("REAbiDumperExecStrategy", "RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy) 538 pctx.StaticVariableWithEnvOverride("REAbiLinkerExecStrategy", "RBE_ABI_LINKER_EXEC_STRATEGY", remoteexec.LocalExecStrategy) 539} 540 541var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS) 542 543func ClangPath(ctx android.PathContext, file string) android.SourcePath { 544 type clangToolKey string 545 546 key := android.NewCustomOnceKey(clangToolKey(file)) 547 548 return ctx.Config().OnceSourcePath(key, func() android.SourcePath { 549 return clangPath(ctx).Join(ctx, file) 550 }) 551} 552 553var clangPathKey = android.NewOnceKey("clangPath") 554 555func clangPath(ctx android.PathContext) android.SourcePath { 556 return ctx.Config().OnceSourcePath(clangPathKey, func() android.SourcePath { 557 clangBase := ClangDefaultBase 558 if override := ctx.Config().Getenv("LLVM_PREBUILTS_BASE"); override != "" { 559 clangBase = override 560 } 561 clangVersion := ClangDefaultVersion 562 if override := ctx.Config().Getenv("LLVM_PREBUILTS_VERSION"); override != "" { 563 clangVersion = override 564 } 565 return android.PathForSource(ctx, clangBase, ctx.Config().PrebuiltOS(), clangVersion) 566 }) 567} 568