From 90982bf2e2b7e68ec2810288424f036e22e4f278 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 11 Oct 2019 14:56:16 +0200 Subject: [PATCH] Clang: Remove duplicated targets arguments We always set the target explicitly (in a certain way), so exclude the target arguments coming from the build system and the (possibly manually specified) platform codegen flags of the toolchain. Change-Id: I74bbec67f5960f05b50cf9c5aa11875c71a5161f Reviewed-by: Cristian Adam Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/compileroptionsbuilder.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index f13f0f1a26e..aafcd35b379 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -751,6 +751,16 @@ void CompilerOptionsBuilder::evaluateCompilerFlags() continue; } + // As we always set the target explicitly, filter out target args. + if (!m_projectPart.toolChainTargetTriple.isEmpty()) { + if (option.startsWith("--target=")) + continue; + if (option == "-target") { + skipNext = true; + continue; + } + } + if (option == includeUserPathOption || option == includeSystemPathOption || option == includeUserPathOptionWindows) { skipNext = true;