summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/sourceutils.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-02-26 09:14:38 +0200
committerOrgad Shaneh <orgads@gmail.com>2015-02-27 15:11:14 +0000
commitd63624afe003e721c3079ad65913831385f5a1e0 (patch)
treeace7625eda7c085ecdfb7f31867bbd24c03591c1 /src/plugins/debugger/sourceutils.cpp
parent1a37605f919a761892cb4c4759265956e0efa453 (diff)
downloadqt-creator-d63624afe003e721c3079ad65913831385f5a1e0.tar.gz
C++: Accept language features in BackwardsScanner et al
Change-Id: Id97ca27fa909979573efca12dc0cd14b28eacd17 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/sourceutils.cpp')
-rw-r--r--src/plugins/debugger/sourceutils.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp
index 459f9a23ee..0e4ff6ae38 100644
--- a/src/plugins/debugger/sourceutils.cpp
+++ b/src/plugins/debugger/sourceutils.cpp
@@ -286,6 +286,9 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
if (function)
function->clear();
+ const QString fileName = editorWidget->textDocument()->filePath().toString();
+ const Snapshot snapshot = CppModelManager::instance()->snapshot();
+ const Document::Ptr document = snapshot.document(fileName);
QTextCursor tc = editorWidget->textCursor();
QString expr = tc.selectedText();
if (expr.isEmpty()) {
@@ -295,21 +298,18 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
tc.movePosition(QTextCursor::EndOfWord);
// Fetch the expression's code.
- ExpressionUnderCursor expressionUnderCursor;
+ ExpressionUnderCursor expressionUnderCursor(document ? document->languageFeatures()
+ : LanguageFeatures::defaultFeatures());
expr = expressionUnderCursor(tc);
}
*column = tc.positionInBlock();
*line = tc.blockNumber() + 1;
- if (!expr.isEmpty()) {
- QString fileName = editorWidget->textDocument()->filePath().toString();
- const Snapshot snapshot = CppModelManager::instance()->snapshot();
- if (const Document::Ptr document = snapshot.document(fileName)) {
- QString func = document->functionAt(*line, *column, scopeFromLine, scopeToLine);
- if (function)
- *function = func;
- }
+ if (!expr.isEmpty() && document) {
+ QString func = document->functionAt(*line, *column, scopeFromLine, scopeToLine);
+ if (function)
+ *function = func;
}
return expr;