forked from qt-creator/qt-creator
Clang: Remove pointer arguments from output argument
Non constant pointers are used many times as non output arguments, so you get misleading information. Task-number: QTCREATORBUG-18591 Change-Id: Ic5f987db44ad63a0b1a38fd59cd807db5f2acc8f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -76,7 +76,7 @@ bool Type::isReferencingConstant() const
|
||||
|
||||
bool Type::isOutputArgument() const
|
||||
{
|
||||
return (isPointer() || isLValueReference()) && !pointeeType().isConstant();
|
||||
return isLValueReference() && !pointeeType().isConstant();
|
||||
}
|
||||
|
||||
bool Type::isBuiltinType() const
|
||||
|
@@ -482,12 +482,12 @@ void f25()
|
||||
NonConstPointerArgument(x);
|
||||
}
|
||||
|
||||
void ConstPointerArgument(const int *argument);
|
||||
|
||||
void PointerToConstArgument(const int *argument);
|
||||
void ConstPointerArgument(int *const argument);
|
||||
void f26()
|
||||
{
|
||||
int *x;
|
||||
|
||||
PointerToConstArgument(x);
|
||||
ConstPointerArgument(x);
|
||||
}
|
||||
|
||||
|
@@ -998,7 +998,17 @@ TEST_F(HighlightingMarks, NonConstPointerArgument)
|
||||
infos[1];
|
||||
|
||||
ASSERT_THAT(infos[2],
|
||||
HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
|
||||
HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, PointerToConstArgument)
|
||||
{
|
||||
const auto infos = translationUnit.highlightingMarksInRange(sourceRange(490, 31));
|
||||
|
||||
infos[1];
|
||||
|
||||
ASSERT_THAT(infos[2],
|
||||
HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, ConstPointerArgument)
|
||||
@@ -1048,7 +1058,7 @@ TEST_F(HighlightingMarks, NonConstPointerArgumentAsExpression)
|
||||
infos[1];
|
||||
|
||||
ASSERT_THAT(infos[3],
|
||||
HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument));
|
||||
HasOnlyType(HighlightingType::LocalVariable));
|
||||
}
|
||||
|
||||
TEST_F(HighlightingMarks, NonConstPointerArgumentAsInstanceWithMember)
|
||||
|
Reference in New Issue
Block a user