diff options
author | The Qt Project <gerrit-noreply@qt-project.org> | 2020-10-22 12:43:04 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2020-10-22 12:43:04 +0000 |
commit | ffb5a3977fc2f50836d9c9c4e96acc65e254f24c (patch) | |
tree | 052e31fa47992fe8747f9a87164a777b18594759 | |
parent | 5a8501ffafd24725106b687c8c658354bb370f26 (diff) | |
parent | 9c6108afd1d49f5c1865840c8477ce6728022691 (diff) |
Merge "Merge remote-tracking branch 'origin/4.14' into master"
22 files changed, 162 insertions, 83 deletions
diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 7ab0201d97..cc9a25788f 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -426,12 +426,13 @@ jobs: set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") execute_process( - COMMAND ctest -j ${N} + COMMAND ctest -j ${N} --timeout 5 WORKING_DIRECTORY build/build RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE output ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE + TIMEOUT 600 ) if (NOT result EQUAL 0) string(REGEX MATCH "[0-9]+% tests.*[0-9.]+ sec.*$" test_results "${output}") diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in new file mode 100644 index 0000000000..647a8462a9 --- /dev/null +++ b/cmake/Config.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +if (NOT TARGET QtCreator::@target_name@) + include ("${CMAKE_CURRENT_LIST_DIR}/@export@Targets.cmake") +endif() diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 9bb2764959..2e1183c75e 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -29,6 +29,9 @@ list(APPEND DEFAULT_DEFINES RELATIVE_DOC_PATH="${RELATIVE_DOC_PATH}" ) +# use CMAKE_CURRENT_FUNCTION_LIST_DIR when we can require CMake 3.17 +set(_THIS_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + option(BUILD_PLUGINS_BY_DEFAULT "Build plugins by default. This can be used to build all plugins by default, or none." ON) option(BUILD_EXECUTABLES_BY_DEFAULT "Build executables by default. This can be used to build all executables by default, or none." ON) option(BUILD_LIBRARIES_BY_DEFAULT "Build libraries by default. This can be used to build all libraries by default, or none." ON) @@ -214,7 +217,7 @@ function(add_qtc_library name) endif() install(TARGETS ${name} - EXPORT ${IDE_CASED_ID} + EXPORT QtCreator RUNTIME DESTINATION "${_DESTINATION}" ${COMPONENT_OPTION} @@ -264,7 +267,7 @@ endfunction(add_qtc_library) function(add_qtc_plugin target_name) cmake_parse_arguments(_arg - "EXPERIMENTAL;SKIP_DEBUG_CMAKE_FILE_CHECK;SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION" + "EXPERIMENTAL;SKIP_DEBUG_CMAKE_FILE_CHECK;SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION;EXPORT" "VERSION;COMPAT_VERSION;PLUGIN_JSON_IN;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT" "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PROPERTIES" ${ARGN} @@ -459,8 +462,14 @@ function(add_qtc_plugin target_name) enable_pch(${target_name}) if (NOT _arg_SKIP_INSTALL) + if (_arg_EXPORT) + set(export QtCreator${target_name}) + else() + set(export QtCreator) + endif() + install(TARGETS ${target_name} - EXPORT ${IDE_CASED_ID} + EXPORT ${export} RUNTIME DESTINATION "${plugin_dir}" OPTIONAL LIBRARY DESTINATION "${plugin_dir}" OPTIONAL ARCHIVE @@ -468,6 +477,30 @@ function(add_qtc_plugin target_name) COMPONENT Devel EXCLUDE_FROM_ALL OPTIONAL ) + + if (_arg_EXPORT) + # export of external plugins + install(EXPORT ${export} + FILE ${export}Targets.cmake + DESTINATION lib/cmake/${export} + COMPONENT Devel EXCLUDE_FROM_ALL + NAMESPACE QtCreator:: + ) + include(CMakePackageConfigHelpers) + configure_package_config_file(${_THIS_MODULE_BASE_DIR}/Config.cmake.in + "${CMAKE_BINARY_DIR}/cmake/${export}Config.cmake" + INSTALL_DESTINATION lib/cmake/${export} + ) + install( + FILES ${CMAKE_BINARY_DIR}/cmake/${export}Config.cmake + DESTINATION lib/cmake/${export} + COMPONENT Devel EXCLUDE_FROM_ALL + ) + export(EXPORT ${export} + NAMESPACE QtCreator:: + FILE ${CMAKE_BINARY_DIR}/cmake/${export}Targets.cmake + ) + endif() get_target_property(target_suffix ${target_name} SUFFIX) get_target_property(target_prefix ${target_name} PREFIX) if (target_suffix STREQUAL "target_suffix-NOTFOUND") diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 5d32f8426c..f5ee86c349 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -1117,7 +1117,8 @@ class Dumper(DumperBase): self.qtCustomEventPltFunc = self.findSymbol(sym) sym = '_ZNK%s7QObject8propertyEPKc' % strns - self.qtPropertyFunc = self.findSymbol(sym) + if not self.isWindowsTarget(): # prevent calling the property function on windows + self.qtPropertyFunc = self.findSymbol(sym) def assignValue(self, args): typeName = self.hexdecode(args['type']) diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index aa3e9ecc0c..5fd48d816c 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -1982,18 +1982,9 @@ def qdump__QVariant(d, value): if d.isExpanded(): innerType = None with Children(d): - ev = d.parseAndEvaluate - p = None - if p is None: - # Without debug info. - symbol = d.mangleName(d.qtNamespace() + 'QMetaType::typeName') + 'i' - p = ev('((const char *(*)(int))%s)(%d)' % (symbol, variantType)) - #if p is None: - # p = ev('((const char *(*)(int))%sQMetaType::typeName)(%d)' % (ns, variantType)) - if p is None: - # LLDB on Linux - p = ev('((const char *(*)(int))QMetaType::typeName)(%d)' % variantType) - if p is None: + try: + p = d.call('const char *', value, 'typeName') + except: d.putSpecialValue('notcallable') return None ptr = p.pointer() diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml index 928b8c4df7..d3fd86ca10 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/InternalConstants.qml @@ -102,33 +102,35 @@ QtObject { readonly property string lockOn: "\u005F" readonly property string mergeCells: "\u0060" readonly property string minus: "\u0061" - readonly property string plus: "\u0062" - readonly property string redo: "\u0063" - readonly property string splitColumns: "\u0064" - readonly property string splitRows: "\u0065" - readonly property string startNode: "\u0066" - readonly property string testIcon: "\u0067" - readonly property string textAlignBottom: "\u0068" - readonly property string textAlignCenter: "\u0069" - readonly property string textAlignLeft: "\u006A" - readonly property string textAlignMiddle: "\u006B" - readonly property string textAlignRight: "\u006C" - readonly property string textAlignTop: "\u006D" - readonly property string textBulletList: "\u006E" - readonly property string textFullJustification: "\u006F" - readonly property string textNumberedList: "\u0070" - readonly property string tickIcon: "\u0071" - readonly property string triState: "\u0072" - readonly property string undo: "\u0073" - readonly property string upDownIcon: "\u0074" - readonly property string upDownSquare2: "\u0075" - readonly property string visibilityOff: "\u0076" - readonly property string visibilityOn: "\u0077" - readonly property string wildcard: "\u0078" - readonly property string zoomAll: "\u0079" - readonly property string zoomIn: "\u007A" - readonly property string zoomOut: "\u007B" - readonly property string zoomSelection: "\u007C" + readonly property string pin: "\u0062" + readonly property string plus: "\u0063" + readonly property string redo: "\u0064" + readonly property string splitColumns: "\u0065" + readonly property string splitRows: "\u0066" + readonly property string startNode: "\u0067" + readonly property string testIcon: "\u0068" + readonly property string textAlignBottom: "\u0069" + readonly property string textAlignCenter: "\u006A" + readonly property string textAlignLeft: "\u006B" + readonly property string textAlignMiddle: "\u006C" + readonly property string textAlignRight: "\u006D" + readonly property string textAlignTop: "\u006E" + readonly property string textBulletList: "\u006F" + readonly property string textFullJustification: "\u0070" + readonly property string textNumberedList: "\u0071" + readonly property string tickIcon: "\u0072" + readonly property string triState: "\u0073" + readonly property string undo: "\u0074" + readonly property string unpin: "\u0075" + readonly property string upDownIcon: "\u0076" + readonly property string upDownSquare2: "\u0077" + readonly property string visibilityOff: "\u0078" + readonly property string visibilityOn: "\u0079" + readonly property string wildcard: "\u007A" + readonly property string zoomAll: "\u007B" + readonly property string zoomIn: "\u007C" + readonly property string zoomOut: "\u007D" + readonly property string zoomSelection: "\u007E" readonly property font iconFont: Qt.font({ "family": controlIcons.name, diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf Binary files differindex b8addaf835..a82278be11 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc8a731820..dfc9c24cf7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -76,6 +76,7 @@ file(COPY ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake ${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake + ${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in DESTINATION ${CMAKE_BINARY_DIR}/cmake ) @@ -87,6 +88,8 @@ install( ${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake + ${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake + ${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in ${CMAKE_BINARY_DIR}/cmake/QtCreatorConfig.cmake DESTINATION lib/cmake/QtCreator COMPONENT Devel EXCLUDE_FROM_ALL diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index bdd1381f37..1685368817 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -348,6 +348,8 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex) } if ((*it)->asCall()) return checkPotentialWrite(getUsageTypeForCall(it), it + 1); + if ((*it)->asDeleteExpression()) + return Usage::Type::Write; if (const auto binExpr = (*it)->asBinaryExpression()) { if (binExpr->left_expression == *(it - 1) && isAssignment(binExpr->binary_op_token)) return checkPotentialWrite(Usage::Type::Write, it + 1); diff --git a/src/plugins/autotest/qtest/qttestvisitors.cpp b/src/plugins/autotest/qtest/qttestvisitors.cpp index 7b8374985b..e1757e23f1 100644 --- a/src/plugins/autotest/qtest/qttestvisitors.cpp +++ b/src/plugins/autotest/qtest/qttestvisitors.cpp @@ -226,6 +226,9 @@ bool TestDataFunctionVisitor::visit(CallAST *ast) bool ok = false; QString name = extractNameFromAST(stringLiteral, &ok); if (ok) { + // if it's a format string we skip as we cannot assure correct tag name + if (name.contains('%') && expressionListAST->next != nullptr) + return true; int line = 0; int column = 0; m_currentDoc->translationUnit()->getTokenStartPosition( @@ -279,10 +282,12 @@ bool TestDataFunctionVisitor::newRowCallFound(CallAST *ast, unsigned *firstToken return false; if (const auto qualifiedNameAST = exp->name->asQualifiedName()) { - found = m_overview.prettyName(qualifiedNameAST->name) == "QTest::newRow"; + const QString name = m_overview.prettyName(qualifiedNameAST->name); + found = (name == "QTest::newRow" || name == "QTest::addRow"); *firstToken = qualifiedNameAST->firstToken(); } else if (m_insideUsingQTest) { - found = m_overview.prettyName(exp->name->name) == "newRow"; + const QString name = m_overview.prettyName(exp->name->name); + found = (name == "newRow" || name == "addRow"); *firstToken = exp->name->firstToken(); } } diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index c362ff1ee0..a023342e3f 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -4283,6 +4283,23 @@ void CppEditorPlugin::test_quickfix_InsertDefsFromDecls_data() } // namespace N)"; QTest::addRow("no candidates") + << QByteArrayList{origHeader, origHeader} + << QByteArrayList{origSource, origSource} + << int(InsertDefsFromDecls::Mode::Alternating); + + origHeader = R"( + namespace N { + class @C + { + public: + friend void ignoredFriend(); + void ignoredImplemented() {}; + + signals: + void ignoredSignal(); + }; + } // namespace N)"; + QTest::addRow("no member functions") << QByteArrayList{origHeader, ""} << QByteArrayList{origSource, ""} << int(InsertDefsFromDecls::Mode::Alternating); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 10e99470ac..867740aea8 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3487,12 +3487,11 @@ public: m_classAST = path.at(path.size() - 2)->asClassSpecifier(); if (!m_classAST) return; - const Class * const theClass = m_classAST->symbol; if (!theClass) return; - // Collect all member functions without an implementation. + // Collect all member functions. for (auto it = theClass->memberBegin(); it != theClass->memberEnd(); ++it) { Symbol * const s = *it; if (!s->identifier() || !s->type() || !s->isDeclaration() || s->asFunction()) @@ -3500,8 +3499,6 @@ public: Function * const func = s->type()->asFunctionType(); if (!func || func->isSignal() || func->isFriend()) continue; - if (SymbolFinder().findMatchingDefinition(s, interface.snapshot())) - continue; m_declarations << s; } } @@ -3512,7 +3509,14 @@ public: private: void perform() override { - QTC_ASSERT(!m_declarations.isEmpty(), return); + QList<Symbol *> unimplemented; + SymbolFinder symbolFinder; + for (Symbol * const s : qAsConst(m_declarations)) { + if (!symbolFinder.findMatchingDefinition(s, snapshot())) + unimplemented << s; + } + if (unimplemented.isEmpty()) + return; CppRefactoringChanges refactoring(snapshot()); const bool isHeaderFile = ProjectFile::isHeader(ProjectFile::classify(filePath().toString())); @@ -3520,7 +3524,7 @@ private: if (isHeaderFile) { InsertionPointLocator locator(refactoring); for (const InsertionLocation &location - : locator.methodDefinition(m_declarations.first(), false, {})) { + : locator.methodDefinition(unimplemented.first(), false, {})) { if (!location.isValid()) continue; const QString fileName = location.fileName(); @@ -3538,7 +3542,7 @@ private: MemberFunctionImplSettings settings; switch (m_mode) { case InsertDefsFromDecls::Mode::User: { - AddImplementationsDialog dlg(m_declarations, Utils::FilePath::fromString(cppFile)); + AddImplementationsDialog dlg(unimplemented, Utils::FilePath::fromString(cppFile)); if (dlg.exec() == QDialog::Accepted) settings = dlg.settings(); break; @@ -3548,7 +3552,7 @@ private: const auto incDefPos = [&defPos] { defPos = (defPos + 1) % (DefPosImplementationFile + 2); }; - for (Symbol * const func : qAsConst(m_declarations)) { + for (Symbol * const func : qAsConst(unimplemented)) { incDefPos(); if (defPos > DefPosImplementationFile) continue; @@ -3618,8 +3622,8 @@ private: } ClassSpecifierAST *m_classAST = nullptr; - QList<Symbol *> m_declarations; InsertDefsFromDecls::Mode m_mode; + QList<Symbol *> m_declarations; }; diff --git a/src/plugins/qmakeprojectmanager/qmakesettings.cpp b/src/plugins/qmakeprojectmanager/qmakesettings.cpp index b0edf3a404..cd77fcf3e2 100644 --- a/src/plugins/qmakeprojectmanager/qmakesettings.cpp +++ b/src/plugins/qmakeprojectmanager/qmakesettings.cpp @@ -92,7 +92,7 @@ void QmakeSettings::loadSettings() m_settings.warnAgainstUnalignedBuildDir = s->value( BUILD_DIR_WARNING_KEY, Utils::HostOsInfo::isWindowsHost()).toBool(); m_settings.alwaysRunQmake = s->value(ALWAYS_RUN_QMAKE_KEY, false).toBool(); - m_settings.runSystemFunction = s->value(RUN_SYSTEM_KEY, false).toBool(); + m_settings.runSystemFunction = s->value(RUN_SYSTEM_KEY, true).toBool(); } void QmakeSettings::storeSettings() const @@ -121,8 +121,8 @@ public: m_alwaysRunQmakeCheckbox.setChecked(QmakeSettings::alwaysRunQmake()); m_ignoreSystemCheckbox.setText(tr("Ignore qmake's system() function " "when parsing a project")); - m_ignoreSystemCheckbox.setToolTip(tr("Unchecking this option can help getting more exact " - "parsing results, but can have unwanted side effects.")); + m_ignoreSystemCheckbox.setToolTip(tr("Checking this option avoids unwanted side effects, " + "but may result in inexact parsing results.")); m_ignoreSystemCheckbox.setChecked(!QmakeSettings::runSystemFunction()); const auto layout = new QVBoxLayout(this); layout->addWidget(&m_warnAgainstUnalignedBuildDirCheckbox); diff --git a/src/plugins/qmakeprojectmanager/qmakesettings.h b/src/plugins/qmakeprojectmanager/qmakesettings.h index 0225a00bd7..b64bb5087c 100644 --- a/src/plugins/qmakeprojectmanager/qmakesettings.h +++ b/src/plugins/qmakeprojectmanager/qmakesettings.h @@ -37,7 +37,7 @@ class QmakeSettingsData { public: bool warnAgainstUnalignedBuildDir = false; bool alwaysRunQmake = false; - bool runSystemFunction = false; + bool runSystemFunction = true; }; class QmakeSettings : public QObject diff --git a/src/plugins/qmldesigner/components/componentcore/theme.h b/src/plugins/qmldesigner/components/componentcore/theme.h index 513965b18f..2e3ab229d2 100644 --- a/src/plugins/qmldesigner/components/componentcore/theme.h +++ b/src/plugins/qmldesigner/components/componentcore/theme.h @@ -111,6 +111,7 @@ public: lockOn, mergeCells, minus, + pin, plus, redo, splitColumns, @@ -129,6 +130,7 @@ public: tickIcon, triState, undo, + unpin, upDownIcon, upDownSquare2, visibilityOff, diff --git a/src/shared/qbs b/src/shared/qbs -Subproject d870a7a4535e801e1161ececccd0d85dca0a340 +Subproject 6383cac9275369220f7e547ed6ccd26e8f81dc3 diff --git a/src/tools/clangbackend/source/clangtype.cpp b/src/tools/clangbackend/source/clangtype.cpp index af58f71595..9f9b8830e9 100644 --- a/src/tools/clangbackend/source/clangtype.cpp +++ b/src/tools/clangbackend/source/clangtype.cpp @@ -76,7 +76,18 @@ bool Type::isReferencingConstant() const bool Type::isOutputArgument() const { - return isLValueReference() && !pointeeType().isConstant(); + if (isLValueReference() && !pointeeType().isConstant()) + return true; + + // We consider a pointer an output argument if it is non-const at any level. + // This is consistent with how we categorize references in CppTools. + Type t = *this; + while (t.isPointer()) { + t = t.pointeeType(); + if (!t.isConstant()) + return true; + } + return false; } bool Type::isBuiltinType() const diff --git a/src/tools/qml2puppet/qml2puppet.qbs b/src/tools/qml2puppet/qml2puppet.qbs index 63341b5dc2..f55104559c 100644 --- a/src/tools/qml2puppet/qml2puppet.qbs +++ b/src/tools/qml2puppet/qml2puppet.qbs @@ -263,13 +263,13 @@ QtcTool { Group { name: "puppet2 Qt 5 compatibility sources" - condition: useQt5Compat + condition: product.useQt5Compat files: ["editor3d/qt5compat/qquick3darealight.cpp"] } Group { name: "puppet2 Qt 5 compatibility headers" - condition: useQt5Compat + condition: product.useQt5Compat files: ["editor3d/qt5compat/qquick3darealight_p.h"] fileTags: product.useQuick3d ? [] : ["unmocable"] overrideTags: false diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp index 185d5cc554..d67033a905 100644 --- a/tests/auto/cplusplus/findusages/tst_findusages.cpp +++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp @@ -2081,6 +2081,7 @@ int main() s.n.constFunc(); s.n.nonConstFunc(); s.n.constFunc(s.value); + delete s.p; } )"; @@ -2165,7 +2166,7 @@ int main() QVERIFY(varS); QCOMPARE(varS->name()->identifier()->chars(), "s"); find(varS); - QCOMPARE(find.usages().size(), 30); + QCOMPARE(find.usages().size(), 31); QCOMPARE(find.usages().at(0).type, Usage::Type::Declaration); QCOMPARE(find.usages().at(1).type, Usage::Type::WritableRef); QCOMPARE(find.usages().at(2).type, Usage::Type::WritableRef); @@ -2184,6 +2185,7 @@ int main() QCOMPARE(find.usages().at(15).type, Usage::Type::WritableRef); QCOMPARE(find.usages().at(16).type, Usage::Type::Read); QCOMPARE(find.usages().at(17).type, Usage::Type::Read); + QCOMPARE(find.usages().at(18).type, Usage::Type::Write); // Direct access to struct variable QCOMPARE(find.usages().at(18).type, Usage::Type::Write); diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index d1a70c2ba2..657dadb2d8 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -3992,22 +3992,22 @@ void tst_Dumpers::dumper_data() + Check("my.1.value", "<1 items>", "@QStringList") + Check("my.1.value.0", "[0]", "\"World\"", "@QString") //+ CheckType("v2", "@QVariant (MyType)") - + Check("v2.data.0.key", "1", "unsigned int") % NoCdbEngine - + Check("v2.data.0.value", "<1 items>", "@QStringList") % NoCdbEngine - + Check("v2.data.0.value.0", "[0]", "\"Hello\"", "@QString") % NoCdbEngine - + Check("v2.data.1.key", "3", "unsigned int") % NoCdbEngine - + Check("v2.data.1.value", "<1 items>", "@QStringList") % NoCdbEngine - + Check("v2.data.1.value.0", "[0]", "\"World\"", "@QString") % NoCdbEngine + + Check("v2.data.0.key", "1", "unsigned int") % NeedsInferiorCall + + Check("v2.data.0.value", "<1 items>", "@QStringList") % NeedsInferiorCall + + Check("v2.data.0.value.0", "[0]", "\"Hello\"", "@QString") % NeedsInferiorCall + + Check("v2.data.1.key", "3", "unsigned int") % NeedsInferiorCall + + Check("v2.data.1.value", "<1 items>", "@QStringList") % NeedsInferiorCall + + Check("v2.data.1.value.0", "[0]", "\"World\"", "@QString") % NeedsInferiorCall + Check("list", "<3 items>", "@QList<int>") + Check("list.0", "[0]", "1", "int") + Check("list.1", "[1]", "2", "int") + Check("list.2", "[2]", "3", "int") //+ Check("v3", "", "@QVariant (@QList<int>)") - + Check("v3.data", "<3 items>", TypePattern(".*QList<int>")) % NoCdbEngine - + Check("v3.data.0", "[0]", "1", "int") % NoCdbEngine - + Check("v3.data.1", "[1]", "2", "int") % NoCdbEngine - + Check("v3.data.2", "[2]", "3", "int") % NoCdbEngine; + + Check("v3.data", "<3 items>", TypePattern(".*QList<int>")) % NeedsInferiorCall + + Check("v3.data.0", "[0]", "1", "int") % NeedsInferiorCall + + Check("v3.data.1", "[1]", "2", "int") % NeedsInferiorCall + + Check("v3.data.2", "[2]", "3", "int") % NeedsInferiorCall; QTest::newRow("QVariant2") @@ -4221,8 +4221,8 @@ void tst_Dumpers::dumper_data() //+ Check("ha1.protocol", "IPv4Protocol", // "@QAbstractSocket::NetworkLayerProtocol") % LldbEngine + Check("ha1.scopeId", "\"\"", "@QString") - + Check("var", "", "@QVariant (@QHostAddress)") % NoCdbEngine - + Check("var.data", ValuePattern(".*127.0.0.1.*"), "@QHostAddress") % NoCdbEngine; + + Check("var", "", "@QVariant (@QHostAddress)") % NeedsInferiorCall + + Check("var.data", ValuePattern(".*127.0.0.1.*"), "@QHostAddress") % NeedsInferiorCall; QTest::newRow("QVariantList") diff --git a/tests/unit/unittest/cursor-test.cpp b/tests/unit/unittest/cursor-test.cpp index 2fa4bff709..521002f3d2 100644 --- a/tests/unit/unittest/cursor-test.cpp +++ b/tests/unit/unittest/cursor-test.cpp @@ -489,7 +489,7 @@ TEST_F(Cursor, HasOutputValues) auto outputArgumentLocations = callExpressionCursor.outputArgumentRanges(); - ASSERT_THAT(outputArgumentLocations.size(), 1); + ASSERT_THAT(outputArgumentLocations.size(), 2); ASSERT_THAT(outputArgumentLocations[0], outputArgumentExpectedSourceLocation); } @@ -744,13 +744,13 @@ TEST_F(Cursor, PointerIsNotRefencingConstant) ASSERT_FALSE(argument.isReferencingConstant()); } -TEST_F(Cursor, PointerIsNotOutputArgument) +TEST_F(Cursor, PointerIsOutputArgument) { auto callExpressionCursor = translationUnit.cursorAt(127, 13); auto argument = callExpressionCursor.type().argument(0); - ASSERT_FALSE(argument.isOutputArgument()); + ASSERT_TRUE(argument.isOutputArgument()); } TEST_F(Cursor, ConstantReferenceIsNotOutputArgument) @@ -771,13 +771,13 @@ TEST_F(Cursor, PointerToConstantIsNotOutputArgument) ASSERT_FALSE(argument.isOutputArgument()) << argument.isConstant() << argument.pointeeType().isConstant(); } -TEST_F(Cursor, ConstantPointerIsNotOutputArgument) +TEST_F(Cursor, ConstantPointerIsOutputArgument) { auto callExpressionCursor = translationUnit.cursorAt(128, 21); auto argument = callExpressionCursor.type().argument(0); - ASSERT_FALSE(argument.isOutputArgument()); + ASSERT_TRUE(argument.isOutputArgument()); } TEST_F(Cursor, ReferenceIsOutputArgument) diff --git a/tests/unit/unittest/tokenprocessor-test.cpp b/tests/unit/unittest/tokenprocessor-test.cpp index 37c76d8ce6..f74fb0dbed 100644 --- a/tests/unit/unittest/tokenprocessor-test.cpp +++ b/tests/unit/unittest/tokenprocessor-test.cpp @@ -1326,7 +1326,7 @@ TEST_F(TokenProcessor, NonConstPointerArgument) infos[1]; ASSERT_THAT(infos[2], - HasOnlyType(HighlightingType::LocalVariable)); + HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument)); } TEST_F(TokenProcessor, PointerToConstArgument) @@ -1346,7 +1346,7 @@ TEST_F(TokenProcessor, ConstPointerArgument) infos[1]; ASSERT_THAT(infos[2], - HasOnlyType(HighlightingType::LocalVariable)); + HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument)); } TEST_F(TokenProcessor, NonConstPointerGetterAsArgument) @@ -1400,7 +1400,7 @@ TEST_F(TokenProcessor, NonConstPointerArgumentAsExpression) infos[1]; ASSERT_THAT(infos[3], - HasOnlyType(HighlightingType::LocalVariable)); + HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument)); } TEST_F(TokenProcessor, NonConstPointerArgumentAsInstanceWithMember) |