aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorChris B <chris.bieneman@me.com>2024-04-25 15:36:19 -0500
committerGitHub <noreply@github.com>2024-04-25 15:36:19 -0500
commitf2d99506950f1863015137c1185c745b875ad9fb (patch)
treeaa488eaa4c216888e229f1c71292c16a0f8d8809 /clang/lib/Frontend/InitPreprocessor.cpp
parent3005ca21596c4f4309a5692ffadc0db2b54c2055 (diff)
downloadllvm-f2d99506950f1863015137c1185c745b875ad9fb.zip
llvm-f2d99506950f1863015137c1185c745b875ad9fb.tar.gz
llvm-f2d99506950f1863015137c1185c745b875ad9fb.tar.bz2
[HLSL] Correctly set `__HLSL_ENABLE_16_BIT` (#89788)
The preprocessor define `__HLSL_ENABLE_16_BIT` should be set to 1 if native 16-bit types are enabled and not set if they are not. Previously we were setting the value to match the HLSL active language version, and we had no test coverage verifing the value was set and not set as expected. Fixes #89787
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 4f44c3b..6bdd734 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -389,8 +389,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
Twine((unsigned)LangOpts.getHLSLVersion()));
if (LangOpts.NativeHalfType)
- Builder.defineMacro("__HLSL_ENABLE_16_BIT",
- Twine((unsigned)LangOpts.getHLSLVersion()));
+ Builder.defineMacro("__HLSL_ENABLE_16_BIT", "1");
// Shader target information
// "enums" for shader stages