Merge remote-tracking branch 'origin/12.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	src/plugins/cppeditor/cppeditorwidget.cpp

Change-Id: I618826eaea8acfa65148bd191a0263454bf50e43
This commit is contained in:
Eike Ziller
2023-11-27 11:47:53 +01:00
8 changed files with 40 additions and 9 deletions

View File

@@ -4946,8 +4946,8 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
CompoundExpressionAST *ast = new (_pool) CompoundExpressionAST;
ast->lparen_token = consumeToken();
StatementAST *statement = nullptr;
parseCompoundStatement(statement);
ast->statement = statement->asCompoundStatement();
if (parseCompoundStatement(statement))
ast->statement = statement->asCompoundStatement();
match(T_RPAREN, &ast->rparen_token);
node = ast;
return true;

View File

@@ -41,6 +41,7 @@ add_qtc_library(Sqlite
constraints.h
createtablesqlstatementbuilder.h
lastchangedrowid.h
sqlite3_fwd.h
sqlitealgorithms.h
sqlitebasestatement.cpp sqlitebasestatement.h
sqlitecolumn.h

View File

@@ -623,9 +623,14 @@ void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor curso
QPointer<CppEditorWidget> cppEditorWidget = this;
CppModelManager::globalRename(cursorInEditor, replacement);
};
CppModelManager::followSymbol(
CursorInEditor{cursor, textDocument()->filePath(), this, textDocument()},
continuation, true, false, FollowSymbolMode::Exact);
CppModelManager::followSymbol(CursorInEditor{cursor,
textDocument()->filePath(),
this,
textDocument()},
continuation,
false,
false,
FollowSymbolMode::Exact);
}
void CppEditorWidget::renameUsages(const Utils::FilePath &filePath, const QString &replacement,

View File

@@ -9224,6 +9224,23 @@ int var2;)";
// A third affected comment
/* An unaffected comment */)";
// FIXME: Remove adjacent newline along with last block
// FIXME: Use CppRefactoringFile to auto-indent continuation lines?
QTest::newRow("C -> C++, indented") << R"(
struct S {
/*
* @This is an
* indented comment.
*/
void func();
)" << R"(
struct S {
// This is an
// indented comment.
void func();
)";
QTest::newRow("C++ -> C / no selection / single line") << R"(
// Other comment, unaffected
// Our @comment

View File

@@ -9514,6 +9514,7 @@ private:
changeSet.remove(block.position() + firstColumn, block.position() + endColumn);
};
const int contentIndex = indexOfActualContent();
int removed = 0;
if (contentIndex == -1) {
if (blockIsRemovable) {
removeBlock();
@@ -9531,6 +9532,7 @@ private:
} else {
changeSet.remove(block.position() + firstColumn,
block.position() + firstColumn + contentIndex);
removed = contentIndex;
}
if (block == firstBlock) {
@@ -9540,7 +9542,7 @@ private:
// If the line starts with enough whitespace, replace it with the
// comment start characters, so we don't move the content to the right
// unnecessarily. Otherwise, insert the comment start characters.
if (blockText.startsWith(QString(newCommentStart.size() + 1, ' '))) {
if (blockText.startsWith(QString(newCommentStart.size() + removed + 1, ' '))) {
changeSet.replace(block.position(),
block.position() + newCommentStart.length(),
newCommentStart);

View File

@@ -546,7 +546,7 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
// Start position will be the end position minus the size of the actual contents of the
// literal.
int newPosStart = newPosEnd - firstToken.string->size();
int newPosStart = newPosEnd - QString::fromUtf8(firstToken.string->chars()).size();
// Skip raw literal parentheses.
if (isRawLiteral)

View File

@@ -266,7 +266,13 @@ void LldbEngine::handleLldbStarted()
cmd2.arg("startmode", rp.startMode);
cmd2.arg("nativemixed", isNativeMixedActive());
cmd2.arg("workingdirectory", rp.inferior.workingDirectory.path());
cmd2.arg("environment", rp.inferior.environment.toStringList());
QStringList environment = rp.inferior.environment.toStringList();
// Prevent lldb from automatically setting OS_ACTIVITY_DT_MODE to mirror
// NSLog to stderr, as that will also mirror os_log, which we pick up in
// AppleUnifiedLogger::preventsStderrLogging(), and end up disabling Qt's
// default stderr logger. We prefer Qt's own stderr logging if we can.
environment << "IDE_DISABLED_OS_ACTIVITY_DT_MODE=1";
cmd2.arg("environment", environment);
cmd2.arg("processargs", toHex(ProcessArgs::splitArgs(rp.inferior.command.arguments(),
HostOsInfo::hostOs()).join(QChar(0))));
cmd2.arg("platform", rp.platform);