aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-09-08 14:31:05 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-09-11 13:01:19 +0200
commite4f390420c6b6ceef93e5e620a747a6d196bd172 (patch)
tree955715ce9c5980a3b20b207b12d2ca65a7f09a99 /src/main
parent59ad6960c787cbe906a20f9cb62555d579a5f26d (diff)
Fix style in CppModel.java
RELNOTES: None. PiperOrigin-RevId: 167986260
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java139
1 files changed, 78 insertions, 61 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
index 90e8965b49..8e1d578f66 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
@@ -642,12 +642,12 @@ public final class CppModel {
builder,
ArtifactCategory.OBJECT_FILE,
context.getCppModuleMap(),
- /*addObject=*/ true,
+ /* addObject= */ true,
isCodeCoverageEnabled(),
// The source action does not generate dwo when it has bitcode
// output (since it isn't generating a native object with debug
// info). In that case the LtoBackendAction will generate the dwo.
- /*generateDwo=*/ cppConfiguration.useFission() && !bitcodeOutput,
+ /* generateDwo= */ cppConfiguration.useFission() && !bitcodeOutput,
isGenerateDotdFile(sourceArtifact),
source.getBuildVariables());
break;
@@ -694,17 +694,17 @@ public final class CppModel {
builder
.setOutputs(ruleContext, ArtifactCategory.PROCESSED_HEADER, outputNameBase, generateDotd)
// If we generate pic actions, we prefer the header actions to use the pic artifacts.
- .setPicMode(this.getGeneratePicActions());
+ .setPicMode(getGeneratePicActions());
setupCompileBuildVariables(
builder,
- this.getGeneratePicActions(),
- /*ccRelativeName=*/ null,
- /*autoFdoImportPath=*/ null,
- /*gcnoFile=*/ null,
- /*dwoFile=*/ null,
- /*ltoIndexingFile=*/ null,
+ getGeneratePicActions(),
+ /* ccRelativeName= */ null,
+ /* autoFdoImportPath= */ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
semantics.finalizeCompileActionBuilder(
ruleContext, builder, featureConfiguration.getFeatureSpecification());
CppCompileAction compileAction = builder.buildOrThrowRuleError(ruleContext);
@@ -755,14 +755,14 @@ public final class CppModel {
setupCompileBuildVariables(
builder,
- /*usePic=*/ pic,
+ /* usePic= */ pic,
ccRelativeName,
module.getExecPath(),
gcnoFile,
dwoFile,
- /*ltoIndexingFile=*/ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
builder.setGcnoFile(gcnoFile);
builder.setDwoFile(dwoFile);
@@ -801,18 +801,19 @@ public final class CppModel {
builder,
ArtifactCategory.CPP_MODULE,
cppModuleMap,
- /*addObject=*/ false,
- /*enableCoverage=*/ false,
- /*generateDwo=*/ false,
+ /* addObject= */ false,
+ /* enableCoverage= */ false,
+ /* generateDwo= */ false,
isGenerateDotdFile(moduleMapArtifact),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
}
private void createClifMatchAction(
String outputName, Builder result, AnalysisEnvironment env, CppCompileActionBuilder builder)
throws RuleErrorException {
builder
- .setOutputs(ruleContext, ArtifactCategory.CLIF_OUTPUT_PROTO, outputName, true)
+ .setOutputs(
+ ruleContext, ArtifactCategory.CLIF_OUTPUT_PROTO, outputName, /* generateDotd= */ true)
.setPicMode(false)
// The additional headers in a clif action are both mandatory inputs and
// need to be include-scanned.
@@ -820,14 +821,14 @@ public final class CppModel {
.addAdditionalIncludes(mandatoryInputs);
setupCompileBuildVariables(
builder,
- /* usePic=*/ false,
- /*ccRelativeName=*/ null,
- /*autoFdoImportPath=*/ null,
- /*gcnoFile=*/ null,
- /*dwoFile=*/ null,
- /*ltoIndexingFile=*/ null,
+ /* usePic= */ false,
+ /* ccRelativeName= */ null,
+ /* autoFdoImportPath= */ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- /*sourceSpecificBuildVariables=*/ ImmutableMap.<String, String>of());
+ /* sourceSpecificBuildVariables= */ ImmutableMap.of());
semantics.finalizeCompileActionBuilder(
ruleContext, builder, featureConfiguration.getFeatureSpecification());
CppCompileAction compileAction = builder.buildOrThrowRuleError(ruleContext);
@@ -890,7 +891,7 @@ public final class CppModel {
setupCompileBuildVariables(
picBuilder,
- /*usePic=*/ true,
+ /* usePic= */ true,
ccRelativeName,
sourceArtifact.getExecPath(),
gcnoFile,
@@ -901,8 +902,13 @@ public final class CppModel {
if (maySaveTemps) {
result.addTemps(
- createTempsActions(sourceArtifact, outputName, picBuilder, /*usePic=*/true,
- /*generateDotd=*/ generateDotd, ccRelativeName));
+ createTempsActions(
+ sourceArtifact,
+ outputName,
+ picBuilder,
+ /* usePic= */ true,
+ /* generateDotd= */ generateDotd,
+ ccRelativeName));
}
picBuilder.setGcnoFile(gcnoFile);
@@ -952,7 +958,7 @@ public final class CppModel {
setupCompileBuildVariables(
builder,
- /*usePic=*/ false,
+ /* usePic= */ false,
ccRelativeName,
sourceArtifact.getExecPath(),
gcnoFile,
@@ -967,8 +973,8 @@ public final class CppModel {
sourceArtifact,
outputName,
builder,
- /*usePic=*/ false,
- /*generateDotd*/ generateDotd,
+ /* usePic= */ false,
+ generateDotd,
ccRelativeName));
}
@@ -1006,15 +1012,15 @@ public final class CppModel {
Artifact sourceArtifact = source.getSource();
Artifact outputFiles = CppHelper.getCompileOutputTreeArtifact(ruleContext, sourceArtifact);
// TODO(rduan): Dotd file output is not supported yet.
- builder.setOutputs(outputFiles, null);
+ builder.setOutputs(outputFiles, /* dotdFile= */ null);
setupCompileBuildVariables(
builder,
- /* usePic=*/ false,
- /*ccRelativeName=*/ null,
- /*autoFdoImportPath=*/ null,
- /*gcnoFile=*/ null,
- /*dwoFile=*/ null,
- /*ltoIndexingFile=*/ null,
+ /* usePic= */ false,
+ /* ccRelativeName= */ null,
+ /* autoFdoImportPath= */ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
source.getBuildVariables());
semantics.finalizeCompileActionBuilder(
@@ -1068,11 +1074,11 @@ public final class CppModel {
usePic,
ccRelativeName,
execPath,
- /*gcnoFile=*/ null,
- /*dwoFile=*/ null,
- /*ltoIndexingFile=*/ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
semantics.finalizeCompileActionBuilder(
ruleContext, builder, featureConfiguration.getFeatureSpecification());
CppCompileAction action = builder.buildOrThrowRuleError(ruleContext);
@@ -1166,8 +1172,8 @@ public final class CppModel {
}
AnalysisEnvironment env = ruleContext.getAnalysisEnvironment();
- boolean usePicForBinaries = CppHelper.usePic(ruleContext, true);
- boolean usePicForSharedLibs = CppHelper.usePic(ruleContext, false);
+ boolean usePicForBinaries = CppHelper.usePic(ruleContext, /* forBinary= */ true);
+ boolean usePicForSharedLibs = CppHelper.usePic(ruleContext, /* forBinary= */ false);
// Create static library (.a). The linkType only reflects whether the library is alwayslink or
// not. The PIC-ness is determined by whether we need to use PIC or not. There are three cases
@@ -1218,7 +1224,7 @@ public final class CppModel {
Artifact picArtifact = getLinkedArtifact(picLinkType);
CppLinkAction picAction =
newLinkActionBuilder(picArtifact)
- .addObjectFiles(ccOutputs.getObjectFiles(true))
+ .addObjectFiles(ccOutputs.getObjectFiles(/* usePic= */ true))
.addLtoBitcodeFiles(ccOutputs.getLtoBitcodeFiles())
.setLinkType(picLinkType)
.setLinkStaticness(LinkStaticness.FULLY_STATIC)
@@ -1264,8 +1270,11 @@ public final class CppModel {
configuration,
LinkTargetType.INTERFACE_DYNAMIC_LIBRARY,
linkedArtifactNameSuffix);
- sonameLinkopts = ImmutableList.of("-Wl,-soname=" +
- SolibSymlinkAction.getDynamicLibrarySoname(soImpl.getRootRelativePath(), false));
+ sonameLinkopts =
+ ImmutableList.of(
+ "-Wl,-soname="
+ + SolibSymlinkAction.getDynamicLibrarySoname(
+ soImpl.getRootRelativePath(), /* preserveName= */ false));
}
CppLinkActionBuilder dynamicLinkActionBuilder =
@@ -1316,14 +1325,22 @@ public final class CppModel {
result.addDynamicLibrary(interfaceLibrary);
result.addExecutionDynamicLibrary(dynamicLibrary);
} else {
- Artifact libraryLink = SolibSymlinkAction.getDynamicLibrarySymlink(
- ruleContext, interfaceLibrary.getArtifact(), false, false,
- ruleContext.getConfiguration());
+ Artifact libraryLink =
+ SolibSymlinkAction.getDynamicLibrarySymlink(
+ ruleContext,
+ interfaceLibrary.getArtifact(),
+ /* preserveName= */ false,
+ /* prefixConsumer= */ false,
+ ruleContext.getConfiguration());
result.addDynamicLibrary(LinkerInputs.solibLibraryToLink(
libraryLink, interfaceLibrary.getArtifact(), libraryIdentifier));
- Artifact implLibraryLink = SolibSymlinkAction.getDynamicLibrarySymlink(
- ruleContext, dynamicLibrary.getArtifact(), false, false,
- ruleContext.getConfiguration());
+ Artifact implLibraryLink =
+ SolibSymlinkAction.getDynamicLibrarySymlink(
+ ruleContext,
+ dynamicLibrary.getArtifact(),
+ /* preserveName= */ false,
+ /* prefixConsumer= */ false,
+ ruleContext.getConfiguration());
result.addExecutionDynamicLibrary(LinkerInputs.solibLibraryToLink(
implLibraryLink, dynamicLibrary.getArtifact(), libraryIdentifier));
}
@@ -1398,11 +1415,11 @@ public final class CppModel {
usePic,
ccRelativeName,
source.getExecPath(),
- null,
- null,
- /*ltoIndexingFile=*/ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
semantics.finalizeCompileActionBuilder(
ruleContext, dBuilder, featureConfiguration.getFeatureSpecification());
CppCompileAction dAction = dBuilder.buildOrThrowRuleError(ruleContext);
@@ -1416,11 +1433,11 @@ public final class CppModel {
usePic,
ccRelativeName,
source.getExecPath(),
- null,
- null,
- /*ltoIndexingFile=*/ null,
+ /* gcnoFile= */ null,
+ /* dwoFile= */ null,
+ /* ltoIndexingFile= */ null,
builder.getContext().getCppModuleMap(),
- ImmutableMap.<String, String>of());
+ ImmutableMap.of());
semantics.finalizeCompileActionBuilder(
ruleContext, sdBuilder, featureConfiguration.getFeatureSpecification());
CppCompileAction sdAction = sdBuilder.buildOrThrowRuleError(ruleContext);