Clang: Fix highlighting of instance with member for writable arguments

struct X
{
  int member;
};


void f(int &argument);

void foo()
{
  X x;

  f(x.member);
}

Task-number: QTCREATORBUG-17101
Change-Id: I6746122dbe86d032b3797a01b5f2257846007f94
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Marco Bubke
2016-10-12 12:21:47 +02:00
parent b196368785
commit 03bbd88eb1
2 changed files with 18 additions and 10 deletions

View File

@@ -205,18 +205,15 @@ bool HighlightingMark::isArgumentInCurrentOutputArgumentLocations() const
auto originalSourceLocation = originalCursor.cxSourceLocation();
const auto isNotSameOutputArgument = [&] (const CXSourceRange &currentSourceRange) {
return !(originalSourceLocation.int_data >= currentSourceRange.begin_int_data
&& originalSourceLocation.int_data <= currentSourceRange.end_int_data);
return originalSourceLocation.int_data >= currentSourceRange.begin_int_data
&& originalSourceLocation.int_data <= currentSourceRange.end_int_data;
};
auto partitionPoint = std::partition(currentOutputArgumentRanges->begin(),
currentOutputArgumentRanges->end(),
isNotSameOutputArgument);
auto found = std::find_if(currentOutputArgumentRanges->begin(),
currentOutputArgumentRanges->end(),
isNotSameOutputArgument);
bool isOutputArgument = partitionPoint != currentOutputArgumentRanges->end();
if (isOutputArgument)
currentOutputArgumentRanges->erase(partitionPoint, currentOutputArgumentRanges->end());
bool isOutputArgument = found != currentOutputArgumentRanges->end();
return isOutputArgument;
}