diff options
| author | Sarah Spall <sarahspall@microsoft.com> | 2025-10-31 09:49:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 09:49:32 -0700 |
| commit | 42004193f4e22a61dc68f6414b82077edd1314e2 (patch) | |
| tree | ce352fd960e2389f5ca017371ac492d09f00ca69 /clang/lib/Frontend/InitPreprocessor.cpp | |
| parent | 7cd3be4a8b37838595563d3100619cdbc588da61 (diff) | |
[HLSL] Add NativeInt16Type langopt to control whether short type is supported. Enabled by default for all but HLSL. (#165584)
Add a new langopt NativeInt16Type to control support for 16 bit
integers.
Enable by default for all languages but HLSL.
HLSL defines uint16_t and int16_t as a typedef of short. If
-enable-16bit-types is not used, the typedefs don't exist so int16_t and
uint16_t can't be used. However, short was still allowed. This change
will produce an error 'unknown type name short' if -enable-16bit-types
isn't used.
Update failing tests.
Add new test.
Closes #81779
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
| -rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 47f1d5a6b636..8602be1d8a17 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -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"); // Shader target information |
