[clang] [NFC] Reduce size of FunctionEffect to 1 byte. (PR #100753)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 07:30:29 PDT 2024


https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/100753

As a preliminary to PR https://github.com/llvm/llvm-project/pull/99656 , reduce the size of `FunctionEffect` to 1 byte.

>From 3cc18ded835f3a25dc98bc81988d3a2f1181c300 Mon Sep 17 00:00:00 2001
From: Doug Wyatt <dwyatt at apple.com>
Date: Sun, 5 May 2024 12:36:53 -0700
Subject: [PATCH] Reduce size of FunctionEffect to 1 byte.

---
 clang/include/clang/AST/Type.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 25defea58c2dc..cb345c3028909 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -4699,16 +4699,16 @@ class FunctionEffect {
 
 private:
   LLVM_PREFERRED_TYPE(Kind)
-  unsigned FKind : 3;
+  uint8_t FKind : 3;
 
   // Expansion: for hypothetical TCB+types, there could be one Kind for TCB,
   // then ~16(?) bits "SubKind" to map to a specific named TCB. SubKind would
   // be considered for uniqueness.
 
 public:
-  FunctionEffect() : FKind(unsigned(Kind::None)) {}
+  FunctionEffect() : FKind(uint8_t(Kind::None)) {}
 
-  explicit FunctionEffect(Kind K) : FKind(unsigned(K)) {}
+  explicit FunctionEffect(Kind K) : FKind(uint8_t(K)) {}
 
   /// The kind of the effect.
   Kind kind() const { return Kind(FKind); }



More information about the cfe-commits mailing list