CPlusPlus: Provide information about the "static" specifier

... to the function type.
This fixes the issue for function *definitions*. For function
*declarations*, we need to amend the parser.

Task-number: QTCREATORBUG-24894
Change-Id: I02043d8b974c2c64dcd739c7e05ce44fd277b5d3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-11-06 14:15:18 +01:00
parent 1e2939916e
commit 42d34015e2
4 changed files with 7 additions and 1 deletions

View File

@@ -135,6 +135,8 @@ void Bind::setDeclSpecifiers(Symbol *symbol, const FullySpecifiedType &declSpeci
if (Function *funTy = symbol->asFunction()) {
if (declSpecifiers.isVirtual())
funTy->setVirtual(true);
if (declSpecifiers.isStatic())
funTy->setStatic(true);
}
if (declSpecifiers.isDeprecated())

View File

@@ -405,6 +405,7 @@ FullySpecifiedType Function::type() const
FullySpecifiedType ty(const_cast<Function *>(this));
ty.setConst(isConst());
ty.setVolatile(isVolatile());
ty.setStatic(isStatic());
return ty;
}

View File

@@ -352,6 +352,9 @@ public:
bool isConst() const;
void setConst(bool isConst);
bool isStatic() const { return f._isStatic; }
void setStatic(bool isStatic) { f._isStatic = isStatic; }
bool isVolatile() const;
void setVolatile(bool isVolatile);
@@ -399,6 +402,7 @@ private:
unsigned _isVirtual: 1;
unsigned _isOverride: 1;
unsigned _isFinal: 1;
unsigned _isStatic: 1;
unsigned _isVariadic: 1;
unsigned _isVariadicTemplate: 1;
unsigned _isPureVirtual: 1;