forked from qt-creator/qt-creator
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. [1] http://www.boost.org/doc/libs/1_58_0/doc/html/proto/users_guide.html#boost_proto.users_guide.getting_started.hello_world Task-numer: QTCREATORBUG-14889 Task-numer: QTCREATORBUG-14741 Change-Id: I90454e8970a9d04033d56beeb0c6d7a0d4e6cc62 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -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"
|
||||
"\n"
|
||||
"struct Data { int x; };\n"
|
||||
"template <typename T> struct Foo { T member; };\n"
|
||||
"typedef Foo<Data> Bar;\n"
|
||||
"\n"
|
||||
"} // N\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"void f()\n"
|
||||
"{\n"
|
||||
" N::Bar o;\n"
|
||||
" @\n"
|
||||
"}\n"
|
||||
) << _("o.member.") << (QStringList()
|
||||
<< QLatin1String("Data")
|
||||
<< QLatin1String("x"));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_member_access_operator()
|
||||
|
Reference in New Issue
Block a user