diff options
author | 2018-03-20 04:25:02 -0700 | |
---|---|---|
committer | 2018-03-20 04:26:54 -0700 | |
commit | 191add5b0e32c39faca09c25e6da6683a79dd8f7 (patch) | |
tree | 63d8ccae9263687c4de7a7fa84e08f78eef5230e /src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java | |
parent | 755a0a10e14c4fe4c2ff3b71af9f99d5d1a924cf (diff) |
Make FdoSupport use outputName to generate object file path
Object file path will no longer be derived from source file path directly.
This is a preparation change for[]
Related issue https://github.com/bazelbuild/bazel/issues/4149
RELNOTES: None
PiperOrigin-RevId: 189722421
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java index 79d4dcf03a..890c68a364 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FdoSupport.java @@ -590,15 +590,20 @@ public class FdoSupport { } /** - * Configures a compile action builder by setting up command line options and - * auxiliary inputs according to the FDO configuration. This method does - * nothing If FDO is disabled. + * Configures a compile action builder by setting up command line options and auxiliary inputs + * according to the FDO configuration. This method does nothing If FDO is disabled. */ @ThreadSafe - public void configureCompilation(CppCompileActionBuilder builder, - CcToolchainFeatures.Variables.Builder buildVariables, RuleContext ruleContext, - PathFragment sourceName, PathFragment sourceExecPath, boolean usePic, - FeatureConfiguration featureConfiguration, FdoSupportProvider fdoSupportProvider) { + public void configureCompilation( + CppCompileActionBuilder builder, + CcToolchainFeatures.Variables.Builder buildVariables, + RuleContext ruleContext, + PathFragment sourceName, + PathFragment sourceExecPath, + PathFragment outputName, + boolean usePic, + FeatureConfiguration featureConfiguration, + FdoSupportProvider fdoSupportProvider) { // FDO is disabled -> do nothing. if ((fdoInstrument == null) && (fdoRoot == null)) { @@ -616,8 +621,9 @@ public class FdoSupport { if (env.getSkyframeEnv().valuesMissing()) { return; } - Iterable<Artifact> auxiliaryInputs = getAuxiliaryInputs( - ruleContext, sourceName, sourceExecPath, usePic, fdoSupportProvider); + Iterable<Artifact> auxiliaryInputs = + getAuxiliaryInputs( + ruleContext, sourceName, sourceExecPath, outputName, usePic, fdoSupportProvider); builder.addMandatoryInputs(auxiliaryInputs); if (!Iterables.isEmpty(auxiliaryInputs)) { if (featureConfiguration.isEnabled(CppRuleClasses.AUTOFDO)) { @@ -636,11 +642,13 @@ public class FdoSupport { } } - /** - * Returns the auxiliary files that need to be added to the {@link CppCompileAction}. - */ + /** Returns the auxiliary files that need to be added to the {@link CppCompileAction}. */ private Iterable<Artifact> getAuxiliaryInputs( - RuleContext ruleContext, PathFragment sourceName, PathFragment sourceExecPath, boolean usePic, + RuleContext ruleContext, + PathFragment sourceName, + PathFragment sourceExecPath, + PathFragment outputName, + boolean usePic, FdoSupportProvider fdoSupportProvider) { CcToolchainProvider toolchain = CppHelper.getToolchainUsingDefaultCcToolchainAttribute(ruleContext); @@ -661,7 +669,7 @@ public class FdoSupport { ImmutableSet.Builder<Artifact> auxiliaryInputs = ImmutableSet.builder(); PathFragment objectName = - FileSystemUtils.replaceExtension(sourceName, usePic ? ".pic.o" : ".o"); + FileSystemUtils.appendExtension(outputName, usePic ? ".pic.o" : ".o"); Label lipoLabel = ruleContext.getLabel(); auxiliaryInputs.addAll( |