Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop listing .gcno files as outputs when using LLVM coverage map format #22132

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ private Artifact createCompileActionTemplate(
usePic,
/* needsFdoBuildVariables= */ false,
ccCompilationContext.getCppModuleMap(),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand Down Expand Up @@ -1262,6 +1263,7 @@ private CcToolchainVariables setupCompileBuildVariables(
boolean usePic,
boolean needsFdoBuildVariables,
CppModuleMap cppModuleMap,
boolean isCodeCoverageEnabled,
Artifact gcnoFile,
boolean isUsingFission,
Artifact dwoFile,
Expand Down Expand Up @@ -1352,6 +1354,7 @@ private CcToolchainVariables setupCompileBuildVariables(
buildVariables,
toPathString(sourceFile),
toPathString(builder.getOutputFile()),
isCodeCoverageEnabled,
toPathString(gcnoFile),
toPathString(dwoFile),
isUsingFission,
Expand Down Expand Up @@ -1410,7 +1413,7 @@ private void createModuleCodegenAction(
ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, outputName);
// TODO(djasper): This is now duplicated. Refactor the various create..Action functions.
Artifact gcnoFile =
isCodeCoverageEnabled
isCodeCoverageEnabled && !cppConfiguration.useLLVMCoverageMapFormat()
? CppHelper.getCompileOutputArtifact(
actionConstructionContext, label, gcnoFileName, configuration)
: null;
Expand All @@ -1431,6 +1434,7 @@ private void createModuleCodegenAction(
/* usePic= */ pic,
/* needsFdoBuildVariables= */ ccRelativeName != null,
ccCompilationContext.getCppModuleMap(),
isCodeCoverageEnabled,
gcnoFile,
generateDwo,
dwoFile,
Expand Down Expand Up @@ -1477,6 +1481,7 @@ private void createHeaderAction(
generatePicAction,
/* needsFdoBuildVariables= */ false,
ccCompilationContext.getCppModuleMap(),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand Down Expand Up @@ -1541,7 +1546,7 @@ private ImmutableList<Artifact> createSourceAction(
CppHelper.getArtifactNameForCategory(
ccToolchain, ArtifactCategory.COVERAGE_DATA_FILE, picOutputBase);
Artifact gcnoFile =
enableCoverage
isCodeCoverageEnabled && !cppConfiguration.useLLVMCoverageMapFormat()
? CppHelper.getCompileOutputArtifact(
actionConstructionContext, label, gcnoFileName, configuration)
: null;
Expand All @@ -1557,6 +1562,7 @@ private ImmutableList<Artifact> createSourceAction(
/* usePic= */ true,
/* needsFdoBuildVariables= */ ccRelativeName != null && addObject,
cppModuleMap,
isCodeCoverageEnabled,
gcnoFile,
generateDwo,
dwoFile,
Expand Down Expand Up @@ -1615,7 +1621,7 @@ private ImmutableList<Artifact> createSourceAction(

// Create no-PIC compile actions
Artifact gcnoFile =
enableCoverage
isCodeCoverageEnabled && !cppConfiguration.useLLVMCoverageMapFormat()
? CppHelper.getCompileOutputArtifact(
actionConstructionContext, label, gcnoFileName, configuration)
: null;
Expand All @@ -1630,6 +1636,7 @@ private ImmutableList<Artifact> createSourceAction(
/* usePic= */ false,
/* needsFdoBuildVariables= */ ccRelativeName != null,
cppModuleMap,
isCodeCoverageEnabled,
gcnoFile,
generateDwo,
noPicDwoFile,
Expand Down Expand Up @@ -1796,6 +1803,7 @@ private ImmutableList<Artifact> createTempsActions(
usePic,
/* needsFdoBuildVariables= */ ccRelativeName != null,
ccCompilationContext.getCppModuleMap(),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand All @@ -1821,6 +1829,7 @@ private ImmutableList<Artifact> createTempsActions(
usePic,
/* needsFdoBuildVariables= */ ccRelativeName != null,
ccCompilationContext.getCppModuleMap(),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ public CcToolchainVariables getCompileBuildVariables(
ccToolchainProvider,
convertFromNoneable(sourceFile, /* defaultValue= */ null),
convertFromNoneable(outputFile, /* defaultValue= */ null),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public static CcToolchainVariables setupVariablesOrReportRuleError(
CcToolchainProvider ccToolchainProvider,
String sourceFile,
String outputFile,
boolean isCodeCoverageEnabled,
String gcnoFile,
boolean isUsingFission,
String dwoFile,
Expand Down Expand Up @@ -173,6 +174,7 @@ public static CcToolchainVariables setupVariablesOrReportRuleError(
ccToolchainProvider.getBuildVars(),
sourceFile,
outputFile,
isCodeCoverageEnabled,
gcnoFile,
isUsingFission,
dwoFile,
Expand Down Expand Up @@ -204,6 +206,7 @@ public static CcToolchainVariables setupVariablesOrThrowEvalException(
CcToolchainProvider ccToolchainProvider,
String sourceFile,
String outputFile,
boolean isCodeCoverageEnabled,
String gcnoFile,
boolean isUsingFission,
String dwoFile,
Expand Down Expand Up @@ -238,6 +241,7 @@ public static CcToolchainVariables setupVariablesOrThrowEvalException(
ccToolchainProvider.getBuildVars(),
sourceFile,
outputFile,
isCodeCoverageEnabled,
gcnoFile,
isUsingFission,
dwoFile,
Expand Down Expand Up @@ -269,6 +273,7 @@ private static CcToolchainVariables setupVariables(
CcToolchainVariables parent,
String sourceFile,
String outputFile,
boolean isCodeCoverageEnabled,
String gcnoFile,
boolean isUsingFission,
String dwoFile,
Expand Down Expand Up @@ -314,6 +319,7 @@ private static CcToolchainVariables setupVariables(
buildVariables,
sourceFile,
outputFile,
isCodeCoverageEnabled,
gcnoFile,
dwoFile,
isUsingFission,
Expand All @@ -334,6 +340,7 @@ public static void setupSpecificVariables(
CcToolchainVariables.Builder buildVariables,
String sourceFile,
String outputFile,
boolean isCodeCoverageEnabled,
String gcnoFile,
String dwoFile,
boolean isUsingFission,
Expand Down Expand Up @@ -371,6 +378,10 @@ public static void setupSpecificVariables(

if (gcnoFile != null) {
buildVariables.addStringVariable(GCOV_GCNO_FILE.getVariableName(), gcnoFile);
} else if (isCodeCoverageEnabled) {
// TODO: Blaze currently uses `gcov_gcno_file` to detect if code coverage is enabled. It
// should use a different signal.
buildVariables.addStringVariable(GCOV_GCNO_FILE.getVariableName(), "");
}

if (dwoFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private static CcToolchainVariables getVariables(
ccToolchainProvider,
sourceFile.getExecPathString(),
outputFile.getExecPathString(),
/* isCodeCoverageEnabled= */ false,
/* gcnoFile= */ null,
/* isUsingFission= */ false,
/* dwoFile= */ null,
Expand Down