[clang] 7e58b06 - clang: Fix warnings with multiple offload arch args (#189329)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 30 05:32:39 PDT 2026
Author: Matt Arsenault
Date: 2026-03-30T14:32:30+02:00
New Revision: 7e58b06fa4ac68f161b13afdcc0133f86eaea15b
URL: https://github.com/llvm/llvm-project/commit/7e58b06fa4ac68f161b13afdcc0133f86eaea15b
DIFF: https://github.com/llvm/llvm-project/commit/7e58b06fa4ac68f161b13afdcc0133f86eaea15b.diff
LOG: clang: Fix warnings with multiple offload arch args (#189329)
Fix regression after ab885fdf5f67726ef564c34087e813f2ca861f5c.
Apparently driver tests do not enforce there are no warnings.
Oddly, I need to use -Werror for the specific error. If I use
just -Werror, I get an error that the -Werror is unused.
Added:
Modified:
clang/lib/Driver/Driver.cpp
clang/test/Driver/hip-binding.hip
Removed:
################################################################################
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 76bf9ab84e97f..32c95222d248d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1015,7 +1015,10 @@ static TripleSet inferOffloadToolchains(Compilation &C,
A->claim();
C.getArgs().append(A);
C.getArgs().AddSynthesizedArg(A);
- Triples.insert(Triple);
+
+ auto It = Triples.lower_bound(Triple);
+ if (It == Triples.end() || *It != Triple)
+ Triples.insert(It, Triple);
}
// Infer the default target triple if no specific architectures are given.
diff --git a/clang/test/Driver/hip-binding.hip b/clang/test/Driver/hip-binding.hip
index 1c02cfaadfad2..cf44692259257 100644
--- a/clang/test/Driver/hip-binding.hip
+++ b/clang/test/Driver/hip-binding.hip
@@ -1,4 +1,4 @@
-// RUN: %clang -ccc-print-bindings --target=x86_64-linux-gnu \
+// RUN: %clang -Werror=openmp-target -ccc-print-bindings --target=x86_64-linux-gnu \
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
// RUN: --no-offload-new-driver -c 2>&1 | FileCheck -check-prefix=NRDCS %s
// RUN: %clang -ccc-print-bindings --target=x86_64-linux-gnu --offload-new-driver \
More information about the cfe-commits
mailing list