Commit a8a49c98 authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Erik Verbruggen

CDB: fix breakpoint location in catch clauses.

Task-number: QTCREATORBUG-7336

Change-Id: I926e82499325e4fe38e25cc7a6158050f7fc0e82
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent cdbbf377
......@@ -212,6 +212,7 @@ bool FindCdbBreakpoint::visit(SwitchStatementAST *ast)
bool FindCdbBreakpoint::visit(TryBlockStatementAST *ast)
{
accept(ast->statement);
accept(ast->catch_clause_list);
return false;
}
......
......@@ -46,6 +46,7 @@ private slots:
void findBreakpoints();
void findBreakpoints2();
void findBreakpoints3();
};
void tst_Misc::diagnosticClient_error()
......@@ -155,7 +156,7 @@ void tst_Misc::findBreakpoints2()
" }\n"
"}\n"
);
Document::Ptr doc = Document::create("findContstructorBreakpoint");
Document::Ptr doc = Document::create("findSwitchBreakpoint");
QVERIFY(!doc.isNull());
doc->setUtf8Source(src);
bool success = doc->parse();
......@@ -173,5 +174,32 @@ void tst_Misc::findBreakpoints2()
QCOMPARE(findBreakpoint(7), 7U);
}
void tst_Misc::findBreakpoints3()
{
const QByteArray src("\n" // line 0
"int foo() {\n"
" try {\n" // line 2
" bar();\n" // line 3
" } catch (Mooze &m) {\n" // line 4
" wooze();\n" // line 5
" }\n"
" return 0;\n" // line 7
"}\n"
);
Document::Ptr doc = Document::create("findCatchBreakpoint");
QVERIFY(!doc.isNull());
doc->setUtf8Source(src);
bool success = doc->parse();
QVERIFY(success);
QCOMPARE(doc->diagnosticMessages().size(), 0);
FindCdbBreakpoint findBreakpoint(doc->translationUnit());
QCOMPARE(findBreakpoint(2), 3U);
QCOMPARE(findBreakpoint(3), 3U);
QCOMPARE(findBreakpoint(4), 5U);
QCOMPARE(findBreakpoint(5), 5U);
QCOMPARE(findBreakpoint(7), 7U);
}
QTEST_MAIN(tst_Misc)
#include "tst_misc.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment