forked from qt-creator/qt-creator
Clang: Fix tooltips for constructors
Constructors were not handled yet, so the tooltip for e.g. the "QString()" constructor was "void ()". Also, since the help system has problems with overloads, show the function signature as clang sees it and provide a help system query that will show the documentation for the class instead of the wrong overload. Change-Id: Idc0cf9dce6a50c323e6fd945f277c7816b0f9b34 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -237,7 +237,7 @@ Utf8String ToolTipInfoCollector::text(const Cursor &cursor, const Cursor &refere
|
||||
if (referenced.isAnyTypeAlias())
|
||||
return textForAnyTypeAlias(referenced);
|
||||
|
||||
if (referenced.isFunctionLike())
|
||||
if (referenced.isFunctionLike() || referenced.kind() == CXCursor_Constructor)
|
||||
return textForFunctionLike(referenced);
|
||||
|
||||
if (referenced.type().canonical().isBuiltinType())
|
||||
@@ -412,6 +412,14 @@ ToolTipInfo ToolTipInfoCollector::qDocInfo(const Cursor &cursor) const
|
||||
if (isBuiltinOrPointerToBuiltin(cursor.type()))
|
||||
return result;
|
||||
|
||||
if (cursor.kind() == CXCursor_Constructor) {
|
||||
const ToolTipInfo parentInfo = qDocInfo(cursor.semanticParent());
|
||||
result.setQdocIdCandidates(parentInfo.qdocIdCandidates());
|
||||
result.setQdocMark(parentInfo.qdocMark());
|
||||
result.setQdocCategory(ToolTipInfo::Unknown);
|
||||
return result;
|
||||
}
|
||||
|
||||
result.setQdocIdCandidates(qDocIdCandidates(cursor));
|
||||
result.setQdocMark(qdocMark(cursor));
|
||||
result.setQdocCategory(qdocCategory(cursor));
|
||||
|
||||
Reference in New Issue
Block a user