Merge remote-tracking branch 'origin/6.0'

Conflicts:
	src/libs/utils/theme/theme_mac.mm
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/debugger/lldb/lldbengine.cpp

Change-Id: I5f2c62e0bce6c91a53a554b3278dbe23ff7dde36
This commit is contained in:
Eike Ziller
2021-11-11 11:54:41 +01:00
129 changed files with 4084 additions and 328 deletions

View File

@@ -61,3 +61,14 @@ extend_qtc_plugin(ClangCodeModel
test/clangdtests.cpp test/clangdtests.h
test/data/clangtestdata.qrc
)
if(MINGW)
set(big_obj_compile_option "-Wa,-mbig-obj")
elseif(MSVC)
set(big_obj_compile_option "/bigobj")
endif()
extend_qtc_plugin(ClangCodeModel
CONDITION DEFINED big_obj_compile_option
PROPERTIES COMPILE_OPTIONS ${big_obj_compile_option}
)

View File

@@ -252,6 +252,16 @@ public:
QString theType = type();
if (theType.endsWith("const"))
theType.chop(5);
// We don't care about the "inner" type of templates.
const int openAngleBracketPos = theType.indexOf('<');
if (openAngleBracketPos != -1) {
const int closingAngleBracketPos = theType.lastIndexOf('>');
if (closingAngleBracketPos > openAngleBracketPos) {
theType = theType.left(openAngleBracketPos)
+ theType.mid(closingAngleBracketPos + 1);
}
}
const int xrefCount = theType.count("&&");
const int refCount = theType.count('&') - 2 * xrefCount;
const int ptrRefCount = theType.count('*') + refCount;
@@ -2443,6 +2453,8 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
return true;
}
if (it->kind() == "Lambda")
return false;
if (it->kind().endsWith("Cast") && it->hasConstType())
return false;
if (it->kind() == "Member" && it->arcanaContains("(")
@@ -3140,6 +3152,18 @@ void ExtraHighlightingResultsCollector::insertResult(const HighlightingResult &r
return;
const auto it = std::lower_bound(m_results.begin(), m_results.end(), result, lessThan);
if (it == m_results.end() || *it != result) {
// Prevent inserting expansions for function-like macros. For instance:
// #define TEST() "blubb"
// const char *s = TEST();
// The macro name is always shorter than the expansion and starts at the same
// location, so it should occur right before the insertion position.
if (it > m_results.begin() && (it - 1)->line == result.line
&& (it - 1)->column == result.column
&& (it - 1)->textStyles.mainStyle == C_PREPROCESSOR) {
return;
}
qCDebug(clangdLogHighlight) << "adding additional highlighting result"
<< result.line << result.column << result.length;
m_results.insert(it, result);

View File

@@ -112,6 +112,7 @@ ClangModelManagerSupport::ClangModelManagerSupport()
m_instance = this;
watchForExternalChanges();
watchForInternalChanges();
cppModelManager()->setCurrentDocumentFilter(std::make_unique<ClangdCurrentDocumentFilter>());
cppModelManager()->setLocatorFilter(std::make_unique<ClangGlobalSymbolFilter>());
cppModelManager()->setClassesFilter(std::make_unique<ClangClassesFilter>());
@@ -488,6 +489,29 @@ void ClangModelManagerSupport::watchForExternalChanges()
});
}
void ClangModelManagerSupport::watchForInternalChanges()
{
connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally,
this, [this](const Utils::FilePaths &filePaths) {
for (const Utils::FilePath &fp : filePaths) {
ClangdClient * const client = clientForFile(fp);
if (!client || client->documentForFilePath(fp))
continue;
client->openExtraFile(fp);
// We need to give clangd some time to start re-parsing the file.
// Closing right away does not work, and neither does doing it queued.
// If it turns out that this delay is not always enough, we'll need to come up
// with something more clever.
// Ideally, clangd would implement workspace/didChangeWatchedFiles; let's keep
// any eye on that.
QTimer::singleShot(5000, client, [client, fp] {
if (!client->documentForFilePath(fp))
client->closeExtraFile(fp); });
}
});
}
void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
{
QTC_ASSERT(editor, return);

View File

@@ -135,8 +135,8 @@ private:
ClangdClient *createClient(ProjectExplorer::Project *project, const Utils::FilePath &jsonDbDir);
void claimNonProjectSources(ClangdClient *fallbackClient);
void watchForExternalChanges();
void watchForInternalChanges();
private:
UiHeaderOnDiskManager m_uiHeaderOnDiskManager;
BackendCommunicator m_communicator;
ClangCompletionAssistProvider m_completionAssistProvider;

View File

@@ -1249,6 +1249,9 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("const argument to unnamed lambda") << 830 << 16 << 830 << 19
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("simple assignment") << 835 << 5 << 835 << 6 << QList<int>{C_LOCAL} << 0;
QTest::newRow("simple return") << 841 << 12 << 841 << 15 << QList<int>{C_LOCAL} << 0;
QTest::newRow("lambda parameter") << 847 << 49 << 847 << 52
<< QList<int>{C_PARAMETER, C_DECLARATION} << 0;
}
void ClangdTestHighlighting::test()

View File

@@ -834,3 +834,15 @@ void assignmentTest() {
struct S {} s;
s = {};
}
using FooPtrVector = std::vector<Foo *>;
FooPtrVector returnTest() {
FooPtrVector foo;
return foo;
}
template <typename Container, typename Func> inline void useContainer(const Container &, Func) {}
void testConstRefAutoLambdaArgs()
{
useContainer(FooPtrVector(), [](const auto &arg) {});
}