aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus/Bind.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-05-18 23:19:32 +0300
committerOrgad Shaneh <orgads@gmail.com>2015-05-20 10:45:31 +0000
commitde68ac54073cc3389abcc4cdaa0131bca7a44874 (patch)
treeb47119b05b81694b142188b7164d8492ff092e85 /src/libs/3rdparty/cplusplus/Bind.cpp
parent57e3714db45920287118dddb9bc5d9df691110ec (diff)
C++: fix code completion for decltyped type
example: struct Foo { int bar; }; Foo foo() { return Foo; } typedef decltype(foo()) TypedefedFooWithDecltype; void fun() { decltype(foo()) decltypeFoo; decltypeFoo.;// code completion should work here TypedefedFooWithDecltype typedefedFooWithDecltype; typedefedFooWithDecltype.;// code completion should work here } Started-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com> Task-number: QTCREATORBUG-14483 Change-Id: I296ceed9d896c68cf0651265afb08a1fc42f9a68 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Bind.cpp')
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index a0a0e1a065..e3fd96de98 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -1921,9 +1921,22 @@ bool Bind::visit(SimpleDeclarationAST *ast)
methodKey = methodKeyForInvokableToken(tokenKind(ast->qt_invokable_token));
// unsigned qt_invokable_token = ast->qt_invokable_token;
+ unsigned declTypeStartOfExpression = 0;
+ unsigned declTypeEndOfExpression = 0;
+ bool isTypedef = false;
FullySpecifiedType type;
for (SpecifierListAST *it = ast->decl_specifier_list; it; it = it->next) {
type = this->specifier(it->value, type);
+ if (type.isTypedef())
+ isTypedef = true;
+
+ type.setTypedef(isTypedef);
+ if (type.isDecltype()) {
+ if (DecltypeSpecifierAST *decltypeSpec = it->value->asDecltypeSpecifier()) {
+ declTypeStartOfExpression = decltypeSpec->expression->firstToken();
+ declTypeEndOfExpression = decltypeSpec->expression->lastToken();
+ }
+ }
}
List<Symbol *> **symbolTail = &ast->symbols;
@@ -1982,6 +1995,9 @@ bool Bind::visit(SimpleDeclarationAST *ast)
unsigned endOfExpression = initializer->lastToken();
decl->setInitializer(asStringLiteral(startOfExpression, endOfExpression));
}
+ } else if (declTy.isDecltype()) {
+ decl->setInitializer(asStringLiteral(declTypeStartOfExpression,
+ declTypeEndOfExpression));
}
if (_scope->isClass()) {
@@ -3028,6 +3044,7 @@ bool Bind::visit(TypeofSpecifierAST *ast)
bool Bind::visit(DecltypeSpecifierAST *ast)
{
_type = this->expression(ast->expression);
+ _type.setDecltype(true);
return false;
}