From d06df3b5475782ffc4ee0a7f90164c9084384180 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 6 Jun 2023 15:47:04 +0200 Subject: [PATCH] Remove '-flto' from clangd compiler command line by default Linker-time-optimization flag should not have any effect on clangd, so we may remove it from the compiler command line by default when feeding clangd with the source files. gcc supports the optimization level that should be applied for the relative binaries. The level can be specified as the number N following by the -flto=[N] argument. clangd meanwhile doesn't know about this option and throws the 'Unsupported argument '1' to option '-flto=' error. Task-number: QTMCU-163 Change-Id: I540438d8f4d006261e4cfda2bbba91984352db9d Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/compileroptionsbuilder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/compileroptionsbuilder.cpp b/src/plugins/cppeditor/compileroptionsbuilder.cpp index 5f092121214..8b7dd11b2d7 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.cpp +++ b/src/plugins/cppeditor/compileroptionsbuilder.cpp @@ -875,7 +875,8 @@ void CompilerOptionsBuilder::evaluateCompilerFlags() || option.startsWith("/M", Qt::CaseSensitive) || option.startsWith(includeUserPathOption) || option.startsWith(includeSystemPathOption) - || option.startsWith(includeUserPathOptionWindows)) { + || option.startsWith(includeUserPathOptionWindows) + || option.startsWith("-flto")) { // Optimization and run-time flags. continue; }