Commit 9b5d6546 authored by Marco Bubke's avatar Marco Bubke

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's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent 15793d33
......@@ -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)
......
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