Clang: Show all tokens of a getter as output argument

f(x.get()); -> x.get() should be shown as a output argument

Task-number: QTCREATORBUG-18591
Change-Id: I99f5637660bcd0a889338ebfa6737d79de226f87
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Marco Bubke
2017-07-20 17:59:35 +02:00
parent e97ff9f739
commit 99af4ae8e6
5 changed files with 67 additions and 6 deletions

View File

@@ -247,22 +247,22 @@ void HighlightingMark::collectOutputArguments(const Cursor &cursor)
namespace {
uint getStart(CXSourceRange cxSourceRange)
uint getEnd(CXSourceRange cxSourceRange)
{
CXSourceLocation startSourceLocation = clang_getRangeStart(cxSourceRange);
CXSourceLocation startSourceLocation = clang_getRangeEnd(cxSourceRange);
uint startOffset;
uint endOffset;
clang_getFileLocation(startSourceLocation, nullptr, nullptr, nullptr, &startOffset);
clang_getFileLocation(startSourceLocation, nullptr, nullptr, nullptr, &endOffset);
return startOffset;
return endOffset;
}
}
void HighlightingMark::filterOutPreviousOutputArguments()
{
auto isAfterLocation = [this] (CXSourceRange outputRange) {
return getStart(outputRange) > m_offset;
return getEnd(outputRange) > m_offset;
};
auto precedingBegin = std::partition(m_currentOutputArgumentRanges->begin(),
@@ -279,6 +279,9 @@ void HighlightingMark::functionKind(const Cursor &cursor, Recursion recursion)
else
m_types.mainHighlightingType = HighlightingType::Function;
if (isOutputArgument())
m_types.mixinHighlightingTypes.push_back(HighlightingType::OutputArgument);
addExtraTypeIfFirstPass(HighlightingType::Declaration, recursion);
}
@@ -384,6 +387,9 @@ HighlightingType HighlightingMark::punctuationKind(const Cursor &cursor)
default: break;
}
if (isOutputArgument())
m_types.mixinHighlightingTypes.push_back(HighlightingType::OutputArgument);
return highlightingType;
}