Skip to content

Commit

Permalink
Set gcov_gcno_file for Blaze
Browse files Browse the repository at this point in the history
  • Loading branch information
brentleyjones committed Apr 29, 2024
1 parent 595deef commit c97ef77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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 @@ -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 @@ -1557,6 +1562,7 @@ private ImmutableList<Artifact> createSourceAction(
/* usePic= */ true,
/* needsFdoBuildVariables= */ ccRelativeName != null && addObject,
cppModuleMap,
isCodeCoverageEnabled,
gcnoFile,
generateDwo,
dwoFile,
Expand Down Expand Up @@ -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 @@ -334,6 +334,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 +372,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

0 comments on commit c97ef77

Please sign in to comment.