forked from qt-creator/qt-creator
C++: add support for local types
This change addes support for class, enum definition inside blocks({}) or
functions, e.g.:
void f()
{
struct S
{
int bar;
};
S s;
s.bar;
}
It fixes:
* code completion
* highlighting
* follow symbol
* marking
* find usages
It fixes also problem with namespace aliases inside blocks or functions.
This change can have also impact on performance(there are additional processing)
Task-number: QTCREATORBUG-166 (namespace aliases inside function/block)
Task-number: QTCREATORBUG-3620
Task-number: QTCREATORBUG-6013
Task-number: QTCREATORBUG-8020
Change-Id: Iaea6c6dfe276f1d7b2279b50bdd2e68e375d31eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
2bc24b7a25
commit
68d6a762d9
@@ -81,7 +81,9 @@ public:
|
||||
QList<LookupItem> find(const Name *name);
|
||||
|
||||
ClassOrNamespace *lookupType(const Name *name);
|
||||
ClassOrNamespace *lookupType(const Name *name, Block *block);
|
||||
ClassOrNamespace *findType(const Name *name);
|
||||
ClassOrNamespace *findBlock(Block *block);
|
||||
|
||||
Symbol *lookupInScope(const QList<const Name *> &fullName);
|
||||
|
||||
@@ -126,6 +128,7 @@ private:
|
||||
QList<Symbol *> _symbols;
|
||||
QList<ClassOrNamespace *> _usings;
|
||||
Table _classOrNamespaces;
|
||||
QHash<Block *, ClassOrNamespace *> _blocks;
|
||||
QList<Enum *> _enums;
|
||||
QList<Symbol *> _todo;
|
||||
QSharedPointer<Control> _control;
|
||||
@@ -238,7 +241,9 @@ protected:
|
||||
virtual bool visit(ForwardClassDeclaration *klass);
|
||||
virtual bool visit(Enum *e);
|
||||
virtual bool visit(Declaration *decl);
|
||||
virtual bool visit(Function *);
|
||||
virtual bool visit(Function *function);
|
||||
virtual bool visit(Block *block);
|
||||
|
||||
virtual bool visit(BaseClass *b);
|
||||
virtual bool visit(UsingNamespaceDirective *u);
|
||||
virtual bool visit(UsingDeclaration *u);
|
||||
|
||||
Reference in New Issue
Block a user