Commit e0594fc9 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

C++: Fix expensive lookup for boost

With this patch, CheckSymbols takes about 200ms for processing the boost/proto
hello world example [1]. Before, it needed about 11 seconds (timer in
CheckSymbols::run). Same goes for including <boost/fusion/include/zip.hpp>.

The custom ProcessedSet object was added to support "completion for typedefs
for templates in namespaces", but apparently that's not needed anymore, as the
added test proves.


Task-numer: QTCREATORBUG-14889
Task-numer: QTCREATORBUG-14741
Change-Id: I90454e8970a9d04033d56beeb0c6d7a0d4e6cc62
Reviewed-by: default avatarOrgad Shaneh <>
parent 87df7c40
......@@ -1001,13 +1001,11 @@ LookupScope *LookupScopePrivate::lookupType_helper(
if (const QualifiedNameId *qName = name->asQualifiedNameId()) {
ProcessedSet innerProcessed;
if (! qName->base())
return globalNamespace()->d->lookupType_helper(qName->name(), &innerProcessed, true, origin);
return globalNamespace()->d->lookupType_helper(qName->name(), processed, true, origin);
if (LookupScope *binding = lookupType_helper(qName->base(), processed, true, origin))
return binding->d->lookupType_helper(qName->name(), &innerProcessed, false, origin);
return binding->d->lookupType_helper(qName->name(), processed, false, origin);
return 0;
......@@ -3235,6 +3235,24 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("Foo")
<< QLatin1String("bar"));
QTest::newRow("typedef for templates in namespace") << _(
"namespace N {\n"
"struct Data { int x; };\n"
"template <typename T> struct Foo { T member; };\n"
"typedef Foo<Data> Bar;\n"
"} // N\n"
"void f()\n"
" N::Bar o;\n"
" @\n"
) << _("o.member.") << (QStringList()
<< QLatin1String("Data")
<< QLatin1String("x"));
void CppToolsPlugin::test_completion_member_access_operator()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment