[clang] [Clang][NFC] Clean up OpenMP offload toolchain generation (PR #145549)
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 25 08:58:51 PDT 2025
================
@@ -1044,82 +1040,78 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
<< OpenMPTargets->getAsString(C.getInputArgs());
return;
}
+
+ // Make sure these show up in a deterministic order.
+ std::multiset<StringRef> OpenMPTriples;
for (StringRef T : OpenMPTargets->getValues())
OpenMPTriples.insert(T);
+
+ llvm::StringMap<StringRef> FoundNormalizedTriples;
+ for (StringRef T : OpenMPTriples) {
+ llvm::Triple TT(ToolChain::getOpenMPTriple(T));
+ std::string NormalizedName = TT.normalize();
+
+ // Make sure we don't have a duplicate triple.
+ auto [TripleIt, Inserted] =
+ FoundNormalizedTriples.try_emplace(NormalizedName, T);
+ if (!Inserted) {
+ Diag(clang::diag::warn_drv_omp_offload_target_duplicate)
+ << T << TripleIt->second;
+ continue;
+ }
+
+ // If the specified target is invalid, emit a diagnostic.
+ if (TT.getArch() == llvm::Triple::UnknownArch) {
+ Diag(clang::diag::err_drv_invalid_omp_target) << T;
+ continue;
+ }
+
+ auto &TC = getOffloadToolChain(C.getInputArgs(), Action::OFK_OpenMP, TT,
----------------
shiltian wrote:
no auto
https://github.com/llvm/llvm-project/pull/145549
More information about the cfe-commits
mailing list