Commit 8bb176d2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

C++: Do not compare flags when matching types

Trust the matcher to do the job.

Task-number: QTCREATORBUG-13564
Change-Id: I4ff14608a1ce12d3f4424242e50ba71233ac9bfd
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 50efe4a5
...@@ -1918,7 +1918,7 @@ bool Bind::visit(SimpleDeclarationAST *ast) ...@@ -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) ...@@ -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: ...@@ -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() ...@@ -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()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment