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 <christian.kandeler@qt.io>
This commit is contained in:
Alexey Edelev
2023-06-06 15:47:04 +02:00
parent 49e17591ea
commit d06df3b547

View File

@@ -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;
}