forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/7.0'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/docker/dockerdevice.cpp src/plugins/mcusupport/mcupackage.cpp src/plugins/mcusupport/mcupackage.h src/plugins/mcusupport/mcusupportoptions.cpp src/plugins/mcusupport/mcusupportoptions.h src/plugins/mcusupport/mcusupportoptionspage.cpp src/plugins/mcusupport/mcusupportsdk.cpp src/plugins/mcusupport/mcusupportsdk.h Change-Id: I8c8f5953a21729ba9178dbc44ed613eed131a0c8
This commit is contained in:
@@ -1782,8 +1782,7 @@ void ClangdClient::Private::handleFindUsagesResult(quint64 key, const QList<Loca
|
||||
}
|
||||
|
||||
qCDebug(clangdLog) << "document count is" << refData->fileData.size();
|
||||
if (refData->replacementData || q->versionNumber() < QVersionNumber(13)
|
||||
|| !refData->categorize) {
|
||||
if (refData->replacementData || !refData->categorize) {
|
||||
qCDebug(clangdLog) << "skipping AST retrieval";
|
||||
reportAllSearchResultsAndFinish(*refData);
|
||||
return;
|
||||
@@ -1953,11 +1952,6 @@ void ClangdClient::followSymbol(TextDocument *document,
|
||||
};
|
||||
symbolSupport().findLinkAt(document, adjustedCursor, std::move(gotoDefCallback), true);
|
||||
|
||||
if (versionNumber() < QVersionNumber(12)) {
|
||||
d->followSymbolData->cursorNode.emplace(AstNode());
|
||||
return;
|
||||
}
|
||||
|
||||
const auto astHandler = [this, id = d->followSymbolData->id]
|
||||
(const AstNode &ast, const MessageId &) {
|
||||
qCDebug(clangdLog) << "received ast response for cursor";
|
||||
@@ -2747,6 +2741,11 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
const QList<AstNode> path = getAstPath(ast, range);
|
||||
if (path.size() < 2)
|
||||
return false;
|
||||
if (token.type == "property"
|
||||
&& (path.rbegin()->kind() == "MemberInitializer"
|
||||
|| path.rbegin()->kind() == "CXXConstruct")) {
|
||||
return false;
|
||||
}
|
||||
for (auto it = path.rbegin() + 1; it != path.rend(); ++it) {
|
||||
if (it->kind() == "Call" || it->kind() == "CXXConstruct"
|
||||
|| it->kind() == "MemberInitializer") {
|
||||
@@ -2859,7 +2858,6 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
styles.mainStyle = C_FIELD;
|
||||
} else if (token.type == "enum") {
|
||||
styles.mainStyle = C_TYPE;
|
||||
styles.mixinStyles.push_back(C_ENUMERATION);
|
||||
} else if (token.type == "enumMember") {
|
||||
styles.mainStyle = C_ENUMERATION;
|
||||
} else if (token.type == "parameter") {
|
||||
@@ -3640,9 +3638,11 @@ void ExtraHighlightingResultsCollector::collectFromNode(const AstNode &node)
|
||||
if (node.kind().endsWith("Literal")) {
|
||||
HighlightingResult result;
|
||||
result.useTextSyles = true;
|
||||
const bool isStringLike = node.kind().startsWith("String")
|
||||
|| node.kind().startsWith("Character");
|
||||
result.textStyles.mainStyle = isStringLike ? C_STRING : C_NUMBER;
|
||||
const bool isKeyword = node.kind() == "CXXBoolLiteral"
|
||||
|| node.kind() == "CXXNullPtrLiteral";
|
||||
const bool isStringLike = !isKeyword && (node.kind().startsWith("String")
|
||||
|| node.kind().startsWith("Character"));
|
||||
result.textStyles.mainStyle = isKeyword ? C_KEYWORD : isStringLike ? C_STRING : C_NUMBER;
|
||||
setResultPosFromRange(result, node.range());
|
||||
insertResult(result);
|
||||
return;
|
||||
|
||||
@@ -260,7 +260,7 @@ void ClangFollowSymbol::switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||
{
|
||||
ClangdClient * const client
|
||||
= ClangModelManagerSupport::instance()->clientForFile(data.filePath());
|
||||
if (client && client->isFullyIndexed() && client->versionNumber() >= QVersionNumber(13)) {
|
||||
if (client && client->isFullyIndexed()) {
|
||||
client->switchDeclDef(data.textDocument(), data.cursor(), data.editorWidget(),
|
||||
std::move(processLinkCallback));
|
||||
return;
|
||||
|
||||
@@ -179,7 +179,6 @@ ClangdTestFindReferences::ClangdTestFindReferences()
|
||||
{
|
||||
setProjectFileName("find-usages.pro");
|
||||
setSourceFileNames({"defs.h", "main.cpp"});
|
||||
setMinimumVersion(13);
|
||||
}
|
||||
|
||||
void ClangdTestFindReferences::initTestCase()
|
||||
@@ -322,7 +321,6 @@ ClangdTestFollowSymbol::ClangdTestFollowSymbol()
|
||||
{
|
||||
setProjectFileName("follow-symbol.pro");
|
||||
setSourceFileNames({"main.cpp", "header.h"});
|
||||
setMinimumVersion(12);
|
||||
}
|
||||
|
||||
void ClangdTestFollowSymbol::test_data()
|
||||
@@ -409,7 +407,6 @@ ClangdTestLocalReferences::ClangdTestLocalReferences()
|
||||
{
|
||||
setProjectFileName("local-references.pro");
|
||||
setSourceFileNames({"references.cpp"});
|
||||
setMinimumVersion(13);
|
||||
}
|
||||
|
||||
// We currently only support local variables, but if and when clangd implements
|
||||
@@ -525,7 +522,6 @@ ClangdTestTooltips::ClangdTestTooltips()
|
||||
{
|
||||
setProjectFileName("tooltips.pro");
|
||||
setSourceFileNames({"tooltips.cpp"});
|
||||
setMinimumVersion(13);
|
||||
}
|
||||
|
||||
void ClangdTestTooltips::test_data()
|
||||
@@ -668,7 +664,6 @@ ClangdTestHighlighting::ClangdTestHighlighting()
|
||||
{
|
||||
setProjectFileName("highlighting.pro");
|
||||
setSourceFileNames({"highlighting.cpp"});
|
||||
setMinimumVersion(13);
|
||||
}
|
||||
|
||||
void ClangdTestHighlighting::initTestCase()
|
||||
@@ -744,11 +739,11 @@ void ClangdTestHighlighting::test_data()
|
||||
QTest::newRow("static member function call") << 114 << 15 << 114 << 27
|
||||
<< QList<int>{C_FUNCTION} << 0;
|
||||
QTest::newRow("enum declaration") << 118 << 6 << 118 << 17
|
||||
<< QList<int>{C_TYPE, C_ENUMERATION, C_DECLARATION} << 0;
|
||||
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
|
||||
QTest::newRow("enumerator declaration") << 120 << 5 << 120 << 15
|
||||
<< QList<int>{C_ENUMERATION, C_DECLARATION} << 0;
|
||||
QTest::newRow("enum in variable declaration") << 125 << 5 << 125 << 16
|
||||
<< QList<int>{C_TYPE, C_ENUMERATION} << 0;
|
||||
<< QList<int>{C_TYPE} << 0;
|
||||
QTest::newRow("enum variable declaration") << 125 << 17 << 125 << 28
|
||||
<< QList<int>{C_LOCAL, C_DECLARATION} << 0;
|
||||
QTest::newRow("enum variable reference") << 127 << 5 << 127 << 16 << QList<int>{C_LOCAL} << 0;
|
||||
@@ -966,7 +961,7 @@ void ClangdTestHighlighting::test_data()
|
||||
<< 310 << 29 << 310 << 38
|
||||
<< QList<int>{C_FIELD} << 0;
|
||||
QTest::newRow("enum declaration with underlying type") << 316 << 6 << 316 << 21
|
||||
<< QList<int>{C_TYPE, C_ENUMERATION, C_DECLARATION} << 0;
|
||||
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
|
||||
QTest::newRow("type in static_cast") << 328 << 23 << 328 << 33
|
||||
<< QList<int>{C_TYPE} << 0;
|
||||
QTest::newRow("opening angle bracket in static_cast") << 328 << 16 << 328 << 17
|
||||
@@ -1293,6 +1288,13 @@ void ClangdTestHighlighting::test_data()
|
||||
<< QList<int>{C_LOCAL} << 0;
|
||||
QTest::newRow("const operator()") << 903 << 5 << 903 << 7
|
||||
<< QList<int>{C_LOCAL} << 0;
|
||||
QTest::newRow("member initialization: member (user-defined type)") << 911 << 14 << 911 << 18
|
||||
<< QList<int>{C_FIELD} << 0;
|
||||
QTest::newRow("member initialization: member (built-in type)") << 911 << 23 << 911 << 27
|
||||
<< QList<int>{C_FIELD} << 0;
|
||||
QTest::newRow("keywords: true") << 920 << 15 << 920 << 19 << QList<int>{C_KEYWORD} << 0;
|
||||
QTest::newRow("keywords: false") << 921 << 15 << 921 << 20 << QList<int>{C_KEYWORD} << 0;
|
||||
QTest::newRow("keywords: nullptr") << 922 << 15 << 922 << 22 << QList<int>{C_KEYWORD} << 0;
|
||||
}
|
||||
|
||||
void ClangdTestHighlighting::test()
|
||||
@@ -2015,9 +2017,10 @@ void ClangdTestExternalChanges::test()
|
||||
header.close();
|
||||
ClangdClient * const oldClient = client();
|
||||
QVERIFY(oldClient);
|
||||
QVERIFY(!waitForSignalOrTimeout(ClangModelManagerSupport::instance(),
|
||||
&ClangModelManagerSupport::createdClient, timeOutInMs()));
|
||||
waitForSignalOrTimeout(ClangModelManagerSupport::instance(),
|
||||
&ClangModelManagerSupport::createdClient, timeOutInMs());
|
||||
QCOMPARE(client(), oldClient);
|
||||
QCOMPARE(client(), ClangModelManagerSupport::instance()->clientForProject(project()));
|
||||
const TextDocument * const curDoc = document("main.cpp");
|
||||
QVERIFY(curDoc);
|
||||
QVERIFY(curDoc->marks().isEmpty());
|
||||
|
||||
@@ -902,3 +902,22 @@ void callOperators()
|
||||
Callable2 c2;
|
||||
c2();
|
||||
}
|
||||
|
||||
namespace std { template<typename T> struct atomic { atomic(int) {} }; }
|
||||
|
||||
void constructorMemberInitialization()
|
||||
{
|
||||
struct S {
|
||||
S(): m_m1(1), m_m2(0) {}
|
||||
|
||||
std::atomic<int> m_m1;
|
||||
int m_m2;
|
||||
};
|
||||
}
|
||||
|
||||
void keywords()
|
||||
{
|
||||
bool b1 = true;
|
||||
bool b2 = false;
|
||||
void *p = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user