[clang] [Clang] diagnosing missing Vulkan environment when using SPIR-V triple (PR #190840)
Tony Guillot via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 11 11:53:31 PDT 2026
================
@@ -112,6 +112,18 @@ void CompilerInstance::setTarget(TargetInfo *Value) { Target = Value; }
void CompilerInstance::setAuxTarget(TargetInfo *Value) { AuxTarget = Value; }
bool CompilerInstance::createTarget() {
+
+ // SPIR-V targeting requires a fully specified Vulkan environment.
+ // Validate here before CreateTargetInfo() to emit a proper diagnostic
+ llvm::Triple Triple(getInvocation().getTargetOpts().Triple);
+ if (Triple.getArch() == llvm::Triple::spirv) {
+ if (Triple.getOS() != llvm::Triple::Vulkan ||
+ Triple.getVulkanVersion() == llvm::VersionTuple(0)) {
+ getDiagnostics().Report(diag::err_spirv_requires_vulkan) << Triple.str();
----------------
to268 wrote:
Why the triple is passed to the diagnostic if you do not display it in the message?
See [formatting-a-diagnostic-argument](https://clang.llvm.org/docs/InternalsManual.html#formatting-a-diagnostic-argument)
https://github.com/llvm/llvm-project/pull/190840
More information about the cfe-commits
mailing list