forked from qt-creator/qt-creator
C++: Do not compare flags when matching types
Trust the matcher to do the job. Task-number: QTCREATORBUG-13564 Change-Id: I4ff14608a1ce12d3f4424242e50ba71233ac9bfd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
50efe4a5b3
commit
8bb176d2ec
2
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
2
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -1918,7 +1918,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
|
|||||||
|
|
||||||
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
|
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
|
||||||
DeclaratorIdAST *declaratorId = 0;
|
DeclaratorIdAST *declaratorId = 0;
|
||||||
FullySpecifiedType declTy = this->declarator(it->value, type.qualifiedType(), &declaratorId);
|
FullySpecifiedType declTy = this->declarator(it->value, type, &declaratorId);
|
||||||
|
|
||||||
const Name *declName = 0;
|
const Name *declName = 0;
|
||||||
unsigned sourceLocation = location(it->value, ast->firstToken());
|
unsigned sourceLocation = location(it->value, ast->firstToken());
|
||||||
|
@@ -235,8 +235,5 @@ void FullySpecifiedType::copySpecifiers(const FullySpecifiedType &type)
|
|||||||
|
|
||||||
bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *matcher) const
|
bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *matcher) const
|
||||||
{
|
{
|
||||||
if (_flags != otherTy._flags)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return type()->match(otherTy.type(), matcher);
|
return type()->match(otherTy.type(), matcher);
|
||||||
}
|
}
|
||||||
|
@@ -210,6 +210,7 @@ private slots:
|
|||||||
void test_quickfix_MoveFuncDefToDecl_CtorWithInitialization();
|
void test_quickfix_MoveFuncDefToDecl_CtorWithInitialization();
|
||||||
void test_quickfix_MoveFuncDefToDecl_structWithAssignedVariable();
|
void test_quickfix_MoveFuncDefToDecl_structWithAssignedVariable();
|
||||||
void test_quickfix_MoveFuncDefToDecl_macroUses();
|
void test_quickfix_MoveFuncDefToDecl_macroUses();
|
||||||
|
void test_quickfix_MoveFuncDefToDecl_override();
|
||||||
|
|
||||||
void test_quickfix_AssignToLocalVariable_templates();
|
void test_quickfix_AssignToLocalVariable_templates();
|
||||||
|
|
||||||
|
@@ -4145,6 +4145,36 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_macroUses()
|
|||||||
ProjectPart::HeaderPaths(), 0, "QTCREATORBUG-12314");
|
ProjectPart::HeaderPaths(), 0, "QTCREATORBUG-12314");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_override()
|
||||||
|
{
|
||||||
|
QByteArray original =
|
||||||
|
"struct Base {\n"
|
||||||
|
" virtual int foo() = 0;\n"
|
||||||
|
"};\n"
|
||||||
|
"struct Derived : Base {\n"
|
||||||
|
" int foo() override;\n"
|
||||||
|
"};\n"
|
||||||
|
"\n"
|
||||||
|
"int Derived::fo@o()\n"
|
||||||
|
"{\n"
|
||||||
|
" return 5;\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
QByteArray expected =
|
||||||
|
"struct Base {\n"
|
||||||
|
" virtual int foo() = 0;\n"
|
||||||
|
"};\n"
|
||||||
|
"struct Derived : Base {\n"
|
||||||
|
" int foo() override\n"
|
||||||
|
" {\n"
|
||||||
|
" return 5;\n"
|
||||||
|
" }\n"
|
||||||
|
"};\n\n\n";
|
||||||
|
|
||||||
|
MoveFuncDefToDecl factory;
|
||||||
|
QuickFixOperationTest(singleDocument(original, expected), &factory);
|
||||||
|
}
|
||||||
|
|
||||||
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_templates()
|
void CppEditorPlugin::test_quickfix_AssignToLocalVariable_templates()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user