forked from qt-creator/qt-creator
CPlusPlus: Revert name minimization fix
This effetively reverts 87ec0f349f
, which had unwanted side effects.
Change-Id: I03438c18f43b07a6560416af746132bc4471fbb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -217,13 +217,7 @@ QList<const Name *> LookupContext::fullyQualifiedName(Symbol *symbol, InlineName
|
|||||||
{
|
{
|
||||||
QList<const Name *> qualifiedName = path(symbol->enclosingScope(), policy);
|
QList<const Name *> qualifiedName = path(symbol->enclosingScope(), policy);
|
||||||
QList<const Name *> symbolNames;
|
QList<const Name *> symbolNames;
|
||||||
addNames(symbol->name(), &symbolNames, /*add all names*/ true);
|
addNames(symbol->name(), &qualifiedName, /*add all names*/ true);
|
||||||
if (const UsingDeclaration * const usingDecl = symbol->asUsingDeclaration()) {
|
|
||||||
if (!symbolNames.isEmpty())
|
|
||||||
qualifiedName << symbolNames.last();
|
|
||||||
} else {
|
|
||||||
qualifiedName << symbolNames;
|
|
||||||
}
|
|
||||||
return qualifiedName;
|
return qualifiedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +812,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
|||||||
continue; // skip using namespace directives
|
continue; // skip using namespace directives
|
||||||
else if (! id->match(s->identifier()))
|
else if (! id->match(s->identifier()))
|
||||||
continue;
|
continue;
|
||||||
else if (s->name() && s->name()->isQualifiedNameId() && !s->asUsingDeclaration())
|
else if (s->name() && s->name()->isQualifiedNameId())
|
||||||
continue; // skip qualified ids.
|
continue; // skip qualified ids.
|
||||||
|
|
||||||
if (Q_UNLIKELY(debug)) {
|
if (Q_UNLIKELY(debug)) {
|
||||||
|
@@ -4322,6 +4322,7 @@ void Foo::otherFunc()
|
|||||||
QuickFixOperationTest(testDocuments, &factory);
|
QuickFixOperationTest(testDocuments, &factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: QTCREATORBUG-14524.
|
||||||
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_usingDecl()
|
void CppEditorPlugin::test_quickfix_InsertDefFromDecl_usingDecl()
|
||||||
{
|
{
|
||||||
QList<QuickFixTestDocument::Ptr> testDocuments;
|
QList<QuickFixTestDocument::Ptr> testDocuments;
|
||||||
@@ -4346,7 +4347,7 @@ void @func(const S &s);
|
|||||||
expected = R"(
|
expected = R"(
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
void func(const S &s)
|
void func(const N::S &s)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4355,6 +4356,33 @@ void func(const S &s)
|
|||||||
|
|
||||||
InsertDefFromDecl factory;
|
InsertDefFromDecl factory;
|
||||||
QuickFixOperationTest(testDocuments, &factory);
|
QuickFixOperationTest(testDocuments, &factory);
|
||||||
|
|
||||||
|
testDocuments.clear();
|
||||||
|
original = R"(
|
||||||
|
namespace N1 {
|
||||||
|
namespace N2 { struct S; }
|
||||||
|
using N2::S;
|
||||||
|
}
|
||||||
|
|
||||||
|
void @func(const N1::S &s);
|
||||||
|
)";
|
||||||
|
expected = original;
|
||||||
|
testDocuments << QuickFixTestDocument::create("file.h", original, expected);
|
||||||
|
|
||||||
|
// Source File
|
||||||
|
original = R"(
|
||||||
|
#include "file.h"
|
||||||
|
)";
|
||||||
|
expected = R"(
|
||||||
|
#include "file.h"
|
||||||
|
|
||||||
|
void func(const N1::N2::S &s)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
|
||||||
|
QuickFixOperationTest(testDocuments, &factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find right implementation file. (QTCREATORBUG-10728)
|
/// Find right implementation file. (QTCREATORBUG-10728)
|
||||||
|
Reference in New Issue
Block a user