aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
diff options
context:
space:
mode:
authorGravatar Rumou Duan <rduan@google.com>2017-02-13 18:02:00 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-14 14:20:33 +0000
commit655bafe74faeef1aa63752640a1e8b7b9505f43d (patch)
tree372c99bca3c4473945ebefd092fed4bde789b4ef /src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
parentd8eec343d238129ce8b5146c4177d207a6b3683b (diff)
Stop retrieving FdoSupport statically from hard-coded attribute ":cc_toolchain" in RuleContext, instead take the provider from users and pass it around to where it is used.
This gives J2ObjcAspect the ability to specify the C++ toolchain attribute under a different name to avoid attribute conflicts with attached rules that have already declared attribute ":cc_toolchain". -- PiperOrigin-RevId: 147358325 MOS_MIGRATED_REVID=147358325
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
index 69b48731f3..2f5b6488d7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
@@ -657,6 +657,7 @@ public final class LinkCommandLine extends CommandLine {
private boolean useTestOnlyFlags;
@Nullable private Artifact paramFile;
@Nullable private CcToolchainProvider toolchain;
+ private FdoSupport fdoSupport;
private Variables variables;
private FeatureConfiguration featureConfiguration;
@@ -705,6 +706,10 @@ public final class LinkCommandLine extends CommandLine {
featureConfiguration = CcCommon.configureFeatures(ruleContext, ccToolchain);
}
}
+
+ if (fdoSupport == null) {
+ fdoSupport = CppHelper.getFdoSupport(ruleContext, ":cc_toolchain").getFdoSupport();
+ }
}
if (variables == null) {
@@ -728,7 +733,7 @@ public final class LinkCommandLine extends CommandLine {
features,
linkstamps,
actualLinkstampCompileOptions,
- CppHelper.getFdoBuildStamp(ruleContext),
+ CppHelper.getFdoBuildStamp(ruleContext, fdoSupport),
runtimeSolibDir,
nativeDeps,
useTestOnlyFlags,
@@ -746,6 +751,11 @@ public final class LinkCommandLine extends CommandLine {
return this;
}
+ public Builder setFdoSupport(FdoSupport fdoSupport) {
+ this.fdoSupport = fdoSupport;
+ return this;
+ }
+
/** Sets the tool path, with tool being the first thing on the command line */
public Builder setToolPath(String toolPath) {
this.toolPath = toolPath;