================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits