aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus/Bind.cpp
diff options
context:
space:
mode:
authorArtem Sokolovskii <artem.sokolovskii@qt.io>2022-10-31 16:31:20 +0100
committerArtem Sokolovskii <artem.sokolovskii@qt.io>2022-11-10 09:04:09 +0000
commit39d04fb9e7bc2323244f9e8a725a6e6da56160ef (patch)
tree47ee375cdfdcb47cbcfddac7942508e6a53dab05 /src/libs/3rdparty/cplusplus/Bind.cpp
parent421e5d9c598d10768769e9c4586b775534db09d2 (diff)
QuickFix: Fix generate function definition with unsigned type
Fixes: QTCREATORBUG-28378 Change-Id: Ic94901e430d08aab22c8f4c394eda1f8a93398bc Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Bind.cpp')
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index 4ad562eb0c..effaac4b65 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -276,8 +276,25 @@ FullySpecifiedType Bind::postfixDeclarator(PostfixDeclaratorAST *ast, const Full
return value;
}
-bool Bind::preVisit(AST *)
-{
+bool Bind::preVisit(AST *ast)
+{
+ if (_typeWasUnsignedOrSigned) {
+ if (SimpleSpecifierAST *simpleAst = ast->asSimpleSpecifier()) {
+ switch (tokenKind(simpleAst->specifier_token)) {
+ case T_CHAR:
+ case T_CHAR16_T:
+ case T_CHAR32_T:
+ case T_WCHAR_T:
+ case T_INT:
+ case T_SHORT:
+ case T_LONG:
+ _type.setType(&UndefinedType::instance);
+ break;
+ }
+ }
+ _typeWasUnsignedOrSigned = false;
+ }
+
++_depth;
if (_depth > kMaxDepth)
return false;
@@ -2980,13 +2997,17 @@ bool Bind::visit(SimpleSpecifierAST *ast)
case T_SIGNED:
if (_type.isSigned())
translationUnit()->error(ast->specifier_token, "duplicate `%s'", spell(ast->specifier_token));
+ _type.setType(control()->integerType(IntegerType::Int));
_type.setSigned(true);
+ _typeWasUnsignedOrSigned = true;
break;
case T_UNSIGNED:
if (_type.isUnsigned())
translationUnit()->error(ast->specifier_token, "duplicate `%s'", spell(ast->specifier_token));
+ _type.setType(control()->integerType(IntegerType::Int));
_type.setUnsigned(true);
+ _typeWasUnsignedOrSigned = true;
break;
case T_CHAR: