diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-11-24 21:02:26 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-03-12 14:07:58 +0100 |
commit | 376f77952e9c579043a26fcd6be33baed9fd1610 (patch) | |
tree | ab23a657dae14e854f0c07749d4bed7329144341 /src/plugins/cpptools/cppcompletion_test.cpp | |
parent | b96bb6172e736379b780ad72c8c4055b93d82da2 (diff) | |
download | qt-creator-376f77952e9c579043a26fcd6be33baed9fd1610.tar.gz |
C++: fix support for nested anonymous classes
A member of nested anonymous class should be visible as a member of
enclosing class(if there is no declaration of this nested anonymous
class).
Fix:
* marking
* find usage
* follow symbol
* completion
Task-number: QTCREATORBUG-10876
Task-number: QTCREATORBUG-11170
Change-Id: If5b4d198e9075f2a8aa899ae59190f2c05f7b1ff
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 7b78ac901a..eb657f783b 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -1425,7 +1425,9 @@ void CppToolsPlugin::test_completion_data() " @\n" "}\n" ) << _("s.") << (QStringList() - << QLatin1String("S")); + << QLatin1String("S") + << QLatin1String("i") + << QLatin1String("c")); QTest::newRow("instantiate_template_function") << _( "template <typename T>\n" @@ -1439,6 +1441,65 @@ void CppToolsPlugin::test_completion_data() << QLatin1String("A") << QLatin1String("a")); + QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_1") << _( + "struct EnclosingStruct\n" + "{\n" + " int memberOfEnclosingStruct;\n" + " struct\n" + " {\n" + " int memberNestedAnonymousClass;\n" + " };\n" + " void fun()\n" + " {\n" + " @\n" + " }\n" + "};\n" + ) << _("member") << (QStringList() + << QLatin1String("memberNestedAnonymousClass") + << QLatin1String("memberOfEnclosingStruct")); + + QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_2") << _( + "struct EnclosingStruct\n" + "{\n" + " int memberOfEnclosingStruct;\n" + " struct\n" + " {\n" + " int memberOfNestedAnonymousClass;\n" + " struct\n" + " {\n" + " int memberOfNestedOfNestedAnonymousClass;\n" + " };\n" + " };\n" + " void fun()\n" + " {\n" + " @\n" + " }\n" + "};\n" + ) << _("member") << (QStringList() + << QLatin1String("memberOfNestedAnonymousClass") + << QLatin1String("memberOfNestedOfNestedAnonymousClass") + << QLatin1String("memberOfEnclosingStruct")); + + QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_3") << _( + "struct EnclosingStruct\n" + "{\n" + " int memberOfEnclosingStruct;\n" + " struct\n" + " {\n" + " int memberOfNestedAnonymousClass;\n" + " struct\n" + " {\n" + " int memberOfNestedOfNestedAnonymousClass;\n" + " } nestedOfNestedAnonymousClass;\n" + " };\n" + " void fun()\n" + " {\n" + " @\n" + " }\n" + "};\n" + ) << _("nestedOfNestedAnonymousClass.") << (QStringList() + << QLatin1String("memberOfNestedOfNestedAnonymousClass")); + QTest::newRow("crash_cloning_template_class_QTCREATORBUG9329") << _( "struct A {};\n" "template <typename T>\n" |