aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/macroexpander.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2015-09-17 13:48:02 +0200
committerTobias Hunger <tobias.hunger@theqtcompany.com>2015-09-21 12:01:31 +0000
commit3f1b622fb7203392de0fa9a8a058b807ee9d4006 (patch)
tree2e440bc5672e23d7602135cd076d24c57812cf18 /src/libs/utils/macroexpander.cpp
parent39e8a3abf3d114a2f688d0f98d3c894af5913a78 (diff)
VariableManager: Do not try to expand Prefixes
Resolving "Prefix:<value>" does not make any sense, so let's not do that. Task-number: QTCREATORBUG-15072 Change-Id: Ia9741f9b48d269a7be31163ad73c3bc232856419 Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/libs/utils/macroexpander.cpp')
-rw-r--r--src/libs/utils/macroexpander.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp
index 159974d0d23..c4edccbdd60 100644
--- a/src/libs/utils/macroexpander.cpp
+++ b/src/libs/utils/macroexpander.cpp
@@ -302,6 +302,14 @@ QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const
return QtcProcess::expandMacros(argsWithVariables, d);
}
+static QByteArray fullPrefix(const QByteArray &prefix)
+{
+ QByteArray result = prefix;
+ if (!result.endsWith(':'))
+ result.append(':');
+ return result;
+}
+
/*!
* Makes the given string-valued \a prefix known to the variable manager,
* together with a localized \a description.
@@ -314,9 +322,7 @@ QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const
void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &description,
const MacroExpander::PrefixFunction &value)
{
- QByteArray tmp = prefix;
- if (!tmp.endsWith(':'))
- tmp.append(':');
+ QByteArray tmp = fullPrefix(prefix);
d->m_descriptions.insert(tmp + "<value>", description);
d->m_prefixMap.insert(tmp, value);
}
@@ -430,6 +436,11 @@ QString MacroExpander::variableDescription(const QByteArray &variable) const
return d->m_descriptions.value(variable);
}
+bool MacroExpander::isPrefixVariable(const QByteArray &variable) const
+{
+ return d->m_prefixMap.contains(fullPrefix(variable));
+}
+
MacroExpanderProviders MacroExpander::subProviders() const
{
return d->m_subProviders;