summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp672
-rw-r--r--src/plugins/cpptools/cppcompletionassistprocessor.cpp36
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.cpp15
3 files changed, 180 insertions, 543 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 27cb35739e..1643550bbc 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -371,17 +371,12 @@ void CppToolsPlugin::test_global_completion_data()
const QByteArray codeTemplate = "int myGlobal;\n"
"<REPLACEMENT>\n"
"@\n";
- const QStringList replacements = QStringList()
- << QLatin1String("// text")
- << QLatin1String("// text.")
- << QLatin1String("/// text")
- << QLatin1String("/// text.")
- ;
+ const QStringList replacements = QStringList({ "// text", "// text.", "/// text", "/// text." });
foreach (const QString &replacement, replacements) {
QByteArray code = codeTemplate;
code.replace("<REPLACEMENT>", replacement.toUtf8());
const QByteArray tag = _("completion after comment: ") + replacement.toUtf8();
- QTest::newRow(tag) << code << QByteArray() << QStringList(QLatin1String("myGlobal"));
+ QTest::newRow(tag) << code << QByteArray() << QStringList("myGlobal");
}
}
@@ -432,24 +427,14 @@ static void enumTestCase(const QByteArray &tag, const QByteArray &source,
QByteArray fullSource = source;
fullSource.replace('$', "enum E { val1, val2, val3 };");
QTest::newRow(tag) << fullSource << (prefix + "val")
- << (QStringList()
- << QLatin1String("val1")
- << QLatin1String("val2")
- << QLatin1String("val3"));
+ << QStringList({ "val1", "val2", "val3" });
QTest::newRow(tag + "_cxx11") << fullSource << (prefix + "E::")
- << (QStringList()
- << QLatin1String("E")
- << QLatin1String("val1")
- << QLatin1String("val2")
- << QLatin1String("val3"));
+ << QStringList({ "E", "val1", "val2", "val3" });
fullSource.replace("enum E ", "enum ");
QTest::newRow(tag + "_anon") << fullSource << (prefix + "val")
- << (QStringList()
- << QLatin1String("val1")
- << QLatin1String("val2")
- << QLatin1String("val3"));
+ << QStringList({ "val1", "val2", "val3" });
}
void CppToolsPlugin::test_completion_data()
@@ -471,8 +456,7 @@ void CppToolsPlugin::test_completion_data()
"};\n"
"\n"
"@\n"
- ) << _("Foo::Bar::") << (QStringList()
- << QLatin1String("Bar"));
+ ) << _("Foo::Bar::") << QStringList("Bar");
QTest::newRow("inside_parentheses_c_style_conversion") << _(
"class Base\n"
@@ -491,11 +475,7 @@ void CppToolsPlugin::test_completion_data()
" if (1)\n"
" @;\n"
"}\n"
- ) << _("((Derived *)b)->") << (QStringList()
- << QLatin1String("Derived")
- << QLatin1String("Base")
- << QLatin1String("i_derived")
- << QLatin1String("i_base"));
+ ) << _("((Derived *)b)->") << QStringList({ "Derived", "Base", "i_derived", "i_base" });
QTest::newRow("inside_parentheses_cast_operator_conversion") << _(
"class Base\n"
@@ -514,11 +494,8 @@ void CppToolsPlugin::test_completion_data()
" if (1)\n"
" @;\n"
"}\n"
- ) << _("(static_cast<Derived *>(b))->") << (QStringList()
- << QLatin1String("Derived")
- << QLatin1String("Base")
- << QLatin1String("i_derived")
- << QLatin1String("i_base"));
+ ) << _("(static_cast<Derived *>(b))->") << QStringList({ "Derived", "Base", "i_derived",
+ "i_base" });
QTest::newRow("template_1") << _(
"template <class T>\n"
@@ -533,11 +510,7 @@ void CppToolsPlugin::test_completion_data()
" Foo f;\n"
" @\n"
"}"
- ) << _("Foo::") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("Type")
- << QLatin1String("foo")
- << QLatin1String("m"));
+ ) << _("Foo::") << QStringList({ "Foo", "Type", "foo", "m" });
QTest::newRow("template_2") << _(
"template <class T>\n"
@@ -552,10 +525,7 @@ void CppToolsPlugin::test_completion_data()
" List<Tupple> l;\n"
" @\n"
"}"
- ) << _("l.at(0).") << (QStringList()
- << QLatin1String("Tupple")
- << QLatin1String("a")
- << QLatin1String("b"));
+ ) << _("l.at(0).") << QStringList({ "Tupple", "a", "b" });
QTest::newRow("template_3") << _(
"template <class T>\n"
@@ -570,10 +540,7 @@ void CppToolsPlugin::test_completion_data()
" List<Tupple> l;\n"
" @\n"
"}"
- ) << _("l.t.") << (QStringList()
- << QLatin1String("Tupple")
- << QLatin1String("a")
- << QLatin1String("b"));
+ ) << _("l.t.") << QStringList({ "Tupple", "a", "b" });
QTest::newRow("template_4") << _(
"template <class T>\n"
@@ -589,10 +556,7 @@ void CppToolsPlugin::test_completion_data()
" List<Tupple> l;\n"
" @\n"
"}"
- ) << _("l.u.") << (QStringList()
- << QLatin1String("Tupple")
- << QLatin1String("a")
- << QLatin1String("b"));
+ ) << _("l.u.") << QStringList({ "Tupple", "a", "b" });
QTest::newRow("template_5") << _(
"template <class T>\n"
@@ -608,10 +572,7 @@ void CppToolsPlugin::test_completion_data()
" LT l;"
" @\n"
"}"
- ) << _("l.u.") << (QStringList()
- << QLatin1String("Tupple")
- << QLatin1String("a")
- << QLatin1String("b"));
+ ) << _("l.u.") << QStringList({ "Tupple", "a", "b" });
QTest::newRow("template_6") << _(
"class Item\n"
@@ -631,9 +592,7 @@ void CppToolsPlugin::test_completion_data()
"{};\n"
"ItemContainer container;\n"
"@\n"
- ) << _("container.get().") << (QStringList()
- << QLatin1String("Item")
- << QLatin1String("i"));
+ ) << _("container.get().") << QStringList({ "Item", "i" });
QTest::newRow("template_7") << _(
"struct Test\n"
@@ -656,9 +615,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"TemplateClass<Test> p(new Test);\n"
"@\n"
- ) << _("p->") << (QStringList()
- << QLatin1String("Test")
- << QLatin1String("i"));
+ ) << _("p->") << QStringList({ "Test", "i" });
QTest::newRow("type_of_pointer_is_typedef") << _(
"typedef struct Foo\n"
@@ -667,9 +624,7 @@ void CppToolsPlugin::test_completion_data()
"} Foo;\n"
"Foo *bar;\n"
"@\n"
- ) << _("bar->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("foo"));
+ ) << _("bar->") << QStringList({ "Foo", "foo" });
QTest::newRow("instantiate_full_specialization") << _(
"template<typename T>\n"
@@ -686,9 +641,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Template<char> templateChar;\n"
"@\n"
- ) << _("templateChar.") << (QStringList()
- << QLatin1String("Template")
- << QLatin1String("templateChar_i"));
+ ) << _("templateChar.") << QStringList({ "Template", "templateChar_i" });
QTest::newRow("template_as_base: base as template directly") << _(
"class Data { int dataMember; };\n"
@@ -698,11 +651,7 @@ void CppToolsPlugin::test_completion_data()
" Other<Data> c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Other")
- << QLatin1String("otherMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Other", "otherMember" });
QTest::newRow("template_as_base: base as class template") << _(
"class Data { int dataMember; };\n"
@@ -713,13 +662,8 @@ void CppToolsPlugin::test_completion_data()
" More<Data> c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Other")
- << QLatin1String("otherMember")
- << QLatin1String("More")
- << QLatin1String("moreMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Other", "otherMember", "More",
+ "moreMember" });
QTest::newRow("template_as_base: base as globally qualified class template") << _(
"class Data { int dataMember; };\n"
@@ -730,13 +674,8 @@ void CppToolsPlugin::test_completion_data()
" More<Data> c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Other")
- << QLatin1String("otherMember")
- << QLatin1String("More")
- << QLatin1String("moreMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Other", "otherMember", "More",
+ "moreMember" });
QTest::newRow("template_as_base: base as namespace qualified class template") << _(
"class Data { int dataMember; };\n"
@@ -749,13 +688,8 @@ void CppToolsPlugin::test_completion_data()
" More<Data> c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Other")
- << QLatin1String("otherMember")
- << QLatin1String("More")
- << QLatin1String("moreMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Other", "otherMember", "More",
+ "moreMember" });
QTest::newRow("template_as_base: base as nested template name") << _(
"class Data { int dataMember; };\n"
@@ -768,11 +702,7 @@ void CppToolsPlugin::test_completion_data()
" Final<Data> c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Final")
- << QLatin1String("finalMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Final", "finalMember" });
QTest::newRow("template_as_base: base as nested template name in non-template") << _(
"class Data { int dataMember; };\n"
@@ -785,11 +715,7 @@ void CppToolsPlugin::test_completion_data()
" Final c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Final")
- << QLatin1String("finalMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Final", "finalMember" });
QTest::newRow("template_as_base: base as template name in non-template") << _(
"class Data { int dataMember; };\n"
@@ -802,13 +728,8 @@ void CppToolsPlugin::test_completion_data()
" Final c;\n"
" @\n"
"}"
- ) << _("c.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember")
- << QLatin1String("Final")
- << QLatin1String("finalMember")
- << QLatin1String("Other")
- << QLatin1String("otherMember"));
+ ) << _("c.") << QStringList({ "Data", "dataMember", "Final", "finalMember", "Other",
+ "otherMember" });
QTest::newRow("template_as_base: typedef not available in derived") << _(
"class Data { int dataMember; };\n"
@@ -834,9 +755,7 @@ void CppToolsPlugin::test_completion_data()
" Derived<Data> d;\n"
" @\n"
"}\n"
- ) << _("d.f.") << (QStringList()
- << QLatin1String("Data")
- << QLatin1String("dataMember"));
+ ) << _("d.f.") << QStringList({ "Data", "dataMember" });
QTest::newRow("use_global_identifier_as_base_class: derived as global and base as global") << _(
"struct Global\n"
@@ -851,11 +770,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Final c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_global")
- << QLatin1String("int_final")
- << QLatin1String("Final")
- << QLatin1String("Global"));
+ ) << _("c.") << QStringList({ "int_global", "int_final", "Final", "Global" });
QTest::newRow("use_global_identifier_as_base_class: derived is inside namespace. "
"base as global") << _(
@@ -874,11 +789,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"NS::Final c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_global")
- << QLatin1String("int_final")
- << QLatin1String("Final")
- << QLatin1String("Global"));
+ ) << _("c.") << QStringList({ "int_global", "int_final", "Final", "Global" });
QTest::newRow("use_global_identifier_as_base_class: derived is enclosed by template. "
"base as global") << _(
@@ -898,11 +809,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Enclosing<int>::Final c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_global")
- << QLatin1String("int_final")
- << QLatin1String("Final")
- << QLatin1String("Global"));
+ ) << _("c.") << QStringList({ "int_global", "int_final", "Final", "Global" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class is derived class") << _(
"struct A : A\n"
@@ -912,9 +819,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class is derived class. "
"class is in namespace") << _(
@@ -928,9 +833,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"NS::A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class is derived class. "
"class is in namespace. use scope operator for base class") << _(
@@ -944,9 +847,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"NS::A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class has the same name as "
"derived but in different namespace") << _(
@@ -967,10 +868,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"NS2::A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_ns1_a")
- << QLatin1String("int_ns2_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_ns1_a", "int_ns2_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class has the same name as "
"derived (in namespace) but is nested by different class") << _(
@@ -991,10 +889,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"NS2::A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_enclosing_a")
- << QLatin1String("int_ns2_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_enclosing_a", "int_ns2_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class has the same name as "
"derived (nested) but is nested by different class") << _(
@@ -1015,10 +910,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"EnclosingDerived::A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_enclosing_base_a")
- << QLatin1String("int_enclosing_derived_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_enclosing_base_a", "int_enclosing_derived_a", "A" });
QTest::newRow("base_class_has_name_the_same_as_derived: base class is derived class. "
"class is a template") << _(
@@ -1030,9 +922,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"A<int> c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("int_a")
- << QLatin1String("A"));
+ ) << _("c.") << QStringList({ "int_a", "A" });
QTest::newRow("cyclic_inheritance: direct cyclic inheritance") << _(
"struct B;\n"
@@ -1041,11 +931,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("A")
- << QLatin1String("_a")
- << QLatin1String("B")
- << QLatin1String("_b"));
+ ) << _("c.") << QStringList({ "A", "_a", "B", "_b" });
QTest::newRow("cyclic_inheritance: indirect cyclic inheritance") << _(
"struct C;\n"
@@ -1055,13 +941,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("A")
- << QLatin1String("_a")
- << QLatin1String("B")
- << QLatin1String("_b")
- << QLatin1String("C")
- << QLatin1String("_c"));
+ ) << _("c.") << QStringList({ "A", "_a", "B", "_b", "C", "_c" });
QTest::newRow("cyclic_inheritance: indirect cyclic inheritance") << _(
"struct B;\n"
@@ -1071,13 +951,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"A c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("A")
- << QLatin1String("_a")
- << QLatin1String("B")
- << QLatin1String("_b")
- << QLatin1String("C")
- << QLatin1String("_c"));
+ ) << _("c.") << QStringList({ "A", "_a", "B", "_b", "C", "_c" });
QTest::newRow("cyclic_inheritance: direct cyclic inheritance with templates") << _(
"template< typename T > struct C;\n"
@@ -1093,12 +967,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"D<int, float> c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("D")
- << QLatin1String("_d_t")
- << QLatin1String("_d_s")
- << QLatin1String("C")
- << QLatin1String("_c_t"));
+ ) << _("c.") << QStringList({ "D", "_d_t", "_d_s", "C", "_c_t" });
QTest::newRow("cyclic_inheritance: indirect cyclic inheritance with templates") << _(
"template< typename T > struct C;\n"
@@ -1118,14 +987,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"D<int, float> c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("D")
- << QLatin1String("_d_t")
- << QLatin1String("_d_s")
- << QLatin1String("C")
- << QLatin1String("_c_t")
- << QLatin1String("B")
- << QLatin1String("_b_t"));
+ ) << _("c.") << QStringList({ "D", "_d_t", "_d_s", "C", "_c_t", "B", "_b_t" });
QTest::newRow("cyclic_inheritance: direct cyclic inheritance with templates. "
"more complex situation") << _(
@@ -1156,12 +1018,8 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Class<int> c;\n"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("Class")
- << QLatin1String("ClassRecurse")
- << QLatin1String("class_t")
- << QLatin1String("class_recurse_s")
- << QLatin1String("class_recurse_t"));
+ ) << _("c.") << QStringList({ "Class", "ClassRecurse", "class_t", "class_recurse_s",
+ "class_recurse_t" });
QTest::newRow("enclosing_template_class: nested class with enclosing template class") << _(
"template<typename T>\n"
@@ -1173,9 +1031,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Enclosing<int>::Nested c;"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("Nested")
- << QLatin1String("int_nested"));
+ ) << _("c.") << QStringList({ "Nested", "int_nested" });
QTest::newRow("enclosing_template_class: nested template class with enclosing template "
"class") << _(
@@ -1188,9 +1044,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Enclosing<int>::Nested<int> c;"
"@\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("Nested")
- << QLatin1String("int_nested"));
+ ) << _("c.") << QStringList({ "Nested", "int_nested" });
QTest::newRow("instantiate_nested_class_when_enclosing_is_template") << _(
"struct Foo \n"
@@ -1211,9 +1065,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Enclosing<Foo> enclosing;\n"
"@\n"
- ) << _("enclosing.nested.nested_t.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("foo_i"));
+ ) << _("enclosing.nested.nested_t.") << QStringList({ "Foo", "foo_i" });
QTest::newRow("instantiate_nested_of_nested_class_when_enclosing_is_template") << _(
"struct Foo \n"
@@ -1238,9 +1090,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Enclosing<Foo> enclosing;\n"
"@\n"
- ) << _("enclosing.nested.nestedNested.nestedNested_t.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("foo_i"));
+ ) << _("enclosing.nested.nestedNested.nestedNested_t.") << QStringList({ "Foo", "foo_i" });
QTest::newRow("instantiate_template_with_default_argument_type") << _(
"struct Foo\n"
@@ -1256,9 +1106,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Template<> templateWithDefaultTypeOfArgument;\n"
"@\n"
- ) << _("templateWithDefaultTypeOfArgument.t.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("templateWithDefaultTypeOfArgument.t.") << QStringList({ "Foo", "bar" });
QTest::newRow("instantiate_template_with_default_argument_type_as_template") << _(
"struct Foo\n"
@@ -1279,9 +1127,7 @@ void CppToolsPlugin::test_completion_data()
"\n"
"Template<Foo> templateWithDefaultTypeOfArgument;\n"
"@\n"
- ) << _("templateWithDefaultTypeOfArgument.s.t.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("templateWithDefaultTypeOfArgument.s.t.") << QStringList({ "Foo", "bar" });
QTest::newRow("typedef_of_pointer") << _(
"struct Foo { int bar; };\n"
@@ -1291,9 +1137,7 @@ void CppToolsPlugin::test_completion_data()
" FooPtr ptr;\n"
" @\n"
"}"
- ) << _("ptr->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("ptr->") << QStringList({ "Foo", "bar" });
QTest::newRow("typedef_of_pointer_inside_function") << _(
"struct Foo { int bar; };\n"
@@ -1303,9 +1147,7 @@ void CppToolsPlugin::test_completion_data()
" FooPtr ptr;\n"
" @\n"
"}"
- ) << _("ptr->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("ptr->") << QStringList({ "Foo", "bar" });
QTest::newRow("typedef_is_inside_function_before_declaration_block") << _(
"struct Foo { int bar; };\n"
@@ -1317,9 +1159,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }"
"}"
- ) << _("ptr->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("ptr->") << QStringList({ "Foo", "bar" });
QTest::newRow("resolve_complex_typedef_with_template") << _(
"template <typename T>\n"
@@ -1342,10 +1182,7 @@ void CppToolsPlugin::test_completion_data()
" Template2<Foo> template2;\n"
" @\n"
"}\n"
- ) << _("template2.templateTypedef.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar")
- << QLatin1String("Template1"));
+ ) << _("template2.templateTypedef.") << QStringList({ "Foo", "bar", "Template1" });
QTest::newRow("template_specialization_with_pointer") << _(
"template <typename T>\n"
@@ -1360,9 +1197,7 @@ void CppToolsPlugin::test_completion_data()
"};\n"
"Template<int*> templ;\n"
"@\n"
- ) << _("templ.") << (QStringList()
- << QLatin1String("Template")
- << QLatin1String("pointer"));
+ ) << _("templ.") << QStringList({ "Template", "pointer" });
QTest::newRow("typedef_using_templates1") << _(
"namespace NS1\n"
@@ -1395,9 +1230,7 @@ void CppToolsPlugin::test_completion_data()
" NS2::NS2Struct<Foo> s;\n"
" @\n"
"}\n"
- ) << _("s.p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("s.p->") << QStringList({ "Foo", "bar" });
QTest::newRow("typedef_using_templates2") << _(
"namespace NS1\n"
@@ -1430,9 +1263,7 @@ void CppToolsPlugin::test_completion_data()
" NS2::NS2Struct<Foo>::pointer p;\n"
" @\n"
"}\n"
- ) << _("p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("p->") << QStringList({ "Foo", "bar" });
QTest::newRow("namespace_alias_with_many_namespace_declarations") << _(
"namespace NS1\n"
@@ -1460,9 +1291,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("NS::") << (QStringList()
- << QLatin1String("Foo1")
- << QLatin1String("Foo2"));
+ ) << _("NS::") << QStringList({ "Foo1", "Foo2" });
QTest::newRow("QTCREATORBUG9098") << _(
"template <typename T>\n"
@@ -1481,9 +1310,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"};\n"
- ) << _("b.") << (QStringList()
- << QLatin1String("c")
- << QLatin1String("B"));
+ ) << _("b.") << QStringList({ "c", "B" });
QTest::newRow("type_and_using_declaration: type and using declaration inside function") << _(
"namespace NS\n"
@@ -1496,9 +1323,7 @@ void CppToolsPlugin::test_completion_data()
" C c;\n"
" @\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("type_and_using_declaration: type and using declaration in global "
"namespace") << _(
@@ -1512,9 +1337,7 @@ void CppToolsPlugin::test_completion_data()
" C c;\n"
" @\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("type_and_using_declaration: type in global namespace and using declaration in "
"NS namespace") << _(
@@ -1528,9 +1351,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("type_and_using_declaration: type in global namespace and using declaration "
"inside function in NS namespace") << _(
@@ -1544,9 +1365,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("type_and_using_declaration: type inside namespace NS1 and using declaration in "
"function inside NS2 namespace") << _(
@@ -1563,9 +1382,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("type_and_using_declaration: type inside namespace NS1 and using declaration "
"inside NS2 namespace") << _(
@@ -1582,9 +1399,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("instantiate_template_with_anonymous_class") << _(
"template <typename T>\n"
@@ -1597,10 +1412,7 @@ void CppToolsPlugin::test_completion_data()
" S<int> s;\n"
" @\n"
"}\n"
- ) << _("s.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("i")
- << QLatin1String("c"));
+ ) << _("s.") << QStringList({ "S", "i", "c" });
QTest::newRow("instantiate_template_function") << _(
"template <typename T>\n"
@@ -1610,9 +1422,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("templateFunction<A>()->") << (QStringList()
- << QLatin1String("A")
- << QLatin1String("a"));
+ ) << _("templateFunction<A>()->") << QStringList({ "A", "a" });
QTest::newRow("nested_named_class_declaration_inside_function") << _(
"int foo()\n"
@@ -1623,9 +1433,7 @@ void CppToolsPlugin::test_completion_data()
" } n;\n"
" @;\n"
"}\n"
- ) << _("n.") << (QStringList()
- << QLatin1String("Nested")
- << QLatin1String("i"));
+ ) << _("n.") << QStringList({ "Nested", "i" });
QTest::newRow("nested_class_inside_member_function") << _(
"struct User { void use(); };\n"
@@ -1635,9 +1443,7 @@ void CppToolsPlugin::test_completion_data()
" Foo foo;\n"
" @\n"
"}\n"
- ) << _("foo.") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("foo.") << QStringList({ "Foo", "bar" });
QTest::newRow("nested_typedef_inside_member_function") << _(
"struct User { void use(); };\n"
@@ -1655,10 +1461,7 @@ void CppToolsPlugin::test_completion_data()
" MyFoo::Ptr myfoo;\n"
" @\n"
"}\n"
- ) << _("myfoo->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("Ptr")
- << QLatin1String("bar"));
+ ) << _("myfoo->") << QStringList({ "Foo", "Ptr", "bar" });
QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_1") << _(
"struct EnclosingStruct\n"
@@ -1673,9 +1476,8 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"};\n"
- ) << _("member") << (QStringList()
- << QLatin1String("memberNestedAnonymousClass")
- << QLatin1String("memberOfEnclosingStruct"));
+ ) << _("member") << QStringList({ "memberNestedAnonymousClass",
+ "memberOfEnclosingStruct" });
QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_2") << _(
"struct EnclosingStruct\n"
@@ -1694,10 +1496,9 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"};\n"
- ) << _("member") << (QStringList()
- << QLatin1String("memberOfNestedAnonymousClass")
- << QLatin1String("memberOfNestedOfNestedAnonymousClass")
- << QLatin1String("memberOfEnclosingStruct"));
+ ) << _("member") << QStringList({ "memberOfNestedAnonymousClass",
+ "memberOfNestedOfNestedAnonymousClass",
+ "memberOfEnclosingStruct" });
QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_3") << _(
"struct EnclosingStruct\n"
@@ -1716,8 +1517,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"};\n"
- ) << _("nestedOfNestedAnonymousClass.") << (QStringList()
- << QLatin1String("memberOfNestedOfNestedAnonymousClass"));
+ ) << _("nestedOfNestedAnonymousClass.") << QStringList("memberOfNestedOfNestedAnonymousClass");
QTest::newRow("nested_anonymous_class_inside_function") << _(
"void fun()\n"
@@ -1729,9 +1529,7 @@ void CppToolsPlugin::test_completion_data()
" };\n"
" @\n"
"}\n"
- ) << _("foo") << (QStringList()
- << QLatin1String("foo1")
- << QLatin1String("foo2"));
+ ) << _("foo") << QStringList({ "foo1", "foo2" });
QTest::newRow("crash_cloning_template_class_QTCREATORBUG9329") << _(
"struct A {};\n"
@@ -1744,11 +1542,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"};\n"
- ) << _("this->") << (QStringList()
- << QLatin1String("A")
- << QLatin1String("B")
- << QLatin1String("Templ")
- << QLatin1String("f"));
+ ) << _("this->") << QStringList({ "A", "B", "Templ", "f" });
QTest::newRow("recursive_auto_declarations1_QTCREATORBUG9503") << _(
"void f()\n"
@@ -1757,7 +1551,7 @@ void CppToolsPlugin::test_completion_data()
" auto object1 = object2;\n"
" @;\n"
"}\n"
- ) << _("object1.") << (QStringList());
+ ) << _("object1.") << QStringList();
QTest::newRow("recursive_auto_declarations2_QTCREATORBUG9503") << _(
"void f()\n"
@@ -1767,7 +1561,7 @@ void CppToolsPlugin::test_completion_data()
" auto object1 = object2;\n"
" @;\n"
"}\n"
- ) << _("object1.") << (QStringList());
+ ) << _("object1.") << QStringList();
QTest::newRow("recursive_typedefs_declarations1") << _(
"void f()\n"
@@ -1777,7 +1571,7 @@ void CppToolsPlugin::test_completion_data()
" A a;\n"
" @;\n"
"}\n"
- ) << _("a.") << (QStringList());
+ ) << _("a.") << QStringList();
QTest::newRow("recursive_typedefs_declarations2") << _(
"void f()\n"
@@ -1788,7 +1582,7 @@ void CppToolsPlugin::test_completion_data()
" A a;\n"
" @;\n"
"}\n"
- ) << _("a.") << (QStringList());
+ ) << _("a.") << QStringList();
QTest::newRow("recursive_using_declarations1") << _(
"void f()\n"
@@ -1798,7 +1592,7 @@ void CppToolsPlugin::test_completion_data()
" A a;\n"
" @;\n"
"}\n"
- ) << _("a.") << (QStringList());
+ ) << _("a.") << QStringList();
QTest::newRow("recursive_using_declarations2") << _(
"void f()\n"
@@ -1809,7 +1603,7 @@ void CppToolsPlugin::test_completion_data()
" A a;\n"
" @;\n"
"}\n"
- ) << _("a.") << (QStringList());
+ ) << _("a.") << QStringList();
QTest::newRow("recursive_using_typedef_declarations") << _(
"void f()\n"
@@ -1819,7 +1613,7 @@ void CppToolsPlugin::test_completion_data()
" A a;\n"
" @;\n"
"}\n"
- ) << _("a.") << (QStringList());
+ ) << _("a.") << QStringList();
QTest::newRow("recursive_typedefs_in_templates1") << _(
"template<typename From>\n"
@@ -1842,7 +1636,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @;\n"
"}\n"
- ) << _("cast_retty<T1, T2>::ret_type.") << (QStringList());
+ ) << _("cast_retty<T1, T2>::ret_type.") << QStringList();
QTest::newRow("recursive_typedefs_in_templates2") << _(
"template<class T>\n"
@@ -1854,7 +1648,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @;\n"
"}\n"
- ) << _("recursive<T1>::ret_type.foo") << (QStringList());
+ ) << _("recursive<T1>::ret_type.foo") << QStringList();
QTest::newRow("class_declaration_inside_function_or_block_QTCREATORBUG3620: "
"class definition inside function") << _(
@@ -1864,9 +1658,7 @@ void CppToolsPlugin::test_completion_data()
" C c;\n"
" @\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("class_declaration_inside_function_or_block_QTCREATORBUG3620: "
"class definition inside block inside function") << _(
@@ -1878,9 +1670,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("class_declaration_inside_function_or_block_QTCREATORBUG3620: "
"class definition with the same name inside different block inside function") << _(
@@ -1895,9 +1685,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m2"));
+ ) << _("c.") << QStringList({ "C", "m2" });
QTest::newRow("namespace_alias_inside_function_or_block_QTCREATORBUG166: "
"namespace alias inside function") << _(
@@ -1917,9 +1705,7 @@ void CppToolsPlugin::test_completion_data()
" NS::C c;\n"
" @\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("namespace_alias_inside_function_or_block_QTCREATORBUG166: "
"namespace alias inside block inside function") << _(
@@ -1941,9 +1727,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("c.") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("m"));
+ ) << _("c.") << QStringList({ "C", "m" });
QTest::newRow("class_declaration_inside_function_or_block_QTCREATORBUG3620_static_member") << _(
"void foo()\n"
@@ -1956,10 +1740,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("C::") << (QStringList()
- << QLatin1String("C")
- << QLatin1String("staticFun2")
- << QLatin1String("m2"));
+ ) << _("C::") << QStringList({ "C", "staticFun2", "m2" });
enumTestCase(
"enum_inside_block_inside_function",
@@ -2060,9 +1841,7 @@ void CppToolsPlugin::test_completion_data()
"};\n"
"Enclosing e;\n"
"@\n"
- ) << _("e.") << (QStringList()
- << QLatin1String("Enclosing")
- << QLatin1String("i"));
+ ) << _("e.") << QStringList({ "Enclosing", "i" });
QTest::newRow("lambdaCalls_1") << _(
"struct S { int bar; };\n"
@@ -2070,9 +1849,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("[](){ return new S; } ()->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("bar"));
+ ) << _("[](){ return new S; } ()->") << QStringList({ "S", "bar" });
QTest::newRow("lambdaCalls_2") << _(
"struct S { int bar; };\n"
@@ -2080,9 +1857,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("[] { return new S; } ()->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("bar"));
+ ) << _("[] { return new S; } ()->") << QStringList({ "S", "bar" });
QTest::newRow("lambdaCalls_3") << _(
"struct S { int bar; };\n"
@@ -2090,9 +1865,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("[]() ->S* { return new S; } ()->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("bar"));
+ ) << _("[]() ->S* { return new S; } ()->") << QStringList({ "S", "bar" });
QTest::newRow("lambdaCalls_4") << _(
"struct S { int bar; };\n"
@@ -2100,9 +1873,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("[]() throw() { return new S; } ()->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("bar"));
+ ) << _("[]() throw() { return new S; } ()->") << QStringList({ "S", "bar" });
QTest::newRow("lambdaCalls_5") << _(
"struct S { int bar; };\n"
@@ -2110,9 +1881,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("[]() throw()->S* { return new S; } ()->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("bar"));
+ ) << _("[]() throw()->S* { return new S; } ()->") << QStringList({ "S", "bar" });
QTest::newRow("local_type_and_member_1") << _(
"struct OtherType { int otherTypeMember; };\n"
@@ -2126,9 +1895,7 @@ void CppToolsPlugin::test_completion_data()
" LocalType lt;\n"
" @\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("local_type_and_member_2") << _(
"void foo()\n"
@@ -2142,9 +1909,7 @@ void CppToolsPlugin::test_completion_data()
" LocalType lt;\n"
" @\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("local_type_and_member_3") << _(
"void foo()\n"
@@ -2160,9 +1925,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("local_type_and_member_4") << _(
"namespace NS {struct OtherType { int otherTypeMember; };}\n"
@@ -2176,9 +1939,7 @@ void CppToolsPlugin::test_completion_data()
" LocalType lt;\n"
" @\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("local_type_and_member_5") << _(
"namespace NS {struct OtherType { int otherTypeMember; };}\n"
@@ -2193,9 +1954,7 @@ void CppToolsPlugin::test_completion_data()
" LocalType lt;\n"
" @\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("local_type_and_member_6") << _(
"namespace NS {struct OtherType { int otherTypeMember; };}\n"
@@ -2210,9 +1969,7 @@ void CppToolsPlugin::test_completion_data()
" LocalType lt;\n"
" @\n"
"}\n"
- ) << _("lt.ot.") << (QStringList()
- << QLatin1String("OtherType")
- << QLatin1String("otherTypeMember"));
+ ) << _("lt.ot.") << QStringList({ "OtherType", "otherTypeMember" });
QTest::newRow("template_parameter_defined_inside_scope_of_declaration_QTCREATORBUG9169_1") << _(
"struct A\n"
@@ -2241,9 +1998,7 @@ void CppToolsPlugin::test_completion_data()
" Template<B> templ;\n"
" @\n"
"}\n"
- ) << _("templ.get()->") << (QStringList()
- << QLatin1String("B")
- << QLatin1String("b"));
+ ) << _("templ.get()->") << QStringList({ "B", "b" });
QTest::newRow("template_parameter_defined_inside_scope_of_declaration_QTCREATORBUG9169_2") << _(
"struct A\n"
@@ -2272,9 +2027,7 @@ void CppToolsPlugin::test_completion_data()
" Template<B> templ;\n"
" @\n"
"}\n"
- ) << _("templ.t.") << (QStringList()
- << QLatin1String("B")
- << QLatin1String("b"));
+ ) << _("templ.t.") << QStringList({ "B", "b" });
QTest::newRow("template_parameter_defined_inside_scope_of_declaration_QTCREATORBUG8852_1") << _(
"template <typename T>\n"
@@ -2291,9 +2044,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("list.at(0).") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("list.at(0).") << QStringList({ "Foo", "bar" });
QTest::newRow("template_parameter_defined_inside_scope_of_declaration_QTCREATORBUG8852_2") << _(
"template <typename T>\n"
@@ -2313,9 +2064,7 @@ void CppToolsPlugin::test_completion_data()
" }\n"
" }\n"
"}\n"
- ) << _("list.at(0).") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("list.at(0).") << QStringList({ "Foo", "bar" });
QTest::newRow("template_parameter_defined_inside_scope_of_declaration_QTCREATORBUG8852_3") << _(
"template <typename T>\n"
@@ -2333,9 +2082,7 @@ void CppToolsPlugin::test_completion_data()
" QList<Foo> list;\n"
" @\n"
"}\n"
- ) << _("list.at(0).") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("list.at(0).") << QStringList({ "Foo", "bar" });
const QByteArray commonSignalSlotCompletionTestCode =
"#define SIGNAL(a) #a\n"
@@ -2386,67 +2133,43 @@ void CppToolsPlugin::test_completion_data()
QTest::newRow("SIGNAL(")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, SIGNAL(") << (QStringList()
- << QLatin1String("baseSignal1()")
- << QLatin1String("baseSignal2(int)")
- << QLatin1String("hiddenSignal()")
- << QLatin1String("derivedSignal1()")
- << QLatin1String("derivedSignal2(int)"));
+ << _("connect(myObject, SIGNAL(") << QStringList({ "baseSignal1()", "baseSignal2(int)",
+ "hiddenSignal()", "derivedSignal1()",
+ "derivedSignal2(int)" });
QTest::newRow("SLOT(")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, SIGNAL(baseSignal1()), myObject, SLOT(") << (QStringList()
- << QLatin1String("baseSlot1()")
- << QLatin1String("baseSlot2(int)")
- << QLatin1String("derivedSlot1()")
- << QLatin1String("derivedSlot2(int)"));
+ << _("connect(myObject, SIGNAL(baseSignal1()), myObject, SLOT(")
+ << QStringList({ "baseSlot1()", "baseSlot2(int)", "derivedSlot1()", "derivedSlot2(int)" });
QTest::newRow("Qt5 signals: complete class after & at 2nd connect arg")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &") << (QStringList()
- << QLatin1String("N::Derived"));
+ << _("connect(myObject, &") << QStringList("N::Derived");
QTest::newRow("Qt5 signals: complete class after & at 4th connect arg")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &MyObject::timeout, myObject, &") << (QStringList()
- << QLatin1String("N::Derived"));
+ << _("connect(myObject, &MyObject::timeout, myObject, &") << QStringList("N::Derived");
QTest::newRow("Qt5 signals: complete signals")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &N::Derived::") << (QStringList()
- << QLatin1String("baseSignal1")
- << QLatin1String("baseSignal2")
- << QLatin1String("hiddenSignal")
- << QLatin1String("derivedSignal1")
- << QLatin1String("derivedSignal2"));
+ << _("connect(myObject, &N::Derived::")
+ << QStringList({ "baseSignal1", "baseSignal2", "hiddenSignal", "derivedSignal1",
+ "derivedSignal2" });
QTest::newRow("Qt5 slots")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &N::Derived, myObject, &N::Derived::") << (QStringList()
- << QLatin1String("baseFunction")
- << QLatin1String("baseSignal1")
- << QLatin1String("baseSignal2")
- << QLatin1String("baseSlot1")
- << QLatin1String("baseSlot2")
- << QLatin1String("derivedFunction")
- << QLatin1String("derivedSignal1")
- << QLatin1String("derivedSignal2")
- << QLatin1String("derivedSlot1")
- << QLatin1String("derivedSlot2")
- << QLatin1String("hiddenFunction")
- << QLatin1String("hiddenSignal"));
+ << _("connect(myObject, &N::Derived, myObject, &N::Derived::")
+ << QStringList({ "baseFunction", "baseSignal1", "baseSignal2", "baseSlot1", "baseSlot2",
+ "derivedFunction", "derivedSignal1", "derivedSignal2", "derivedSlot1",
+ "derivedSlot2", "hiddenFunction", "hiddenSignal" });
QTest::newRow("Qt5 signals: fallback to scope completion")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &N::") << (QStringList()
- << QLatin1String("Base")
- << QLatin1String("Derived"));
+ << _("connect(myObject, &N::") << QStringList({ "Base", "Derived" });
QTest::newRow("Qt5 slots: fallback to scope completion")
<< commonSignalSlotCompletionTestCode
- << _("connect(myObject, &N::Derived, myObject, &N::") << (QStringList()
- << QLatin1String("Base")
- << QLatin1String("Derived"));
+ << _("connect(myObject, &N::Derived, myObject, &N::") << QStringList({ "Base", "Derived" });
QTest::newRow("signals_hide_QPrivateSignal") << _(
"#define SIGNAL(a) #a\n"
@@ -2472,8 +2195,7 @@ void CppToolsPlugin::test_completion_data()
" Timer *timer = new Timer;\n"
" @\n"
"}\n"
- ) << _("connect(timer, SIGNAL(") << (QStringList()
- << QLatin1String("timeout()"));
+ ) << _("connect(timer, SIGNAL(") << QStringList("timeout()");
QTest::newRow("member_of_class_accessed_by_using_QTCREATORBUG9037_1") << _(
"namespace NS { struct S { int member; void fun(); }; }\n"
@@ -2482,8 +2204,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("mem") << (QStringList()
- << QLatin1String("member"));
+ ) << _("mem") << QStringList("member");
QTest::newRow("member_of_class_accessed_by_using_QTCREATORBUG9037_2") << _(
"namespace NS \n"
@@ -2499,8 +2220,7 @@ void CppToolsPlugin::test_completion_data()
"{\n"
" @\n"
"}\n"
- ) << _("mem") << (QStringList()
- << QLatin1String("member"));
+ ) << _("mem") << QStringList("member");
QTest::newRow("no_binding_block_as_instantiationOrigin_QTCREATORBUG-11424") << _(
"template <typename T>\n"
@@ -2516,7 +2236,7 @@ void CppToolsPlugin::test_completion_data()
" typedef QVector<V>::ConstIterator Iter;\n"
" @\n"
"}\n"
- ) << _("double val = d.constBegin()->") << (QStringList());
+ ) << _("double val = d.constBegin()->") << QStringList();
QTest::newRow("nested_class_in_template_class_QTCREATORBUG-11752") << _(
"template <typename T>\n"
@@ -2530,9 +2250,7 @@ void CppToolsPlugin::test_completion_data()
" Temp<Foo>::Nested2 n2;\n"
" @\n"
"}\n"
- ) << _("n2.n1.t.") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("n2.n1.t.") << QStringList({ "foo", "Foo" });
QTest::newRow("infiniteLoopLocalTypedef_QTCREATORBUG-11999") << _(
"template <typename T>\n"
@@ -2550,14 +2268,11 @@ void CppToolsPlugin::test_completion_data()
" Temp<Foo> tempFoo;\n"
" @\n"
"}\n"
- ) << _("tempFoo.nested.t.") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("tempFoo.nested.t.") << QStringList({ "foo", "Foo" });
QTest::newRow("lambda_parameter") << _(
"auto func = [](int arg1) { return @; };\n"
- ) << _("ar") << (QStringList()
- << QLatin1String("arg1"));
+ ) << _("ar") << QStringList("arg1");
QTest::newRow("default_arguments_for_class_templates_and_base_class_QTCREATORBUG-12605") << _(
"struct Foo { int foo; };\n"
@@ -2567,10 +2282,7 @@ void CppToolsPlugin::test_completion_data()
" Derived<> derived;\n"
" @\n"
"}\n"
- ) << _("derived.") << (QStringList()
- << QLatin1String("Derived")
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("derived.") << QStringList({ "Derived", "foo", "Foo" });
QTest::newRow("default_arguments_for_class_templates_and_template_base_class_QTCREATORBUG-12606") << _(
"struct Foo { int foo; };\n"
@@ -2582,9 +2294,7 @@ void CppToolsPlugin::test_completion_data()
" Derived<> derived;\n"
" @\n"
"}\n"
- ) << _("derived.t.") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("derived.t.") << QStringList({ "foo", "Foo" });
QTest::newRow("template_specialization_and_initialization_with_pointer1") << _(
"template <typename T>\n"
@@ -2596,9 +2306,7 @@ void CppToolsPlugin::test_completion_data()
" S<Foo*> s;\n"
" @\n"
"}\n"
- ) << _("s.t->") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("s.t->") << QStringList({ "foo", "Foo" });
// this is not a valid code(is not compile) but it caused a crash
QTest::newRow("template_specialization_and_initialization_with_pointer2") << _(
@@ -2611,9 +2319,7 @@ void CppToolsPlugin::test_completion_data()
" S<Foo*> s;\n"
" @\n"
"}\n"
- ) << _("s.t->") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("s.t->") << QStringList({ "foo", "Foo" });
QTest::newRow("typedef_of_pointer_of_array_QTCREATORBUG-12703") << _(
"struct Foo { int foo; };\n"
@@ -2622,9 +2328,7 @@ void CppToolsPlugin::test_completion_data()
" FooArr arr;\n"
" @\n"
"}\n"
- ) << _("arr[0]->") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("Foo"));
+ ) << _("arr[0]->") << QStringList({ "foo", "Foo" });
QTest::newRow("template_specialization_with_array1") << _(
"template <typename T>\n"
@@ -2635,9 +2339,7 @@ void CppToolsPlugin::test_completion_data()
" S<int[]> s;\n"
" @\n"
"}\n"
- ) << _("s.") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("S"));
+ ) << _("s.") << QStringList({ "foo", "S" });
QTest::newRow("template_specialization_with_array2") << _(
"template <typename T>\n"
@@ -2648,9 +2350,7 @@ void CppToolsPlugin::test_completion_data()
" S<int[3]> s;\n"
" @\n"
"}\n"
- ) << _("s.") << (QStringList()
- << QLatin1String("foo")
- << QLatin1String("S"));
+ ) << _("s.") << QStringList({ "foo", "S" });
QTest::newRow("template_specialization_with_array3") << _(
"struct Bar {};\n"
@@ -2662,8 +2362,7 @@ void CppToolsPlugin::test_completion_data()
" S<int[]> s;\n"
" @\n"
"}\n"
- ) << _("s.") << (QStringList()
- << QLatin1String("S"));
+ ) << _("s.") << QStringList("S");
QTest::newRow("auto_declaration_in_if_condition") << _(
"struct Foo { int bar; };\n"
@@ -2672,9 +2371,7 @@ void CppToolsPlugin::test_completion_data()
" @\n"
" }\n"
"}\n"
- ) << _("s->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("s->") << QStringList({ "Foo", "bar" });
QTest::newRow("dereference_of_nested_type_opertor_*") << _(
"template<typename T>\n"
@@ -2692,9 +2389,7 @@ void CppToolsPlugin::test_completion_data()
" QList<Foo> list;\n"
" @\n"
"}\n"
- ) << _("(*list.begin()).") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("(*list.begin()).") << QStringList({ "Foo", "bar" });
QTest::newRow("dereference_of_nested_type_opertor_->") << _(
"template<typename T>\n"
@@ -2712,9 +2407,7 @@ void CppToolsPlugin::test_completion_data()
" QList<Foo> list;\n"
" @\n"
"}\n"
- ) << _("list.begin()->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("list.begin()->") << QStringList({ "Foo", "bar" });
QTest::newRow("dereference_of_nested_type_opertor_*_and_auto") << _(
"template<typename T>\n"
@@ -2733,9 +2426,7 @@ void CppToolsPlugin::test_completion_data()
" auto a = list.begin();\n"
" @\n"
"}\n"
- ) << _("(*a).") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("(*a).") << QStringList({ "Foo", "bar" });
QTest::newRow("dereference_of_nested_type_opertor_->_and_auto") << _(
"template<typename T>\n"
@@ -2754,9 +2445,7 @@ void CppToolsPlugin::test_completion_data()
" auto a = list.begin();\n"
" @\n"
"}\n"
- ) << _("a->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("a->") << QStringList({ "Foo", "bar" });
QTest::newRow("direct_nested_template_type_access") << _(
"template<typename T>\n"
@@ -2774,10 +2463,7 @@ void CppToolsPlugin::test_completion_data()
" auto a = QList<Foo>::begin();\n"
" @\n"
"}\n"
- ) << _("a.") << (QStringList()
- << QLatin1String("operator ->")
- << QLatin1String("t")
- << QLatin1String("iterator"));
+ ) << _("a.") << QStringList({ "operator ->", "t", "iterator" });
QTest::newRow("pointer_indirect_specialization") << _(
"template<typename T>\n"
@@ -2804,9 +2490,7 @@ void CppToolsPlugin::test_completion_data()
" Temp<Foo *> t;\n"
" @\n"
"}\n"
- ) << _("t.p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("t.p->") << QStringList({ "Foo", "bar" });
QTest::newRow("pointer_indirect_specialization_typedef") << _(
"template<typename T>\n"
@@ -2833,9 +2517,7 @@ void CppToolsPlugin::test_completion_data()
" Temp t;\n"
" @\n"
"}\n"
- ) << _("t.p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("t.p->") << QStringList({ "Foo", "bar" });
QTest::newRow("pointer_indirect_specialization_double_indirection") << _(
"template<typename _Tp>\n"
@@ -2866,9 +2548,7 @@ void CppToolsPlugin::test_completion_data()
" Temp<Foo>::indirect t;\n"
" @\n"
"}\n"
- ) << _("t.p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("t.p->") << QStringList({ "Foo", "bar" });
QTest::newRow("pointer_indirect_specialization_double_indirection_with_base") << _(
"template<typename _Tp>\n"
@@ -2903,9 +2583,7 @@ void CppToolsPlugin::test_completion_data()
" Temp<Foo>::indirect t;\n"
" @\n"
"}\n"
- ) << _("t.p->") << (QStringList()
- << QLatin1String("Foo")
- << QLatin1String("bar"));
+ ) << _("t.p->") << QStringList({ "Foo", "bar" });
}
void CppToolsPlugin::test_completion_member_access_operator()
@@ -2942,9 +2620,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"void f() { S *s;\n"
"@\n"
"}\n"
- ) << _("s.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("t"))
+ ) << _("s.") << QStringList({ "S", "t" })
<< false
<< true;
@@ -2954,7 +2630,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
" Bar *bar;\n"
" void func() { @ }"
"};\n"
- ) << _("bar.") << (QStringList())
+ ) << _("bar.") << QStringList()
<< true
<< false;
@@ -2963,9 +2639,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef S SType;\n"
"SType p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< false;
@@ -2974,7 +2648,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef S *SType;\n"
"SType *p;\n"
"@\n"
- ) << _("p.") << (QStringList())
+ ) << _("p.") << QStringList()
<< false
<< false;
@@ -2983,9 +2657,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef S SType;\n"
"SType *p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< true;
@@ -2994,9 +2666,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef S* SPtr;\n"
"SPtr p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< true;
@@ -3005,9 +2675,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"struct S { int m; };\n"
"SType *p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< true;
@@ -3016,9 +2684,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"struct S { int m; };\n"
"SType p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< false;
@@ -3027,7 +2693,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"struct S { int m; };\n"
"SType *p;\n"
"@\n"
- ) << _("p.") << (QStringList())
+ ) << _("p.") << QStringList()
<< false
<< false;
@@ -3036,9 +2702,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"struct S { int m; };\n"
"SType p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< true;
@@ -3048,9 +2712,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef struct SType *STypePtr;\n"
"STypePtr p;\n"
"@\n"
- ) << _("p.") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p.") << QStringList({ "S", "m" })
<< false
<< true;
@@ -3060,9 +2722,7 @@ void CppToolsPlugin::test_completion_member_access_operator_data()
"typedef struct SType *STypePtr;\n"
"STypePtr p;\n"
"@\n"
- ) << _("p->") << (QStringList()
- << QLatin1String("S")
- << QLatin1String("m"))
+ ) << _("p->") << QStringList({ "S", "m" })
<< false
<< false;
}
diff --git a/src/plugins/cpptools/cppcompletionassistprocessor.cpp b/src/plugins/cpptools/cppcompletionassistprocessor.cpp
index d1a1be9bac..5e967455d4 100644
--- a/src/plugins/cpptools/cppcompletionassistprocessor.cpp
+++ b/src/plugins/cpptools/cppcompletionassistprocessor.cpp
@@ -42,34 +42,14 @@ namespace CppTools {
CppCompletionAssistProcessor::CppCompletionAssistProcessor(int snippetItemOrder)
: m_positionForProposal(-1)
- , m_preprocessorCompletions(QStringList()
- << QLatin1String("define")
- << QLatin1String("error")
- << QLatin1String("include")
- << QLatin1String("line")
- << QLatin1String("pragma")
- << QLatin1String("pragma once")
- << QLatin1String("pragma omp atomic")
- << QLatin1String("pragma omp parallel")
- << QLatin1String("pragma omp for")
- << QLatin1String("pragma omp ordered")
- << QLatin1String("pragma omp parallel for")
- << QLatin1String("pragma omp section")
- << QLatin1String("pragma omp sections")
- << QLatin1String("pragma omp parallel sections")
- << QLatin1String("pragma omp single")
- << QLatin1String("pragma omp master")
- << QLatin1String("pragma omp critical")
- << QLatin1String("pragma omp barrier")
- << QLatin1String("pragma omp flush")
- << QLatin1String("pragma omp threadprivate")
- << QLatin1String("undef")
- << QLatin1String("if")
- << QLatin1String("ifdef")
- << QLatin1String("ifndef")
- << QLatin1String("elif")
- << QLatin1String("else")
- << QLatin1String("endif"))
+ , m_preprocessorCompletions(
+ QStringList({ "define", "error", "include", "line", "pragma", "pragma once",
+ "pragma omp atomic", "pragma omp parallel", "pragma omp for",
+ "pragma omp ordered", "pragma omp parallel for", "pragma omp section",
+ "pragma omp sections", "pragma omp parallel sections", "pragma omp single",
+ "pragma omp master", "pragma omp critical", "pragma omp barrier",
+ "pragma omp flush", "pragma omp threadprivate", "undef", "if", "ifdef",
+ "ifndef", "elif", "else", "endif" }))
, m_hintProposal(0)
, m_snippetCollector(QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID),
QIcon(QLatin1String(":/texteditor/images/snippet.png")),
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp
index 4fcc68c6dc..0c73c44d8d 100644
--- a/src/plugins/cpptools/cppfilesettingspage.cpp
+++ b/src/plugins/cpptools/cppfilesettingspage.cpp
@@ -87,15 +87,12 @@ void CppFileSettings::toSettings(QSettings *s) const
void CppFileSettings::fromSettings(QSettings *s)
{
- const QStringList defaultHeaderSearchPaths = QStringList()
- << QLatin1String("include")
- << QLatin1String("Include")
- << QDir::toNativeSeparators(QLatin1String("../include"))
- << QDir::toNativeSeparators(QLatin1String("../Include"));
- const QStringList defaultSourceSearchPaths = QStringList()
- << QDir::toNativeSeparators(QLatin1String("../src"))
- << QDir::toNativeSeparators(QLatin1String("../Src"))
- << QLatin1String("..");
+ const QStringList defaultHeaderSearchPaths
+ = QStringList({ "include", "Include", QDir::toNativeSeparators("../include"),
+ QDir::toNativeSeparators("../Include") });
+ const QStringList defaultSourceSearchPaths
+ = QStringList({ QDir::toNativeSeparators("../src"), QDir::toNativeSeparators("../Src"),
+ ".." });
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
headerPrefixes = s->value(QLatin1String(headerPrefixesKeyC)).toStringList();
sourcePrefixes = s->value(QLatin1String(sourcePrefixesKeyC)).toStringList();