From 9dfa2100111d52ebdc5ea541ce201274dff70db8 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 23 Nov 2016 16:10:20 +0100 Subject: [PATCH] Clang: Partial fix for highlighting off output arguments We get the source range for the parameter list and not the arguments in the initializer list back. So we have to disable the test case. Task-number: QTCREATORBUG-17101 Change-Id: I65ec6d111766b5728a951b024576cbf777c89728 Reviewed-by: Nikolai Kosjar --- src/tools/clangbackend/ipcsource/highlightingmark.cpp | 1 + tests/unit/unittest/data/highlightingmarks.cpp | 9 +++++++++ tests/unit/unittest/highlightingmarks-test.cpp | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/tools/clangbackend/ipcsource/highlightingmark.cpp b/src/tools/clangbackend/ipcsource/highlightingmark.cpp index e903a1d2d38..003241386d6 100644 --- a/src/tools/clangbackend/ipcsource/highlightingmark.cpp +++ b/src/tools/clangbackend/ipcsource/highlightingmark.cpp @@ -363,6 +363,7 @@ HighlightingType HighlightingMark::punctuationKind(const Cursor &cursor) { switch (cursor.kind()) { case CXCursor_DeclRefExpr: return operatorKind(cursor); + case CXCursor_Constructor: case CXCursor_CallExpr: collectOutputArguments(cursor); default: return HighlightingType::Invalid; } diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp index 3d3d5c51890..0496b60fa9d 100644 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ b/tests/unit/unittest/data/highlightingmarks.cpp @@ -539,3 +539,12 @@ void f31() NonConstReferenceArgumentConstructor copy(instance); } + +struct NonConstReferenceMemberInitialization +{ + NonConstReferenceMemberInitialization(int &foo) + : foo(foo) + {} + + int &foo; +}; diff --git a/tests/unit/unittest/highlightingmarks-test.cpp b/tests/unit/unittest/highlightingmarks-test.cpp index 51a380381e8..e93b8059974 100644 --- a/tests/unit/unittest/highlightingmarks-test.cpp +++ b/tests/unit/unittest/highlightingmarks-test.cpp @@ -1080,6 +1080,16 @@ TEST_F(HighlightingMarks, DISABLED_NonConstReferenceArgumentConstructor) HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument)); } +TEST_F(HighlightingMarks, DISABLED_NonConstReferenceMemberInitialization) +{ + const auto infos = translationUnit.highlightingMarksInRange(sourceRange(546, 19)); + + infos[2]; + + ASSERT_THAT(infos[3], + HasTwoTypes(HighlightingType::LocalVariable, HighlightingType::OutputArgument)); +} + TEST_F(HighlightingMarks, DISABLED_EnumerationTypeDef) { const auto infos = translationUnit.highlightingMarksInRange(sourceRange(424, 41));