[clang] [HLSL] Add NativeInt16Type langopt to control whether short type is supported. Enabled by default for all but HLSL. (PR #165584)
Sarah Spall via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 30 10:38:02 PDT 2025
================
@@ -399,7 +399,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__HLSL_202y",
Twine((unsigned)LangOptions::HLSLLangStd::HLSL_202y));
- if (LangOpts.NativeHalfType)
+ if (LangOpts.NativeHalfType && LangOpts.NativeInt16Type)
Builder.defineMacro("__HLSL_ENABLE_16_BIT", "1");
----------------
spall wrote:
I think if either of these aren't enabled, the definitions defined when '__HLSL_ENABLE_16_BIT' will/could fail. My main reason for thinking this is, which requires half actually be 16 bits.
https://github.com/llvm/llvm-project/blob/784b74c6ef8a7f6ffaa7ab250eb35696dd833426/clang/lib/Headers/hlsl/hlsl_intrinsics.h#L72
https://github.com/llvm/llvm-project/pull/165584
More information about the cfe-commits
mailing list