diff --git a/src/libs/cplusplus/OverviewModel.cpp b/src/libs/cplusplus/OverviewModel.cpp index 0855bcbd8f661f5d8e5bd423241bda7edb3332b8..1bef20f36d3d6edee64719e92e6dcf783ce46ccd 100644 --- a/src/libs/cplusplus/OverviewModel.cpp +++ b/src/libs/cplusplus/OverviewModel.cpp @@ -171,7 +171,7 @@ QVariant OverviewModel::data(const QModelIndex &index, int role) const if (! symbol->isScopedSymbol() || symbol->isFunction()) { QString type = _overview.prettyType(symbol->type()); if (! type.isEmpty()) { - if (symbol->type() && ! symbol->type()->isFunctionType()) + if (! symbol->type()->isFunctionType()) name += QLatin1String(": "); name += type; } diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index d66e590593b491dbefd43881d4cda2e0b2684769..b0eb63ffe351815daf1204615af0eaaf28dd7bea 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -593,8 +593,6 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol) { if (symbol->isFunction()) return 0; // symbol is a function definition. - else if (! symbol->type()) - return 0; Function *funTy = symbol->type()->asFunctionType(); if (! funTy) diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index 2547b8564d9fb7bd30e9cae4c41dc5cbce5e4804..3959d953f92df47497a306686fdfeb28c59e23fd 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -256,7 +256,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in const QList<TypeOfExpression::Result> types = typeOfExpression(expression, doc, lastSymbol); - if (!types.isEmpty() && types.first().first) { + if (!types.isEmpty()) { FullySpecifiedType firstType = types.first().first; Symbol *symbol = types.first().second; FullySpecifiedType docType = firstType; diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index dcf41e3e744b70b4eb5466dfea1d3b9a870faa4a..f9ea3b0bbe96266a996471eb30c54fc086887634 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -578,8 +578,6 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy, QSet<QString> signatures; foreach (TypeOfExpression::Result p, resolvedTypes) { FullySpecifiedType ty = p.first; - if (! ty) - continue; if (Function *fun = ty->asFunctionType()) { if (TextEditor::CompletionItem item = toCompletionItem(fun)) { QString signature; @@ -602,7 +600,7 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy, bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &results, const LookupContext &context) { - if (results.isEmpty() || ! results.first().first) + if (results.isEmpty()) return false; TypeOfExpression::Result result = results.first(); @@ -898,10 +896,7 @@ bool CppCodeCompletion::completeConstructors(Class *klass) for (unsigned i = 0; i < klass->memberCount(); ++i) { Symbol *member = klass->memberAt(i); - FullySpecifiedType memberTy = member->type(); - if (! memberTy) - continue; - else if (! memberTy->isFunctionType()) + if (! member->type()->isFunctionType()) continue; else if (! member->identity()) continue; @@ -935,12 +930,8 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType, QSet<QString> signatures; foreach (TypeOfExpression::Result p, results) { FullySpecifiedType ty = p.first; - if (! ty) - continue; - if (ReferenceType *refTy = ty->asReferenceType()) ty = refTy->elementType(); - if (PointerType *ptrTy = ty->asPointerType()) ty = ptrTy->elementType(); else @@ -968,8 +959,6 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType, for (unsigned i = 0; i < scope->symbolCount(); ++i) { Symbol *member = scope->symbolAt(i); - if (! member->type()) - continue; Function *fun = member->type()->asFunctionType(); if (! fun) continue; @@ -1127,15 +1116,13 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) extraChars += QLatin1Char('('); // If the function takes no arguments, automatically place the closing parenthesis - if (function->argumentCount() == 0 || (function->argumentCount() == 1 && - function->argumentAt(0)->type() && + if (function->argumentCount() == 0 || (function->argumentCount() == 1 && function->argumentAt(0)->type()->isVoidType())) { extraChars += QLatin1Char(')'); // If the function doesn't return anything, automatically place the semicolon, // unless we're doing a scope completion (then it might be function definition). - FullySpecifiedType retTy = function->returnType(); - if (retTy && retTy->isVoidType() && m_completionOperator != T_COLON_COLON) { + if (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON) { extraChars += QLatin1Char(';'); } } diff --git a/src/shared/cplusplus/CheckExpression.cpp b/src/shared/cplusplus/CheckExpression.cpp index aaf24c48e15ae176f93dc8eaf0e01a693c3ff880..a2b6c68677a7fd4045bfa31602770b347b7fcfb9 100644 --- a/src/shared/cplusplus/CheckExpression.cpp +++ b/src/shared/cplusplus/CheckExpression.cpp @@ -320,8 +320,8 @@ bool CheckExpression::visit(QtMethodAST *ast) Scope dummy; FullySpecifiedType methTy = semantic()->check(ast->declarator, FullySpecifiedType(), &dummy, &name); - Function *fty = 0; - if (! methTy || 0 == (fty = methTy->asFunctionType())) + Function *fty = methTy->asFunctionType(); + if (! fty) translationUnit()->warning(ast->firstToken(), "expected a function declarator"); else { for (unsigned i = 0; i < fty->argumentCount(); ++i) {