Debugger: split fixCppExpression into some common and some cdb part

Task-number: QTCREATORBUG-8446
Change-Id: I79abc7f75779db15bd8700c085b9cd57411bb2e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
hjk
2013-01-09 14:51:49 +01:00
parent 18408a5f58
commit 2a0bb34911
5 changed files with 14 additions and 3 deletions

View File

@@ -820,7 +820,7 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
// free debugger expression.
QString fixCppExpression(const QString &expIn)
{
QString exp = expIn;
QString exp = expIn.trimmed();;
// Extract the first identifier, everything else is considered
// too dangerous.
int pos1 = 0, pos2 = exp.size();
@@ -838,7 +838,12 @@ QString fixCppExpression(const QString &expIn)
}
}
exp = exp.mid(pos1, pos2 - pos1);
return removeObviousSideEffects(exp);
}
QString removeObviousSideEffects(const QString &expIn)
{
QString exp = expIn.trimmed();
if (exp.isEmpty() || exp.startsWith(QLatin1Char('#')) || !hasLetterOrNumber(exp) || isKeyWord(exp))
return QString();