[clang] d3a779f - Restore size of TemplateParameterList after D44352

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 5 09:01:51 PDT 2020


Author: Aaron Puchert
Date: 2020-09-05T18:01:33+02:00
New Revision: d3a779fe21500457e95c8c4e963638b93e3bcc71

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

LOG: Restore size of TemplateParameterList after D44352

After adding a field of one bit, the bitfield members would take
30+1+1+1 = 33 bits, causing the size of TemplateParameterList to
increase from 16 to 24 bytes on 64-bit systems.

With 29 bits for NumParams we can encode up to half a billion template
parameters, which is almost certainly still enough for anybody.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 4feb1d45251d..9e2254376150 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -77,7 +77,7 @@ class TemplateParameterList final
 
   /// The number of template parameters in this template
   /// parameter list.
-  unsigned NumParams : 30;
+  unsigned NumParams : 29;
 
   /// Whether this template parameter list contains an unexpanded parameter
   /// pack.


        


More information about the cfe-commits mailing list