]> granicus.if.org Git - clang/commit
[AST] Pack the bit-fields of FunctionProtoType into Type.
authorBruno Ricci <riccibrun@gmail.com>
Tue, 2 Oct 2018 11:46:38 +0000 (11:46 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Tue, 2 Oct 2018 11:46:38 +0000 (11:46 +0000)
commitad62da215c9cb15e530cecdd95d43e4f4e366782
tree7b1e9522ddb92760f68ff198c1c543de6618a9e3
parentc242941e019b180e275d5dd79ff4e3c8613317f0
[AST] Pack the bit-fields of FunctionProtoType into Type.

Move the bit-fields of FunctionProtoType into FunctionTypeBitfields.
This cuts the size of FunctionProtoType by a pointer. Additionally use
llvm::TrailingObjects instead of manually doing the casts + arithmetic.

This patch is bigger then what could be expected for the following reasons:

1. As discussed before in D50631 it would be nice if there was some space left
   in FunctionTypeBitfields for future additions. This patch introduces an
   extra structure FunctionTypeExtraBitfields which is supposed to hold
   uncommon bits and is stored in a trailing object. The number of exception
   types NumExceptions is moved to this struct. As of this patch this trailing
   struct will only be allocated if we have > 0 types in a dynamic exception
   specification.

2. TrailingObjects cannot handle repeated types. Therefore the QualType
   representing an exception type is wrapped in a struct ExceptionType.
   The ExceptionType * is then reinterpret_cast'd to QualType *.

3. TrailingObjects needs the definition of the various trailing classes.
   Therefore ExtParameterInfo, ExceptionType and FunctionTypeExtraBitfields
   are put in FunctionType.

Differential Revision: https://reviews.llvm.org/D52738

Reviewed By: rjmccall

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343579 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Type.h
lib/AST/ASTContext.cpp
lib/AST/Type.cpp