[clang] 2b509ec - [AST] Reorder fields in FunctionTypeBitfields to avoid splitting a field across 32 bit boundary

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 3 13:01:31 PST 2025


Author: Craig Topper
Date: 2025-03-03T13:01:08-08:00
New Revision: 2b509ecf2dadcd5ea81b15c85f116c20b9b1f649

URL: https://github.com/llvm/llvm-project/commit/2b509ecf2dadcd5ea81b15c85f116c20b9b1f649
DIFF: https://github.com/llvm/llvm-project/commit/2b509ecf2dadcd5ea81b15c85f116c20b9b1f649.diff

LOG: [AST] Reorder fields in FunctionTypeBitfields to avoid splitting a field across 32 bit boundary

Fixes #129521.

Added: 
    

Modified: 
    clang/include/clang/AST/Type.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 3cd2be2d2170a..79cf237431450 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -1943,11 +1943,6 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     LLVM_PREFERRED_TYPE(TypeBitfields)
     unsigned : NumTypeBits;
 
-    /// Extra information which affects how the function is called, like
-    /// regparm and the calling convention.
-    LLVM_PREFERRED_TYPE(CallingConv)
-    unsigned ExtInfo : 14;
-
     /// The ref-qualifier associated with a \c FunctionProtoType.
     ///
     /// This is a value of type \c RefQualifierKind.
@@ -1966,12 +1961,6 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     LLVM_PREFERRED_TYPE(bool)
     unsigned HasExtQuals : 1;
 
-    /// The number of parameters this function has, not counting '...'.
-    /// According to [implimits] 8 bits should be enough here but this is
-    /// somewhat easy to exceed with metaprogramming and so we would like to
-    /// keep NumParams as wide as reasonably possible.
-    unsigned NumParams : FunctionTypeNumParamsWidth;
-
     /// The type of exception specification this function has.
     LLVM_PREFERRED_TYPE(ExceptionSpecificationType)
     unsigned ExceptionSpecType : 4;
@@ -1991,6 +1980,17 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
     /// Whether this function has a trailing return type.
     LLVM_PREFERRED_TYPE(bool)
     unsigned HasTrailingReturn : 1;
+
+    /// Extra information which affects how the function is called, like
+    /// regparm and the calling convention.
+    LLVM_PREFERRED_TYPE(CallingConv)
+    unsigned ExtInfo : 14;
+
+    /// The number of parameters this function has, not counting '...'.
+    /// According to [implimits] 8 bits should be enough here but this is
+    /// somewhat easy to exceed with metaprogramming and so we would like to
+    /// keep NumParams as wide as reasonably possible.
+    unsigned NumParams : FunctionTypeNumParamsWidth;
   };
 
   class ObjCObjectTypeBitfields {


        


More information about the cfe-commits mailing list