aboutsummaryrefslogtreecommitdiff
path: root/cc/coverage.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /cc/coverage.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'cc/coverage.go')
-rw-r--r--cc/coverage.go41
1 files changed, 22 insertions, 19 deletions
diff --git a/cc/coverage.go b/cc/coverage.go
index 757641cba..15eace601 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -38,6 +38,14 @@ var (
"-fcoverage-mapping",
"-Wno-pass-failed",
"-D__ANDROID_CLANG_COVERAGE__",
+
+ // Bug: http://b/408093589, http://b/396515430: LLVM change 4089763883 to
+ // global merge regressed code coverage, marking previously covered lines
+ // as uncovered. Disable global merge until the regression is fixed.
+ // -Wunused-command-line-argument needs to be disabled because
+ // -mno-global-merge is reported as unused in LTO mode.
+ "-mno-global-merge",
+ "-Wno-unused-command-line-argument",
}
clangCoverageHWASanFlags = []string{
"-mllvm",
@@ -149,11 +157,11 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
// For static libraries, the only thing that changes our object files
// are included whole static libraries, so check to see if any of
// those have coverage enabled.
- ctx.VisitDirectDeps(func(m android.Module) {
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
if depTag, ok := ctx.OtherModuleDependencyTag(m).(libraryDependencyTag); ok {
if depTag.static() && depTag.wholeStatic {
- if cc, ok := m.(*Module); ok && cc.coverage != nil {
- if cc.coverage.linkCoverage {
+ if info, ok := android.OtherModuleProvider(ctx, m, LinkableInfoProvider); ok {
+ if info.LinkCoverage {
cov.linkCoverage = true
}
}
@@ -163,18 +171,13 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
} else {
// For executables and shared libraries, we need to check all of
// our static dependencies.
- ctx.VisitDirectDeps(func(m android.Module) {
- cc, ok := m.(*Module)
- if !ok || cc.coverage == nil {
- return
- }
-
- if static, ok := cc.linker.(libraryInterface); !ok || !static.static() {
- return
- }
-
- if cc.coverage.linkCoverage {
- cov.linkCoverage = true
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
+ if _, ok := android.OtherModuleProvider(ctx, m, StaticLibraryInfoProvider); ok {
+ if info, ok := android.OtherModuleProvider(ctx, m, LinkableInfoProvider); ok {
+ if info.LinkCoverage {
+ cov.linkCoverage = true
+ }
+ }
}
})
}
@@ -185,8 +188,8 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
flags.Local.LdFlags = append(flags.Local.LdFlags, "--coverage")
if ctx.Device() {
- coverage := ctx.GetDirectDepWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ coverage := ctx.GetDirectDepProxyWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, android.OutputFileForModule(ctx, coverage, ""))
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,getenv")
}
} else if clangCoverage {
@@ -196,8 +199,8 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
}
if ctx.Device() {
- coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ coverage := ctx.GetDirectDepProxyWithTag(getClangProfileLibraryName(ctx), CoverageDepTag)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, android.OutputFileForModule(ctx, coverage, ""))
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
}
}