Commit c267a34b authored by Marco Bubke's avatar Marco Bubke

Clang: Use the CodeCompletion getter directly

Casting from a Qvariant is expensive and it happens here very often.

Change-Id: If524412f314bb8ac9e9e5e4335c7e32ff7a9ce40
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 8938addc
......@@ -54,8 +54,6 @@ bool ClangAssistProposalItem::prematurelyApplies(const QChar &typedChar) const
applies = QString::fromLatin1("(,").contains(typedChar);
else if (m_completionOperator == T_STRING_LITERAL || m_completionOperator == T_ANGLE_STRING_LITERAL)
applies = (typedChar == QLatin1Char('/')) && text().endsWith(QLatin1Char('/'));
else if (!isCodeCompletion())
applies = (typedChar == QLatin1Char('(')); /* && data().canConvert<CompleteFunctionDeclaration>()*/ //###
else if (codeCompletion().completionKind() == CodeCompletion::ObjCMessageCompletionKind)
applies = QString::fromLatin1(";.,").contains(typedChar);
else
......@@ -247,18 +245,14 @@ void ClangAssistProposalItem::addOverload(const CodeCompletion &ccr)
m_overloads.append(ccr);
}
CodeCompletion ClangAssistProposalItem::codeCompletion() const
void ClangAssistProposalItem::setCodeCompletion(const CodeCompletion &codeCompletion)
{
const QVariant &value = data();
if (value.canConvert<CodeCompletion>())
return value.value<CodeCompletion>();
else
return CodeCompletion();
m_codeCompletion = codeCompletion;
}
bool ClangAssistProposalItem::isCodeCompletion() const
const ClangBackEnd::CodeCompletion &ClangAssistProposalItem::codeCompletion() const
{
return data().canConvert<CodeCompletion>();
return m_codeCompletion;
}
} // namespace Internal
......
......@@ -52,13 +52,14 @@ public:
bool isOverloaded() const;
void addOverload(const ClangBackEnd::CodeCompletion &ccr);
ClangBackEnd::CodeCompletion codeCompletion() const;
void setCodeCompletion(const ClangBackEnd::CodeCompletion &codeCompletion);
const ClangBackEnd::CodeCompletion &codeCompletion() const;
bool isCodeCompletion() const;
private:
ClangBackEnd::CodeCompletion m_codeCompletion;
QList<ClangBackEnd::CodeCompletion> m_overloads;
unsigned m_completionOperator;
mutable QChar m_typedChar;
QList<ClangBackEnd::CodeCompletion> m_overloads;
};
} // namespace Internal
......
......@@ -103,7 +103,7 @@ QList<AssistProposalItem *> toAssistProposalItems(const CodeCompletions &complet
if (ccr.completionKind() == CodeCompletion::KeywordCompletionKind)
item->setDetail(CompletionChunksToTextConverter::convertToToolTip(ccr.chunks()));
item->setData(QVariant::fromValue(ccr));
item->setCodeCompletion(ccr);
}
// FIXME: show the effective accessebility instead of availability
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment