forked from OSchip/llvm-project
Move ref qualifiers from Type bitfields into FunctionProtoType, stealing two
bits from the number of parameters. This brings the bitfields down from 33 bits to 32 bits, reducing the size of Types by 4 bytes on 32-bit systems. llvm-svn: 171827
This commit is contained in:
parent
5c0b298b91
commit
1ecd564487
|
@ -1274,11 +1274,6 @@ protected:
|
|||
/// C++ 8.3.5p4: The return type, the parameter type list and the
|
||||
/// cv-qualifier-seq, [...], are part of the function type.
|
||||
unsigned TypeQuals : 3;
|
||||
|
||||
/// \brief The ref-qualifier associated with a \c FunctionProtoType.
|
||||
///
|
||||
/// This is a value of type \c RefQualifierKind.
|
||||
unsigned RefQualifier : 2;
|
||||
};
|
||||
|
||||
class ObjCObjectTypeBitfields {
|
||||
|
@ -2693,8 +2688,7 @@ class FunctionType : public Type {
|
|||
|
||||
protected:
|
||||
FunctionType(TypeClass tc, QualType res,
|
||||
unsigned typeQuals, RefQualifierKind RefQualifier,
|
||||
QualType Canonical, bool Dependent,
|
||||
unsigned typeQuals, QualType Canonical, bool Dependent,
|
||||
bool InstantiationDependent,
|
||||
bool VariablyModified, bool ContainsUnexpandedParameterPack,
|
||||
ExtInfo Info)
|
||||
|
@ -2703,14 +2697,9 @@ protected:
|
|||
ResultType(res) {
|
||||
FunctionTypeBits.ExtInfo = Info.Bits;
|
||||
FunctionTypeBits.TypeQuals = typeQuals;
|
||||
FunctionTypeBits.RefQualifier = static_cast<unsigned>(RefQualifier);
|
||||
}
|
||||
unsigned getTypeQuals() const { return FunctionTypeBits.TypeQuals; }
|
||||
|
||||
RefQualifierKind getRefQualifier() const {
|
||||
return static_cast<RefQualifierKind>(FunctionTypeBits.RefQualifier);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
QualType getResultType() const { return ResultType; }
|
||||
|
@ -2742,7 +2731,7 @@ public:
|
|||
/// no information available about its arguments.
|
||||
class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode {
|
||||
FunctionNoProtoType(QualType Result, QualType Canonical, ExtInfo Info)
|
||||
: FunctionType(FunctionNoProto, Result, 0, RQ_None, Canonical,
|
||||
: FunctionType(FunctionNoProto, Result, 0, Canonical,
|
||||
/*Dependent=*/false, /*InstantiationDependent=*/false,
|
||||
Result->isVariablyModifiedType(),
|
||||
/*ContainsUnexpandedParameterPack=*/false, Info) {}
|
||||
|
@ -2815,7 +2804,7 @@ private:
|
|||
QualType canonical, const ExtProtoInfo &epi);
|
||||
|
||||
/// NumArgs - The number of arguments this function has, not counting '...'.
|
||||
unsigned NumArgs : 17;
|
||||
unsigned NumArgs : 15;
|
||||
|
||||
/// NumExceptions - The number of types in the exception spec, if any.
|
||||
unsigned NumExceptions : 9;
|
||||
|
@ -2832,6 +2821,11 @@ private:
|
|||
/// HasTrailingReturn - Whether this function has a trailing return type.
|
||||
unsigned HasTrailingReturn : 1;
|
||||
|
||||
/// \brief The ref-qualifier associated with a \c FunctionProtoType.
|
||||
///
|
||||
/// This is a value of type \c RefQualifierKind.
|
||||
unsigned RefQualifier : 2;
|
||||
|
||||
// ArgInfo - There is an variable size array after the class in memory that
|
||||
// holds the argument types.
|
||||
|
||||
|
@ -2979,7 +2973,7 @@ public:
|
|||
|
||||
/// \brief Retrieve the ref-qualifier associated with this function type.
|
||||
RefQualifierKind getRefQualifier() const {
|
||||
return FunctionType::getRefQualifier();
|
||||
return static_cast<RefQualifierKind>(RefQualifier);
|
||||
}
|
||||
|
||||
typedef const QualType *arg_type_iterator;
|
||||
|
|
|
@ -1561,7 +1561,7 @@ StringRef FunctionType::getNameForCallConv(CallingConv CC) {
|
|||
FunctionProtoType::FunctionProtoType(QualType result, const QualType *args,
|
||||
unsigned numArgs, QualType canonical,
|
||||
const ExtProtoInfo &epi)
|
||||
: FunctionType(FunctionProto, result, epi.TypeQuals, epi.RefQualifier,
|
||||
: FunctionType(FunctionProto, result, epi.TypeQuals,
|
||||
canonical,
|
||||
result->isDependentType(),
|
||||
result->isInstantiationDependentType(),
|
||||
|
@ -1571,8 +1571,11 @@ FunctionProtoType::FunctionProtoType(QualType result, const QualType *args,
|
|||
NumArgs(numArgs), NumExceptions(epi.NumExceptions),
|
||||
ExceptionSpecType(epi.ExceptionSpecType),
|
||||
HasAnyConsumedArgs(epi.ConsumedArguments != 0),
|
||||
Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn)
|
||||
Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn),
|
||||
RefQualifier(epi.RefQualifier)
|
||||
{
|
||||
assert(NumArgs == numArgs && "function has too many parameters");
|
||||
|
||||
// Fill in the trailing argument array.
|
||||
QualType *argSlot = reinterpret_cast<QualType*>(this+1);
|
||||
for (unsigned i = 0; i != numArgs; ++i) {
|
||||
|
|
Loading…
Reference in New Issue