Merge remote-tracking branch 'origin/4.4'

Change-Id: I7bf72444b19db20fcc7dc2c9d1f02ec2b30b658f
This commit is contained in:
Eike Ziller
2017-09-25 11:00:25 +02:00
9 changed files with 47 additions and 36 deletions

View File

@@ -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()

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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")

View File

@@ -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());
}

View File

@@ -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()

View File

@@ -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"

View File

@@ -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;