C++: fix matching type with using from other namespace

example code:
struct S { int s; };

namespace std
{
    template <typename T>
    struct shared_ptr
    {
        T* operator->();
    };
}

namespace NS
{
    using std::shared_ptr;
}

int main()
{
    NS::shared_ptr<S> p;// for this shared_ptr
    return 0;
}

Fixes:
* find usages
* follow symbol
* highlighting
* marking

Task-number: QTCREATORBUG-7978
Change-Id: I28994c960b87ddd400e1d7b860fca6c6683bbb5a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2013-08-11 22:10:26 +02:00
committed by Erik Verbruggen
parent 9de44134c0
commit 3256b7b2ef
4 changed files with 89 additions and 3 deletions

View File

@@ -852,7 +852,10 @@ bool CheckSymbols::visit(QualifiedNameAST *ast)
addUse(ast->unqualified_name, CppHighlightingSupport::FunctionUse);
}
} else {
maybeAddTypeOrStatic(binding->find(ast->unqualified_name->name), ast->unqualified_name);
QList<LookupItem> items = binding->find(ast->unqualified_name->name);
if (items.empty())
items = _context.lookup(ast->name, enclosingScope());
maybeAddTypeOrStatic(items, ast->unqualified_name);
}
if (TemplateIdAST *template_id = ast->unqualified_name->asTemplateId())