aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-10-04 23:14:11 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-10-06 19:45:42 +0200
commitdd76465e3fc0295173c77962d25080323b6f4b70 (patch)
treef7f45cae571cefe608b589fea55f22ce070b5358 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
parent60be5313ba36223e498db0e56f272ba3f736b978 (diff)
Refactor CppHelper.mallocForTarget() to allow specifying the name of the
malloc attribute. PiperOrigin-RevId: 171061196
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
index 6a21ba0b9d..fc7bda0f34 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java
@@ -132,14 +132,19 @@ public class CppHelper {
/**
* Returns the malloc implementation for the given target.
*/
- public static TransitiveInfoCollection mallocForTarget(RuleContext ruleContext) {
+ public static TransitiveInfoCollection mallocForTarget(
+ RuleContext ruleContext, String mallocAttrName) {
if (ruleContext.getFragment(CppConfiguration.class).customMalloc() != null) {
return ruleContext.getPrerequisite(":default_malloc", Mode.TARGET);
} else {
- return ruleContext.getPrerequisite("malloc", Mode.TARGET);
+ return ruleContext.getPrerequisite(mallocAttrName, Mode.TARGET);
}
}
+ public static TransitiveInfoCollection mallocForTarget(RuleContext ruleContext) {
+ return mallocForTarget(ruleContext, "malloc");
+ }
+
/**
* Expands Make variables in a list of string and tokenizes the result. If the package feature
* no_copts_tokenization is set, tokenize only items consisting of a single make variable.