[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 08:34:42 PDT 2024


================
@@ -406,6 +406,16 @@ void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
     LongDoubleAlign = 64;
   }
 
+  // HLSL explicitly defines the sizes and formats of some data types, and we
+  // need to conform to those regardless of what architecture you are targeting.
+  if (Opts.HLSL) {
+    LongWidth = LongAlign = 64;
+    if (!Opts.NativeHalfType) {
+      HalfFormat = &llvm::APFloat::IEEEsingle();
+      HalfWidth = HalfAlign = 32;
----------------
farzonl wrote:

Is there a test case we can add for this?

https://github.com/llvm/llvm-project/pull/90694


More information about the cfe-commits mailing list