diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 9cf33655cf5..7fea6918fb7 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -42,6 +42,11 @@ #include + +namespace { + const bool debug = ! qgetenv("CPLUSPLUS_LOOKUPCONTEXT_DEBUG").isEmpty(); +} + using namespace CPlusPlus; static void fullyQualifiedName_helper(Symbol *symbol, QList *names) @@ -162,7 +167,7 @@ ClassOrNamespace *LookupContext::globalNamespace() const ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope) const { - if (ClassOrNamespace *b = bindings()->findClassOrNamespace(scope->owner())) + if (ClassOrNamespace *b = bindings()->lookupType(scope->owner())) return b->lookupType(name); return 0; @@ -170,7 +175,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope) cons ClassOrNamespace *LookupContext::lookupType(Symbol *symbol) const { - return bindings()->findClassOrNamespace(symbol); + return bindings()->lookupType(symbol); } QList LookupContext::lookup(const Name *name, Scope *scope) const @@ -194,7 +199,7 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const if (UsingNamespaceDirective *u = member->asUsingNamespaceDirective()) { if (Namespace *enclosingNamespace = u->enclosingNamespaceScope()->owner()->asNamespace()) { - if (ClassOrNamespace *b = bindings()->findClassOrNamespace(enclosingNamespace)) { + if (ClassOrNamespace *b = bindings()->lookupType(enclosingNamespace)) { if (ClassOrNamespace *uu = b->lookupType(u->name())) { candidates = uu->lookup(name); @@ -224,7 +229,7 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const path.append(name); } - if (ClassOrNamespace *binding = bindings()->findClassOrNamespace(path)) + if (ClassOrNamespace *binding = bindings()->lookupType(path)) return binding->lookup(name); } @@ -236,7 +241,7 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const } else if (scope->isClassScope() || scope->isNamespaceScope() || scope->isObjCClassScope() || scope->isObjCProtocolScope()) { - if (ClassOrNamespace *binding = bindings()->findClassOrNamespace(scope->owner())) + if (ClassOrNamespace *binding = bindings()->lookupType(scope->owner())) return binding->lookup(name); break; @@ -627,7 +632,7 @@ ClassOrNamespace *CreateBindings::globalNamespace() const return _globalNamespace; } -ClassOrNamespace *CreateBindings::findClassOrNamespace(Symbol *symbol) +ClassOrNamespace *CreateBindings::lookupType(Symbol *symbol) { const QList names = LookupContext::fullyQualifiedName(symbol); @@ -642,7 +647,7 @@ ClassOrNamespace *CreateBindings::findClassOrNamespace(Symbol *symbol) return b; } -ClassOrNamespace *CreateBindings::findClassOrNamespace(const QList &path) +ClassOrNamespace *CreateBindings::lookupType(const QList &path) { ClassOrNamespace *e = _globalNamespace->findType(path); return e; diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h index bf25ed1d5c5..b96ab2f84a6 100644 --- a/src/libs/cplusplus/LookupContext.h +++ b/src/libs/cplusplus/LookupContext.h @@ -124,11 +124,11 @@ public: ClassOrNamespace *globalNamespace() const; /// Finds the binding associated to the given symbol. - ClassOrNamespace *findClassOrNamespace(Symbol *symbol); + ClassOrNamespace *lookupType(Symbol *symbol); /// Find the binding with the given path. /// \internal - ClassOrNamespace *findClassOrNamespace(const QList &path); + ClassOrNamespace *lookupType(const QList &path); /// Returns the Control that must be used to create temporary symbols. /// \internal