C++: fix code completion of stl containers in internal code model

This fix makes some trick and replaces existing typedef of 'pointer'
to the simplest one(only in class unique_ptr), e.g.:
template <class _Tp>
class unique_ptr
{
  typedef some_strange_things pointer;
  pointer operator->();
}
is replace with
template <class _Tp>
class unique_ptr
{
  typedef _Tp* pointer;
  pointer operator->();
}

In most of the implementation of unique_ptr it should work.

Similar approach is done for std::list, std::vector, std::queue, std::set,
std::multiset, std::unordered_set.

It is done in this hacky way to omit problems with cyclic and complex
resolving of typedefs.

Change-Id: I1363dfc5e23d3cd2fa7af7fc27423bfbac2d894d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Przemyslaw Gorszkowski
2017-05-24 11:08:24 +02:00
parent d3d3e2ace5
commit 7bcf483189
3 changed files with 266 additions and 8 deletions

View File

@@ -950,9 +950,8 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
foreach (const LookupItem &r, b->find(arrayAccessOp)) {
Symbol *overload = r.declaration();
if (Function *funTy = overload->type()->asFunctionType()) {
if (Function *proto = instantiate(namedTy->name(), funTy)->asFunctionType())
// ### TODO: check the actual arguments
addResult(proto->returnType().simplified(), scope);
// ### TODO: check the actual arguments
addResult(funTy->returnType().simplified(), scope, b);
}
}