[HLSL] Restrict to supported targets
authorChris Bieneman <chris.bieneman@me.com>
Fri, 2 Sep 2022 15:45:53 +0000 (10:45 -0500)
committerChris Bieneman <chris.bieneman@me.com>
Fri, 2 Sep 2022 18:36:23 +0000 (13:36 -0500)
commit10194a51a9d304ab9f68432f244749c672f9012a
tree1e7f070fdbaecaff136310c830c333ddc93f0f57
parent662ee93cbbaad27e8dfecfdd4731dc4b168658b4
[HLSL] Restrict to supported targets

Someday we would like to support HLSL on a wider range of targets, but
today targeting anything other than `dxil` is likly to cause lots of
headaches. This adds an error and tests to validate that the expected
target is `dxil-?-shadermodel`.

We will continue to do a best effort to ensure the code we write makes
it easy to support other targets (like SPIR-V), but this error will
prevent users from hitting frustrating errors for unsupported cases.

Reviewed By: jcranmer-intel, Anastasia

Differential Revision: https://reviews.llvm.org/D132056
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenHLSL/validator_version.hlsl
clang/test/Driver/hlsl-lang-targets.hlsl [new file with mode: 0644]
clang/test/Preprocessor/predefined-macros-hlsl.hlsl