From 33d1a8c3075712b9fac34a70ba136a012686a6fa Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 29 Oct 2015 10:20:53 +0100 Subject: [PATCH 1/2] Fix support for data tags Functions defined within the declaration or inside a namespace had no qualified name stored by the visitor. This lead to ignoring them when creating the respective TestTreeItem. Change-Id: Id57c0c492a0cba460aa2d47dc7283bb1ac6e4aa6 Reviewed-by: Nikolai Kosjar --- plugins/autotest/testvisitor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/autotest/testvisitor.cpp b/plugins/autotest/testvisitor.cpp index 3fe84cb0776..7102476a7d1 100644 --- a/plugins/autotest/testvisitor.cpp +++ b/plugins/autotest/testvisitor.cpp @@ -177,15 +177,14 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast) { if (ast->declarator) { CPlusPlus::DeclaratorIdAST *id = ast->declarator->core_declarator->asDeclaratorId(); - if (!id) + if (!id || !ast->symbol || ast->symbol->argumentCount() != 0) return false; - const QString prettyName = m_overview.prettyName(id->name->name); + CPlusPlus::LookupContext lc; + const QString prettyName = m_overview.prettyName(lc.fullyQualifiedName(ast->symbol)); // do not handle functions that aren't real test data functions - if (!prettyName.endsWith(QLatin1String("_data")) || !ast->symbol - || ast->symbol->argumentCount() != 0) { + if (!prettyName.endsWith(QLatin1String("_data"))) return false; - } m_currentFunction = prettyName.left(prettyName.size() - 5); m_currentTags.clear(); From 128995b272998e998fc8c1aacc8e4a1449bd4ac8 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 29 Oct 2015 10:14:35 +0100 Subject: [PATCH 2/2] Fix potential crash There's no need to call beginXYZ() or endXYZ() on our own as this is done by TreeModel. Change-Id: I647f280a45c5f3ebb191a8e945c423eed22d677c Reviewed-by: Niels Weber Reviewed-by: David Schulz --- plugins/autotest/testtreemodel.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 2f7366b3793..49e28c3ba35 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -631,14 +631,10 @@ void TestTreeModel::processChildren(QModelIndex &parentIndex, const TestTreeItem // handle data tags - just remove old and add them if (modifiedChild->childCount() || toBeModifiedChild->childCount()) { - beginRemoveRows(child, 0, toBeModifiedChild->childCount()); toBeModifiedChild->removeChildren(); - endRemoveRows(); const int count = modifiedChild->childCount(); - beginInsertRows(child, 0, count); for (int childRow = 0; childRow < count; ++childRow) toBeModifiedChild->appendChild(new TestTreeItem(*modifiedChild->childItem(childRow))); - endInsertRows(); } if (checkStates.contains(toBeModifiedChild->name())) {