forked from qt-creator/qt-creator
ClangCodeModel: Consider concepts in semantic highlighting
We highlight concepts as types for now, as it's a pretty good fit. We can always introduce a dedicated concept highlighting type later if there is demand. Task-number: QTCREATORBUG-28887 Change-Id: I405db5ca4351efd565b968e765fe8bca976a2800 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -328,7 +328,7 @@ void doSemanticHighlighting(
|
|||||||
styles.mainStyle = C_PARAMETER;
|
styles.mainStyle = C_PARAMETER;
|
||||||
} else if (token.type == "macro") {
|
} else if (token.type == "macro") {
|
||||||
styles.mainStyle = C_MACRO;
|
styles.mainStyle = C_MACRO;
|
||||||
} else if (token.type == "type") {
|
} else if (token.type == "type" || token.type == "concept") {
|
||||||
styles.mainStyle = C_TYPE;
|
styles.mainStyle = C_TYPE;
|
||||||
} else if (token.type == "modifier") {
|
} else if (token.type == "modifier") {
|
||||||
styles.mainStyle = C_KEYWORD;
|
styles.mainStyle = C_KEYWORD;
|
||||||
|
|||||||
@@ -1280,6 +1280,9 @@ void ClangdTestHighlighting::test_data()
|
|||||||
<< QList<int>{C_FIELD} << 0;
|
<< QList<int>{C_FIELD} << 0;
|
||||||
QTest::newRow("fake operator method call") << 1050 << 8 << 1050 << 22
|
QTest::newRow("fake operator method call") << 1050 << 8 << 1050 << 22
|
||||||
<< QList<int>{C_FUNCTION} << 0;
|
<< QList<int>{C_FUNCTION} << 0;
|
||||||
|
QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42
|
||||||
|
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
|
||||||
|
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdTestHighlighting::test()
|
void ClangdTestHighlighting::test()
|
||||||
|
|||||||
@@ -1049,3 +1049,6 @@ void useStrangeStruct(StructWithMisleadingMemberNames *s) {
|
|||||||
s->operatormember = 5;
|
s->operatormember = 5;
|
||||||
s->operatorMethod();
|
s->operatorMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T> concept NoConstraint = true;
|
||||||
|
static void constrainedFunc(NoConstraint auto t) {}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
|
CONFIG += c++2a
|
||||||
SOURCES = highlighting.cpp
|
SOURCES = highlighting.cpp
|
||||||
QMAKE_CXXFLAGS += -broken
|
QMAKE_CXXFLAGS += -broken
|
||||||
|
|||||||
Reference in New Issue
Block a user