forked from qt-creator/qt-creator
clangbackend: Do not handle built-in types specially
... when collecing tooltips. The more general functions provide more information, such as constness. Fixes: QTCREATORBUG-14950 Change-Id: I6d0a890a695e19e9754b5538ba092a188a3bbbb0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -252,9 +252,6 @@ Utf8String ToolTipInfoCollector::text(const Cursor &cursor, const Cursor &refere
|
||||
if (referenced.isFunctionLike() || referenced.kind() == CXCursor_Constructor)
|
||||
return textForFunctionLike(referenced);
|
||||
|
||||
if (referenced.type().canonical().isBuiltinType())
|
||||
return referenced.type().canonical().builtinTypeToString();
|
||||
|
||||
if (referenced.kind() == CXCursor_VarDecl)
|
||||
return referenced.type().spelling(); // e.g. "Zii<int>"
|
||||
|
||||
|
@@ -115,6 +115,16 @@ TEST_F(ToolTipInfo, LocalVariableInt)
|
||||
ASSERT_THAT(actual, IsToolTip(::ToolTipInfo(Utf8StringLiteral("int"))));
|
||||
}
|
||||
|
||||
TEST_F(ToolTipInfo, LocalVariableConstInt)
|
||||
{
|
||||
ASSERT_THAT(tooltip(211, 19), IsToolTip(::ToolTipInfo(Utf8StringLiteral("const int"))));
|
||||
}
|
||||
|
||||
TEST_F(ToolTipInfo, FileScopeVariableConstInt)
|
||||
{
|
||||
ASSERT_THAT(tooltip(206, 11), IsToolTip(::ToolTipInfo(Utf8StringLiteral("const int"))));
|
||||
}
|
||||
|
||||
TEST_F(ToolTipInfo, LocalVariablePointerToConstInt)
|
||||
{
|
||||
const ::ToolTipInfo actual = tooltip(4, 5);
|
||||
|
@@ -202,3 +202,11 @@ Nuu **pointers(Nuu **p1)
|
||||
|
||||
static constexpr int calcValue() { return 1 + 2; }
|
||||
const auto val = calcValue() + sizeof(char);
|
||||
|
||||
const int zero = 0;
|
||||
|
||||
static void func()
|
||||
{
|
||||
const int i = 5;
|
||||
const int j = i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user