diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-09-25 11:00:25 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-09-25 11:00:25 +0200 |
commit | cfdea6b9c21a01bef9e73b23ad99a020ed2e0721 (patch) | |
tree | 4aff97b7d53cba52df60b22853f47e0f7e3f7685 | |
parent | 75f13f200b9930fb0da0384f6364a703a3ce7e9f (diff) | |
parent | 846d89811a72f96909ad137fb973983f568c3643 (diff) |
Merge remote-tracking branch 'origin/4.4'
Change-Id: I7bf72444b19db20fcc7dc2c9d1f02ec2b30b658f
-rw-r--r-- | share/qtcreator/debugger/lldbbridge.py | 6 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Lexer.cpp | 16 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/searchresultwidget.cpp | 15 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/searchresultwidget.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/lldb/lldbengine.cpp | 2 | ||||
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 1 | ||||
-rw-r--r-- | tests/auto/cplusplus/lexer/tst_lexer.cpp | 8 | ||||
-rw-r--r-- | tests/auto/cplusplus/misc/tst_misc.cpp | 13 | ||||
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 20 |
9 files changed, 47 insertions, 36 deletions
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index be1678de45..181b7ac657 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1258,9 +1258,7 @@ class Dumper(DumperBase): if not skipEventReporting: self.eventState = state if state == lldb.eStateExited: - if self.isShuttingDown_: - self.reportState("inferiorshutdownok") - else: + if not self.isShuttingDown_: self.reportState("inferiorexited") self.report('exited={status="%s",desc="%s"}' % (self.process.GetExitStatus(), self.process.GetExitDescription())) @@ -1290,7 +1288,7 @@ class Dumper(DumperBase): return if self.isInterrupting_: self.isInterrupting_ = False - self.reportState("stopped") + self.reportState("inferiorstopok") elif self.ignoreStops > 0: self.ignoreStops -= 1 self.process.Continue() diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp index e62c9412a4..079ae0ca6e 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.cpp +++ b/src/libs/3rdparty/cplusplus/Lexer.cpp @@ -211,7 +211,7 @@ void Lexer::scan_helper(Token *tok) _state = 0; scanCppComment(originalKind); return; - } else if (isRawStringLiteral(s._tokenKind)) { + } else if (!control() && isRawStringLiteral(s._tokenKind)) { tok->f.kind = s._tokenKind; if (scanUntilRawStringLiteralEndSimple()) _state = 0; @@ -755,13 +755,17 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint) yyinp(); } else if (_yychar == ')') { yyinp(); - if (delimLength == -1) - break; + if (delimLength == -1) { + tok->f.kind = T_ERROR; + return; + } closingDelimCandidate = _currentChar; } else { if (delimLength == -1) { - if (_yychar == '\\' || std::isspace(_yychar)) - break; + if (_yychar == '\\' || std::isspace(_yychar)) { + tok->f.kind = T_ERROR; + return; + } yyinp(); } else { if (!closingDelimCandidate) { @@ -804,7 +808,7 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint) else tok->f.kind = T_RAW_STRING_LITERAL; - if (!closed) + if (!control() && !closed) s._tokenKind = tok->f.kind; } diff --git a/src/plugins/coreplugin/find/searchresultwidget.cpp b/src/plugins/coreplugin/find/searchresultwidget.cpp index 3db6a08f26..9eee8dee63 100644 --- a/src/plugins/coreplugin/find/searchresultwidget.cpp +++ b/src/plugins/coreplugin/find/searchresultwidget.cpp @@ -210,8 +210,6 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) : this, &SearchResultWidget::handleReplaceButton); connect(m_replaceButton, &QAbstractButton::clicked, this, &SearchResultWidget::handleReplaceButton); - connect(m_replaceTextEdit, &QLineEdit::textChanged, - this, &SearchResultWidget::handleReplaceEditTextChanged); } SearchResultWidget::~SearchResultWidget() @@ -306,7 +304,6 @@ void SearchResultWidget::setSupportsReplace(bool replaceSupported, const QString void SearchResultWidget::setTextToReplace(const QString &textToReplace) { - m_replaceText = textToReplace; m_replaceTextEdit->setText(textToReplace); } @@ -409,6 +406,7 @@ void SearchResultWidget::goToPrevious() void SearchResultWidget::restart() { m_replaceTextEdit->setEnabled(false); + m_replaceButton->setEnabled(false); m_searchResultTreeView->clear(); m_count = 0; Id sizeWarningId(SIZE_WARNING_ID); @@ -418,7 +416,6 @@ void SearchResultWidget::restart() m_searchAgainButton->setVisible(false); m_messageWidget->setVisible(false); updateMatchesFoundLabel(); - handleReplaceEditTextChanged(); emit restarted(); } @@ -439,6 +436,7 @@ void SearchResultWidget::finishSearch(bool canceled) m_infoBar.removeInfo(sizeWarningId); m_infoBar.enableInfo(sizeWarningId); m_replaceTextEdit->setEnabled(m_count > 0); + m_replaceButton->setEnabled(m_count > 0); m_preserveCaseCheck->setEnabled(m_count > 0); m_cancelButton->setVisible(false); m_messageWidget->setVisible(canceled); @@ -463,15 +461,6 @@ void SearchResultWidget::cancelAfterSizeWarning() emit paused(false); } -void SearchResultWidget::handleReplaceEditTextChanged() -{ - const bool enabled = m_replaceTextEdit->text() != m_replaceText; - m_replaceButton->setEnabled(enabled); - m_replaceButton->setToolTip(enabled - ? QString() - : tr("Cannot replace because replacement text is unchanged.")); -} - void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item) { emit activated(item); diff --git a/src/plugins/coreplugin/find/searchresultwidget.h b/src/plugins/coreplugin/find/searchresultwidget.h index bf4b905544..5309ed69e1 100644 --- a/src/plugins/coreplugin/find/searchresultwidget.h +++ b/src/plugins/coreplugin/find/searchresultwidget.h @@ -115,7 +115,6 @@ private: void setShowReplaceUI(bool visible); void continueAfterSizeWarning(); void cancelAfterSizeWarning(); - void handleReplaceEditTextChanged(); QList<SearchResultItem> checkedItems() const; void updateMatchesFoundLabel(); @@ -142,7 +141,6 @@ private: bool m_isShowingReplaceUI = false; bool m_searchAgainSupported = false; bool m_replaceSupported = false; - QString m_replaceText; }; } // Internal diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 6cc5234b3c..bf00138e9b 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -891,6 +891,8 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState) } } else if (newState == "inferiorstopok") { notifyInferiorStopOk(); + if (!isDying()) + updateAll(); } else if (newState == "inferiorstopfailed") notifyInferiorStopFailed(); else if (newState == "inferiorill") diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 48a2870720..80365d7449 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4324,7 +4324,6 @@ void TextEditorWidget::paintEvent(QPaintEvent *e) for (int i = line.lineNumber() + 1; i < eline.lineNumber(); ++i) { rr = layout->lineAt(i).naturalTextRect(); rr.moveTop(rr.top() + r.top()); - rr.setLeft(r.left() + x); painter.fillRect(rr, palette().highlight()); } diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp index a2c415d33c..1721efaedd 100644 --- a/tests/auto/cplusplus/lexer/tst_lexer.cpp +++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp @@ -366,6 +366,14 @@ void tst_SimpleLexer::literals_data() << T_RAW_STRING_LITERAL ; QTest::newRow("raw-string-literals") << source << expectedTokenKindList; + + source = "R\"\\" ; + expectedTokenKindList = TokenKindList() << T_ERROR; + QTest::newRow("invalid-raw-string-literals1") << source << expectedTokenKindList; + + source = "R\")" ; + expectedTokenKindList = TokenKindList() << T_ERROR; + QTest::newRow("invalid-raw-string-literals2") << source << expectedTokenKindList; } void tst_SimpleLexer::preprocessor() diff --git a/tests/auto/cplusplus/misc/tst_misc.cpp b/tests/auto/cplusplus/misc/tst_misc.cpp index aff5a12ce0..808408df40 100644 --- a/tests/auto/cplusplus/misc/tst_misc.cpp +++ b/tests/auto/cplusplus/misc/tst_misc.cpp @@ -48,6 +48,8 @@ private slots: void astPathOnGeneratedTokens(); void typeMatcher(); + + void doNotCrashForInvalidRawString(); }; void tst_Misc::diagnosticClient_error() @@ -266,5 +268,16 @@ void tst_Misc::typeMatcher() } } +void tst_Misc::doNotCrashForInvalidRawString() +{ + const QByteArray src("\n" + "void f() { enum { Size = sizeof(R\"[^\\s]+([^]+)*\") }; }" + "}\n" + ); + Document::Ptr doc = Document::create("crash"); + doc->setUtf8Source(src); + doc->check(); +} + QTEST_MAIN(tst_Misc) #include "tst_misc.moc" diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 80cca223b4..76bd2fe221 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1049,7 +1049,7 @@ void tst_Dumpers::initTestCase() ok = debugger.waitForFinished(); QVERIFY(ok); QByteArray output = debugger.readAllStandardOutput(); - //qDebug() << "stdout: " << output; + //qDebug().noquote() << "stdout: " << output; bool usePython = !output.contains("Python scripting is not supported in this copy of GDB"); qDebug() << "Python : " << (usePython ? "ok" : "*** not ok ***"); qDebug() << "Dumper dir : " << DUMPERDIR; @@ -1418,11 +1418,11 @@ void tst_Dumpers::dumper() error = make.readAllStandardError(); //qDebug() << "stdout: " << output; if (make.exitCode()) { - qDebug() << error; + qDebug().noquote() << error; qDebug() << "\n------------------ CODE --------------------"; - qDebug() << fullCode; + qDebug().noquote() << fullCode; qDebug() << "\n------------------ CODE --------------------"; - qDebug() << "Project file: " << proFile.fileName(); + qDebug().noquote() << "Project file: " << proFile.fileName(); } if (data.neededDwarfVersion.isRestricted) { @@ -1588,7 +1588,7 @@ void tst_Dumpers::dumper() if (m_debuggerEngine == GdbEngine) { int posDataStart = output.indexOf("data="); if (posDataStart == -1) { - qDebug() << "NO \"data=\" IN OUTPUT: " << output; + qDebug().noquote() << "NO \"data=\" IN OUTPUT: " << output; QVERIFY(posDataStart != -1); } contents = output.mid(posDataStart); @@ -1600,7 +1600,7 @@ void tst_Dumpers::dumper() //qDebug() << "FOUND NS: " << context.nameSpace; } else if (m_debuggerEngine == LldbEngine) { - //qDebug() << "GOT OUTPUT: " << output; + //qDebug().noquote() << "GOT OUTPUT: " << output; int pos = output.indexOf("data=[{"); QVERIFY(pos != -1); output = output.mid(pos); @@ -1608,7 +1608,7 @@ void tst_Dumpers::dumper() int posNameSpaceStart = output.indexOf("@NS@"); if (posNameSpaceStart == -1) - qDebug() << "OUTPUT: " << output; + qDebug().noquote() << "OUTPUT: " << output; QVERIFY(posNameSpaceStart != -1); posNameSpaceStart += sizeof("@NS@") - 1; int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart); @@ -1624,7 +1624,7 @@ void tst_Dumpers::dumper() QByteArray locals("|script|"); int localsBeginPos = output.indexOf(locals, output.indexOf(localsAnswerStart)); if (localsBeginPos == -1) - qDebug() << "OUTPUT: " << output; + qDebug().noquote() << "OUTPUT: " << output; QVERIFY(localsBeginPos != -1); do { const int msgStart = localsBeginPos + locals.length(); @@ -1755,8 +1755,8 @@ void tst_Dumpers::dumper() break; qDebug() << "MSG: " << fullOutput.mid(pos1, pos2 - pos1 - 1); } - qDebug() << "CONTENTS : " << contents; - qDebug() << "FULL OUTPUT : " << fullOutput.data(); + qDebug().noquote() << "CONTENTS : " << contents; + qDebug().noquote() << "FULL OUTPUT : " << fullOutput.data(); qDebug() << "Qt VERSION : " << QString::number(context.qtVersion, 16); if (m_debuggerEngine != CdbEngine) qDebug() << "GCC VERSION : " << context.gccVersion; |