C++: Match const/volatile/signed/unsigned for FullySpecifiedType

Changing a function signature from const to non-const is not recognized as a
changed, and doesn't trigger the "Apply Function Signature Changes" quickfix.

For example:
void func(Foo &var);
void func(Foo &var) {} // Add const before Foo, quickfix is not triggered

Change-Id: I71ae41765d66df69204abd085fdfcfcb2d605f4c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2016-01-15 00:35:12 +02:00
committed by Orgad Shaneh
parent 07dd7d5fe2
commit 5be49c5187
2 changed files with 38 additions and 0 deletions

View File

@@ -216,5 +216,16 @@ void FullySpecifiedType::setFlags(unsigned flags)
bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *matcher) const
{
static const unsigned flagsMask = [](){
FullySpecifiedType ty;
ty.f._isConst = true;
ty.f._isVolatile = true;
ty.f._isSigned = true;
ty.f._isUnsigned = true;
return ty._flags;
}();
if ((_flags & flagsMask) != (otherTy._flags & flagsMask))
return false;
return type()->match(otherTy.type(), matcher);
}