From d70a33c0d0437661e3ccc7b5cab3fa9926e252d9 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 8 Jul 2013 12:30:06 +0200 Subject: [PATCH 01/11] C++: fix scope matching for templates in FindUsages When the cursor is on the name of declaration of a templated function, then since f93758b8e1d68ed28dc1a84b71c906d58784cb70 the scope returned by Document::findScopeAt is the scope of the template declaration. Before it was the parent scope of the template declaration. The check in FindUsages::checkCandidates did not check all combinations of template(-child symbol) scopes for the searched symbol and its occurrences. Task-number: QTCREATORBUG-9749 Change-Id: Idc84a2ba718721ce54683a67635a93352784ddd1 Reviewed-by: Nikolai Kosjar --- src/libs/cplusplus/FindUsages.cpp | 10 +++++- .../cplusplus/findusages/tst_findusages.cpp | 32 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index 07a912b8faf..7fe56b90e4e 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -208,7 +208,15 @@ bool FindUsages::checkCandidates(const QList &candidates) const if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) { if (s->enclosingScope()->isTemplate()) { - if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()) + if (_declSymbol->enclosingScope()->isTemplate()) { + if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()->enclosingScope()) + return false; + } else { + if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()) + return false; + } + } else if (_declSymbol->enclosingScope()->isTemplate() && s->isTemplate()) { + if (_declSymbol->enclosingScope()->enclosingScope() != s->enclosingScope()) return false; } else if (! s->isUsingDeclaration() && s->enclosingScope() != _declSymbol->enclosingScope()) { return false; diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp index 18f94ce0b25..fd06f545379 100644 --- a/tests/auto/cplusplus/findusages/tst_findusages.cpp +++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp @@ -100,7 +100,7 @@ private Q_SLOTS: void using_insideGlobalNamespace(); void using_insideNamespace(); void using_insideFunction(); - + void templatedFunction_QTCREATORBUG9749(); }; void tst_FindUsages::inlineMethod() @@ -706,5 +706,35 @@ void tst_FindUsages::operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005( QCOMPARE(findUsages.usages().size(), 2); } +void tst_FindUsages::templatedFunction_QTCREATORBUG9749() +{ + const QByteArray src = "\n" + "template char *reformatInteger(IntType value, int format) {}\n" + "void func(int code, int format) {\n" + " reformatInteger(code, format);" + "}\n" + ; + + Document::Ptr doc = Document::create("templatedFunction_QTCREATORBUG9749"); + doc->setUtf8Source(src); + doc->parse(); + doc->check(); + + QVERIFY(doc->diagnosticMessages().isEmpty()); + QCOMPARE(doc->globalSymbolCount(), 2U); + + Snapshot snapshot; + snapshot.insert(doc); + + Template *funcTempl = doc->globalSymbolAt(0)->asTemplate(); + QVERIFY(funcTempl); + QCOMPARE(funcTempl->memberCount(), 2U); + Function *func = funcTempl->memberAt(1)->asFunction(); + + FindUsages findUsages(src, doc, snapshot); + findUsages(func); + QCOMPARE(findUsages.usages().size(), 2); +} + QTEST_APPLESS_MAIN(tst_FindUsages) #include "tst_findusages.moc" From 702402a638879e24104e76ef0bf3dd0ef6c17628 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 8 Jul 2013 12:24:22 +0200 Subject: [PATCH 02/11] Squish: Avoid false positive warnings Change-Id: I6cf15b571aae9a1ba4dcd02048e7ca6b21fab1da Reviewed-by: Robert Loehning --- tests/system/shared/utils.py | 7 ++++--- tests/system/suite_HELP/tst_HELP04/test.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 4960b41d0ff..d90f39ad0bc 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -642,10 +642,11 @@ def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail return result # wait for progress bar(s) to appear and disappear -def progressBarWait(timeout=60000): +def progressBarWait(timeout=60000, warn=True): if not checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", True, 6000): - test.warning("progressBarWait() timed out when waiting for ProgressBar.", - "This may lead to unforeseen behavior. Consider increasing the timeout.") + if warn: + test.warning("progressBarWait() timed out when waiting for ProgressBar.", + "This may lead to unforeseen behavior. Consider increasing the timeout.") checkIfObjectExists(":Qt Creator_Core::Internal::ProgressBar", False, timeout) def readFile(filename): diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 881e59490b2..42837a730ae 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -93,7 +93,7 @@ def main(): mouseClick(waitForObject(":Qt Creator.Help_Search for:_QLineEdit")) replaceEditorContent(":Qt Creator.Help_Search for:_QLineEdit", searchKeyword) type(waitForObject(":Qt Creator.Help_Search for:_QLineEdit"), "") - progressBarWait() + progressBarWait(warn=False) if shouldFind: test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," "str(findObject(':Hits_QLabel').text))", 2000), @@ -129,7 +129,7 @@ def main(): # advanced search - do search clickButton(waitForObject("{text='Search' type='QPushButton' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}")) - progressBarWait() + progressBarWait(warn=False) # verify that advanced search results found test.verify(waitFor("re.search('1 - 2 of 2 Hits'," "str(findObject(':Hits_QLabel').text))", 3000), From af17f33a75a87ee86c890ef25b4248c7f6cfd170 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 16:02:38 +0200 Subject: [PATCH 03/11] Debugger: Improve hash "unsalting" in auto tests Do it in code. Relying on the environment variable breaks in too many cases (remote; unmodified project; ...) to be useful. Change-Id: I67577fef22942d75d32d356f38c4ff0c752fe157 Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 37 +++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 48f7230206c..4bc5874c1d4 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -401,9 +401,13 @@ struct GuiProfile {}; struct DataBase { - DataBase() : useQt(false), forceC(false), gdbOnly(false), lldbOnly(false) {} + DataBase() + : useQt(false), useQHash(false), + forceC(false), gdbOnly(false), lldbOnly(false) + {} mutable bool useQt; + mutable bool useQHash; mutable bool forceC; mutable bool gdbOnly; mutable bool lldbOnly; @@ -461,34 +465,33 @@ public: { profileExtra += "CONFIG += QT\n" - "QT += gui\n" - "greaterThan(QT_MAJOR_VERSION, 4):QT *= widgets\n"; + "QT += core\n"; useQt = true; + useQHash = true; + return *this; } const Data &operator%(const GuiProfile &) const { + this->operator%(CoreProfile()); profileExtra += - "CONFIG += QT\n" "QT += gui\n" "greaterThan(QT_MAJOR_VERSION, 4):QT *= widgets\n"; - useQt = true; return *this; } const Data &operator%(const CorePrivateProfile &) const { + this->operator%(CoreProfile()); profileExtra += - "CONFIG += QT\n" "greaterThan(QT_MAJOR_VERSION, 4) {\n" - " QT += core core-private\n" + " QT += core-private\n" " CONFIG += no_private_qt_headers_warning\n" "}"; - useQt = true; return *this; } @@ -500,8 +503,8 @@ public: public: mutable QByteArray profileExtra; - QByteArray includes; - QByteArray code; + mutable QByteArray includes; + mutable QByteArray code; mutable QMap checks; // IName -> Action }; @@ -586,7 +589,6 @@ void tst_Dumpers::initTestCase() qDebug() << "QMake : " << m_qmakeBinary.constData(); Environment utilsEnv = Environment::systemEnvironment(); - utilsEnv.appendOrSet(QLatin1String("QT_HASH_SEED"), QLatin1String("0")); if (m_debuggerEngine == DumpTestGdbEngine) { QProcess debugger; @@ -717,9 +719,20 @@ void tst_Dumpers::dumper() "\n\nvoid unused(const void *first,...) { (void) first; }" "\n\nvoid breakHere() {}" "\n\n" + data.includes + + "\n\n" + (data.useQHash ? + "\n#include " + "\n#if QT_VERSION >= 0x050000" + "\nQT_BEGIN_NAMESPACE" + "\nQ_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp" + "\nQT_END_NAMESPACE" + "\n#endif" : "") + "\n\nint main(int argc, char *argv[])" "\n{" - "\n int qtversion = " + (data.useQt ? "QT_VERSION" : "0") + ";\n" + "\n int qtversion = " + (data.useQt ? "QT_VERSION" : "0") + ";" + "\n" + (data.useQHash ? + "\n#if QT_VERSION >= 0x050000" + "\nqt_qhash_seed.testAndSetRelaxed(-1, 0);" + "\n#endif\n" : "") + "\n unused(&argc, &argv, &qtversion);\n" "\n" + data.code + "\n breakHere();" From 29372a0f5a8374a69195c02c890def1944337ca1 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 8 Jul 2013 15:04:56 +0200 Subject: [PATCH 04/11] Qbs: Do not export symbols Change-Id: I0e2332156ba481562ac3c2bc9fb1930f1368b2c9 Reviewed-by: Eike Ziller Reviewed-by: Tobias Hunger --- src/plugins/qbsprojectmanager/qbsparser.h | 2 +- src/plugins/qbsprojectmanager/qbsprojectmanager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsparser.h b/src/plugins/qbsprojectmanager/qbsparser.h index 97b12ab3dee..01ba586574b 100644 --- a/src/plugins/qbsprojectmanager/qbsparser.h +++ b/src/plugins/qbsprojectmanager/qbsparser.h @@ -39,7 +39,7 @@ namespace QbsProjectManager { namespace Internal { -class QBSPROJECTMANAGER_EXPORT QbsParser : public ProjectExplorer::IOutputParser +class QbsParser : public ProjectExplorer::IOutputParser { Q_OBJECT diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.h b/src/plugins/qbsprojectmanager/qbsprojectmanager.h index 56a561a3767..5ad01033386 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.h @@ -52,7 +52,7 @@ class QbsProject; class QbsProjectManagerPlugin; } // namespace Internal -class QBSPROJECTMANAGER_EXPORT QbsManager : public ProjectExplorer::IProjectManager +class QbsManager : public ProjectExplorer::IProjectManager { Q_OBJECT From bcb74fa9a4384d2dc6f6fa9518d78966ea3d04db Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 8 Jul 2013 15:58:07 +0200 Subject: [PATCH 05/11] Qbs: Fix QbsRunConfiguration setup Task-number: QBS-349 Task-number: QBS-355 Change-Id: Ibfa88e2d5ec59984c54ae9f69659f231a962a64c Reviewed-by: Eike Ziller --- src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp index 12bb1f60245..f0196aaedbf 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp @@ -196,7 +196,7 @@ QString QbsRunConfiguration::executable() const QbsProject *pro = static_cast(target()->project()); const qbs::ProductData product = findProduct(pro->qbsProjectData(), m_qbsProduct); - if (product.isValid() || !pro->qbsProject()) + if (!product.isValid() || !pro->qbsProject()) return QString(); return pro->qbsProject()->targetExecutable(product, installOptions()); @@ -518,7 +518,7 @@ bool QbsRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, cons return false; QbsProject *project = static_cast(parent->project()); - return !findProduct(project->qbsProjectData(), productFromId(id)).isValid(); + return findProduct(project->qbsProjectData(), productFromId(id)).isValid(); } ProjectExplorer::RunConfiguration *QbsRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id) From 5728f7e6736fc0ad7e51a240f729ee51be536842 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 5 Jul 2013 10:00:19 +0200 Subject: [PATCH 06/11] qbs updates. - Make project files buildable with current qbs. - Update qbs submodule to enable Qt Creator to open these project files. - Fix an invalid access that caused a soft assert. Change-Id: I976d19240112d1ff048e51036e6702383735352b Reviewed-by: Joerg Bornemann Reviewed-by: Tobias Hunger --- qbs/pluginspec/pluginspec.qbs | 1 + src/app/app_version_header.qbs | 1 + src/plugins/qbsprojectmanager/qbsnodes.cpp | 2 +- src/shared/qbs | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qbs/pluginspec/pluginspec.qbs b/qbs/pluginspec/pluginspec.qbs index c8c09084852..c852d1082dd 100644 --- a/qbs/pluginspec/pluginspec.qbs +++ b/qbs/pluginspec/pluginspec.qbs @@ -1,4 +1,5 @@ import qbs.base 1.0 +import qbs.TextFile import qbs.fileinfo as FileInfo Module { diff --git a/src/app/app_version_header.qbs b/src/app/app_version_header.qbs index 3b3ebf0e0a4..4dfc1f5b37e 100644 --- a/src/app/app_version_header.qbs +++ b/src/app/app_version_header.qbs @@ -1,4 +1,5 @@ import qbs +import qbs.TextFile Product { name: "app_version_header" diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp index 8606d73646b..3a334ba1f8d 100644 --- a/src/plugins/qbsprojectmanager/qbsnodes.cpp +++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp @@ -489,7 +489,7 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData prd) if (m_qbsProductData == prd) return; - bool productWasEnabled = m_qbsProductData.isEnabled(); + bool productWasEnabled = m_qbsProductData.isValid() && m_qbsProductData.isEnabled(); bool productIsEnabled = prd.isEnabled(); bool updateExisting = productWasEnabled != productIsEnabled; diff --git a/src/shared/qbs b/src/shared/qbs index 604aa765a83..6e432eef926 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 604aa765a8389bfaf3c97465d4903f709c4e09cd +Subproject commit 6e432eef926e40278bca6c0281a6f36c56b099af From 39e44e2e66aa8a4aa031c324afb2a9e5a9cd7a49 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 16:24:34 +0200 Subject: [PATCH 07/11] Debugger: Fix inames of array items with LLDB Harmless, but needlessly breaks auto tests. Change-Id: Iee470411c02686b6975c1e7efd79ac802eb37037 Reviewed-by: hjk --- share/qtcreator/dumper/lbridge.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/qtcreator/dumper/lbridge.py b/share/qtcreator/dumper/lbridge.py index 1dcb490fde1..b9758c69223 100644 --- a/share/qtcreator/dumper/lbridge.py +++ b/share/qtcreator/dumper/lbridge.py @@ -1102,7 +1102,6 @@ class Dumper: # Normal value #numchild = 1 if value.MightHaveChildren() else 0 numchild = value.GetNumChildren() - self.put('iname="%s",' % self.currentIName) self.putType(typeName) if typeClass == lldb.eTypeClassStruct or typeClass == lldb.eTypeClassClass: if self.isQObject(value): @@ -1129,7 +1128,7 @@ class Dumper: if value.GetType().GetTypeClass() == lldb.eTypeClassArray: for i in xrange(value.GetNumChildren()): child = value.GetChildAtIndex(i) - with UnnamedSubItem(self, "%d" % (i + 1)): + with UnnamedSubItem(self, str(i)): self.putItem(child) return From 7c81f6f518c723d02dd6a46efaab3dcf09320bed Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 18:14:00 +0200 Subject: [PATCH 08/11] Debugger: Align dummy member names in anon structs Use the same numbering schem for GDB and LLDB. More consistent, helps auto tests. Change-Id: I9b50dd4b43bdc12fac329d33e158fa759bee4d28 Reviewed-by: hjk --- share/qtcreator/dumper/lbridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/dumper/lbridge.py b/share/qtcreator/dumper/lbridge.py index b9758c69223..12d3995239c 100644 --- a/share/qtcreator/dumper/lbridge.py +++ b/share/qtcreator/dumper/lbridge.py @@ -1155,7 +1155,7 @@ class Dumper: frame = self.currentThread().GetSelectedFrame() self.currentIName = 'local' self.put('data=[') - self.anonNumber = -1 + self.anonNumber = 0 for value in frame.GetVariables(True, True, False, False): if self.dummyValue is None: self.dummyValue = value From a307d8866716d01e3f6f1801ae7fbc3afe7df81b Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 18:15:33 +0200 Subject: [PATCH 09/11] Debugger: Add facility to check float values in auto tests Change-Id: Iee50dd4b43bdc12fac329d33e158fa759bee4d28 Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 52 +++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 4bc5874c1d4..43778078a22 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -40,6 +40,7 @@ #include "temporarydir.h" #include +#include #if QT_VERSION >= 0x050000 #define MSKIP_SINGLE(x) QSKIP(x) @@ -195,9 +196,10 @@ static QByteArray parentIName(const QByteArray &iname) struct ValueBase { - ValueBase() : hasPtrSuffix(false), version(0) {} + ValueBase() : hasPtrSuffix(false), isFloatValue(false), version(0) {} bool hasPtrSuffix; + bool isFloatValue; int version; }; @@ -235,6 +237,18 @@ struct Value : public ValueBase if (hasPtrSuffix) return actualValue.startsWith(expectedValue + QLatin1String(" @0x")) || actualValue.startsWith(expectedValue + QLatin1String("@0x")); + + if (isFloatValue) { + double f1 = fabs(expectedValue.toDouble()); + double f2 = fabs(actualValue.toDouble()); + //qDebug() << "expected float: " << qPrintable(expectedValue) << f1; + //qDebug() << "actual float: " << qPrintable(actualValue) << f2; + if (f1 < f2) + std::swap(f1, f2); + return f1 - f2 <= 0.01 * f2; + } + + return actualValue == expectedValue; } @@ -247,6 +261,12 @@ struct Pointer : Value Pointer(const QByteArray &value) : Value(value) { hasPtrSuffix = true; } }; +struct FloatValue : Value +{ + FloatValue() { isFloatValue = true; } + FloatValue(const QByteArray &value) : Value(value) { isFloatValue = true; } +}; + struct Value4 : Value { Value4(const QByteArray &value) : Value(value) { version = 4; } @@ -311,15 +331,6 @@ struct CheckType : public Check {} }; -struct CheckPlain : public Check -{ - CheckPlain(const QByteArray &iname, const Name &name, - const Type &type) - : Check(iname, name, noValue, type) - {} - -}; - struct Profile { Profile(const QByteArray &contents) : contents(contents) {} @@ -1046,18 +1057,33 @@ void tst_Dumpers::dumper_data() " } // namespace nsB\n" " } // namespace nsA\n"; - QTest::newRow("AnonymousStruct") + QTest::newRow("AnonymousStructGdb") << Data("union {\n" " struct { int i; int b; };\n" " struct { float f; };\n" " double d;\n" " } a = { { 42, 43 } };\n (void)a;") + % GdbOnly() % CheckType("a", "a", "union {...}") % Check("a.b", "43", "int") - % Check("a.d", "9.1245819032257467e-313", "double") - % Check("a.f", "5.88545355e-44", "float") + % Check("a.d", FloatValue("9.1245819032257467e-313"), "double") + % Check("a.f", FloatValue("5.88545355e-44"), "float") % Check("a.i", "42", "int"); + // FIXME: Merge with GDB case + QTest::newRow("AnonymousStructLldb") + << Data("union {\n" + " struct { int i; int b; };\n" + " struct { float f; };\n" + " double d;\n" + " } a = { { 42, 43 } };\n (void)a;") + //% CheckType("a", "a", "union {...}") + % LldbOnly() + % Check("a.#1.b", "43", "int") + % Check("a.d", FloatValue("9.1245819032257467e-313"), "double") + % Check("a.#2.f", FloatValue("5.88545355e-44"), "float") + % Check("a.#1.i", "42", "int"); + QTest::newRow("QByteArray0") << Data("#include \n", "QByteArray ba;") From a6cae022acde1bca7836a4a5ae060ba1f5bf5536 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 18:19:29 +0200 Subject: [PATCH 10/11] Debugger: Split auto test into GDB/LLDB specific Results are different, but ok. Change-Id: I5550dd4b43bdc12fac329d33e158fa759bee4d28 Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 43778078a22..d4786aa4c40 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -2388,16 +2388,28 @@ void tst_Dumpers::dumper_data() "std::complex c(1, 2);\n") % Check("c", "(1.000000, 2.000000)", "std::complex"); - QTest::newRow("CComplex") + QTest::newRow("CComplexGdb") << Data("#include \n", "// Doesn't work when compiled as C++.\n" "double complex a = 0;\n" "double _Complex b = 0;\n" "unused(&a, &b);\n") % ForceC() + % GdbOnly() % Check("a", "0 + 0 * I", "complex double") % Check("b", "0 + 0 * I", "complex double"); + QTest::newRow("CComplexLldb") + << Data("#include \n", + "// Doesn't work when compiled as C++.\n" + "double complex a = 0;\n" + "double _Complex b = 0;\n" + "unused(&a, &b);\n") + % ForceC() + % LldbOnly() + % Check("a", "0 + 0i", "_Complex double") + % Check("b", "0 + 0i", "_Complex double"); + QTest::newRow("StdDequeInt") << Data("#include \n", "std::deque deque;\n" From 79c8a8fbb0ec98f2497bc2b275c2b0f215314a76 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jul 2013 18:41:10 +0200 Subject: [PATCH 11/11] Debugger: Fix libc++ std::{unique,shared}_ptr dumpers Change-Id: I9efb22543bf31f43381e57fb0acf4aeb15e8a293 Reviewed-by: hjk --- share/qtcreator/dumper/qttypes.py | 35 +++++++++++++++++++++++++++++ tests/auto/debugger/tst_dumpers.cpp | 8 ++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/dumper/qttypes.py b/share/qtcreator/dumper/qttypes.py index 5e04e4f727d..d0b6e770683 100644 --- a/share/qtcreator/dumper/qttypes.py +++ b/share/qtcreator/dumper/qttypes.py @@ -2452,6 +2452,24 @@ def qdump__std__shared_ptr(d, value): d.putIntItem("usecount", refcount["_M_use_count"]) d.putIntItem("weakcount", refcount["_M_weak_count"]) +def qdump__std____1__shared_ptr(d, value): + i = value["__ptr_"] + if isNull(i): + d.putValue("(null)") + d.putNumChild(0) + return + + if isSimpleType(d.templateArgument(value.type, 0)): + d.putValue("%s @0x%x" % (i.dereference().value, pointerValue(i))) + else: + d.putValue("@0x%x" % pointerValue(i)) + + d.putNumChild(3) + with Children(d, 3): + d.putSubItem("data", i.dereference()) + d.putFields(value["__cntrl_"].dereference()) + #d.putIntItem("usecount", refcount["_M_use_count"]) + #d.putIntItem("weakcount", refcount["_M_weak_count"]) def qdump__std__unique_ptr(d, value): i = value["_M_t"]["_M_head_impl"] @@ -2470,6 +2488,23 @@ def qdump__std__unique_ptr(d, value): with Children(d, 1): d.putSubItem("data", i) +def qdump__std____1__unique_ptr(d, value): + i = childAt(childAt(value["__ptr_"], 0), 0) + if isNull(i): + d.putValue("(null)") + d.putNumChild(0) + return + + if isSimpleType(d.templateArgument(value.type, 0)): + d.putValue("%s @0x%x" % (i.dereference().value, pointerValue(i))) + else: + d.putValue("@0x%x" % pointerValue(i)) + + d.putNumChild(1) + with Children(d, 1): + d.putSubItem("data", i.dereference()) + + def qedit__std__vector(expr, value): values = value.split(',') diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index d4786aa4c40..139b1f48ae1 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -347,9 +347,9 @@ struct Cxx11Profile : public Profile {} }; -struct MacLibStdCppProfile : public Profile +struct MacLibCppProfile : public Profile { - MacLibStdCppProfile() + MacLibCppProfile() : Profile("macx {\n" "QMAKE_CXXFLAGS += -stdlib=libc++\n" "LIBS += -stdlib=libc++\n" @@ -2379,7 +2379,7 @@ void tst_Dumpers::dumper_data() "unused(&a, &b);\n") % CoreProfile() % Cxx11Profile() - % MacLibStdCppProfile() + % MacLibCppProfile() % Check("a", "<4 items>", "std::array") % Check("b", "<4 items>", "std::array<@QString, 4u>"); @@ -2682,6 +2682,7 @@ void tst_Dumpers::dumper_data() "std::unique_ptr pi(new int(32));\n" "std::unique_ptr pf(new Foo);\n") % Cxx11Profile() + % MacLibCppProfile() % Check("pi", Pointer("32"), "std::unique_ptr >") % Check("pf", Pointer(), "std::unique_ptr >"); @@ -2690,6 +2691,7 @@ void tst_Dumpers::dumper_data() "std::shared_ptr pi(new int(32));\n" "std::shared_ptr pf(new Foo);\n") % Cxx11Profile() + % MacLibCppProfile() % Check("pi", Pointer("32"), "std::shared_ptr") % Check("pf", Pointer(), "std::shared_ptr");