Clang: Provide tooltips

This includes also the query data for the help system (F1) for an
identifier under cursor.

Regressions (libclang changes necessary):
 - Function signatures do not contain default values.
 - Aliases are not resolved for/at:
   - template types
   - qualified name of a type

Fixes/Improvements:
 - Resolve "auto"
 - On a template type, show also the template parameter.
 - For a typedef like
     typedef long long superlong;
   the tooltip was "long long superlong", which was confusing.
   Now, "long long" is shown.

New:
 - Show first or \brief paragraph of a documentation comment.
 - Show size of a class at definition.
 - Show size of a field member in class definition.

Task-number: QTCREATORBUG-11259
Change-Id: Ie1a07930d0e882015d07dc43e35bb81a685cdeb8
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-01-12 12:29:43 +01:00
parent 7872ddde4c
commit 76c25bcd6a
71 changed files with 2824 additions and 112 deletions

View File

@@ -158,6 +158,14 @@ bool Cursor::isTemplateLike() const
Q_UNREACHABLE();
}
bool Cursor::isAnyTypeAlias() const
{
const CXCursorKind k = kind();
return k == CXCursor_TypeAliasDecl
|| k == CXCursor_TypedefDecl
|| k == CXCursor_TypeAliasTemplateDecl;
}
bool Cursor::hasFinalFunctionAttribute() const
{
bool hasFinal = false;
@@ -248,11 +256,31 @@ Type Cursor::nonPointerTupe() const
return typeResult;
}
Type Cursor::enumType() const
{
return clang_getEnumDeclIntegerType(cxCursor);
}
long long Cursor::enumConstantValue() const
{
return clang_getEnumConstantDeclValue(cxCursor);
}
unsigned long long Cursor::enumConstantUnsignedValue() const
{
return clang_getEnumConstantDeclUnsignedValue(cxCursor);
}
Cursor Cursor::specializedCursorTemplate() const
{
return clang_getSpecializedCursorTemplate(cxCursor);
}
CXFile Cursor::includedFile() const
{
return clang_getIncludedFile(cxCursor);
}
SourceLocation Cursor::sourceLocation() const
{
return clang_getCursorLocation(cxCursor);
@@ -341,6 +369,11 @@ Cursor Cursor::functionBase() const
return functionBaseCursor;
}
Type Cursor::resultType() const
{
return clang_getResultType(type().cxType);
}
Cursor Cursor::argument(int index) const
{
return clang_Cursor_getArgument(cxCursor, index);
@@ -398,6 +431,11 @@ CXCursorKind Cursor::kind() const
return clang_getCursorKind(cxCursor);
}
CXCursor Cursor::cx() const
{
return cxCursor;
}
bool operator==(const Cursor &first, const Cursor &second)
{
return clang_equalCursors(first.cxCursor, second.cxCursor);