forked from qt-creator/qt-creator
C++: Add support of ref-qualifier for functions.
Now the ref-qualifier (& or &&) of the function declaration is propagated to GUI. For example, 'Refactor' -> 'Add Definition' preserves the ref-qualifier. Change-Id: I8ac4e1cad4e44985e94230aabbd9858a7e929fee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
c0f3094866
commit
43075f5fb1
@@ -135,6 +135,7 @@ public:
|
||||
funTy->copy(type);
|
||||
funTy->setConst(type->isConst());
|
||||
funTy->setVolatile(type->isVolatile());
|
||||
funTy->setRefQualifier(type->refQualifier());
|
||||
|
||||
funTy->setName(rewrite->rewriteName(type->name()));
|
||||
|
||||
|
||||
@@ -454,6 +454,17 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
appendSpace();
|
||||
_text += QLatin1String("volatile");
|
||||
}
|
||||
|
||||
// add ref-qualifier
|
||||
if (type->refQualifier() != Function::NoRefQualifier) {
|
||||
if (!_overview->starBindFlags.testFlag(Overview::BindToLeftSpecifier)
|
||||
|| (!type->isConst() && !type->isVolatile())) {
|
||||
appendSpace();
|
||||
}
|
||||
_text += type->refQualifier() == Function::LvalueRefQualifier
|
||||
? QLatin1String("&")
|
||||
: QLatin1String("&&");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user