[clang] Resolve FIXME: Use HalfWidth and HalfAlign for shorts (PR #81367)

via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 10 09:37:13 PST 2024


https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/81367

Shorts are half an int, so HalfWidth and HalfAlign apply here.

>From b7c50bfa24abe51e73852667a6d972780dbf8cc2 Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams at users.noreply.github.com>
Date: Sat, 10 Feb 2024 12:35:20 -0500
Subject: [PATCH] Resolve FIXME: Use HalfWidth and HalfAlign for shorts

Shorts are half an int, so HalfWidth and HalfAlign apply here.
---
 clang/include/clang/Basic/TargetInfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 48e9cec482755c..00851dc2fb0d07 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -489,11 +489,11 @@ class TargetInfo : public TransferrableTargetInfo,
 
   /// Return the size of 'signed short' and 'unsigned short' for this
   /// target, in bits.
-  unsigned getShortWidth() const { return 16; } // FIXME
+  unsigned getShortWidth() const { return HalfWidth; }
 
   /// Return the alignment of 'signed short' and 'unsigned short' for
   /// this target.
-  unsigned getShortAlign() const { return 16; } // FIXME
+  unsigned getShortAlign() const { return HalfAlign; }
 
   /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
   /// this target, in bits.



More information about the cfe-commits mailing list