From f68a0ca7380caf3c4d8e0816dc2a3fcd4e1f4220 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 22 Jan 2024 16:13:34 +0100 Subject: [PATCH] ProjectExplorer: Fix handling of -Xclang when filtering compiler flags Amends fd47b37298827c399bc1e40774aeb0372c1d5735. Change-Id: Idb78ebb88291d26498a5bfd7301fdc721fc6a6f7 Reviewed-by: Qt CI Bot Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/gcctoolchain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 78b5ba4737a..372bce09e24 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -483,6 +483,7 @@ static QStringList filteredFlags(const QStringList &allFlags, bool considerSysro filtered << a << allFlags.at(i); } else if (a == "-Xclang") { filtered << a; + continue; } else if ((considerSysroot && (a == "--sysroot" || a == "-isysroot")) || a == "-D" || a == "-U" || a == "-gcc-toolchain" || a == "-target" || a == "-mllvm" || a == "-isystem") { @@ -499,6 +500,8 @@ static QStringList filteredFlags(const QStringList &allFlags, bool considerSysro || a == "-nostdinc" || a == "-nostdinc++") { filtered << a; } + if (!filtered.isEmpty() && filtered.last() == "-Xclang") + filtered.removeLast(); } return filtered; }