CppEditor: Do not rely on object identity when comparing names

In particular, the same namespace can be declared in lots of different
places.

Fixes: QTCREATORBUG-25776
Change-Id: I7e255cee560043ed4beb47b8047f99c3a9c21198
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-06-24 14:20:04 +02:00
parent f1eaf25dff
commit 4ff26e2a27

View File

@@ -3583,8 +3583,10 @@ protected:
if (i.type()->isNamedType()) { // check if we have to search recursively if (i.type()->isNamedType()) { // check if we have to search recursively
const Name *newName = i.type()->asNamedType()->name(); const Name *newName = i.type()->asNamedType()->name();
Scope *newScope = i.declaration()->enclosingScope(); Scope *newScope = i.declaration()->enclosingScope();
if (newName == name && newScope == scope) if (Matcher::match(newName, name)
&& Matcher::match(newScope->name(), scope->name())) {
continue; // we have found the start location of the search continue; // we have found the start location of the search
}
return isValueType(newName, newScope, isValueType); return isValueType(newName, newScope, isValueType);
} }
return false; return false;