Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,8 @@ class ExtQualsTypeCommonBase {
/// in three low bits on the QualType pointer; a fourth bit records whether
/// the pointer is an ExtQuals node. The extended qualifiers (address spaces,
/// Objective-C GC attributes) are much more rare.
class ExtQuals : public ExtQualsTypeCommonBase, public llvm::FoldingSetNode {
class alignas(TypeAlignment) ExtQuals : public ExtQualsTypeCommonBase,
public llvm::FoldingSetNode {
// NOTE: changing the fast qualifiers should be straightforward as
// long as you don't make 'const' non-fast.
// 1. Qualifiers:
Expand Down Expand Up @@ -1594,7 +1595,7 @@ enum class AutoTypeKeyword {
///
/// Types, once created, are immutable.
///
class alignas(8) Type : public ExtQualsTypeCommonBase {
class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
public:
enum TypeClass {
#define TYPE(Class, Base) Class,
Expand Down Expand Up @@ -1982,9 +1983,10 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
: ExtQualsTypeCommonBase(this,
canon.isNull() ? QualType(this_(), 0) : canon) {
static_assert(sizeof(*this) <= 8 + sizeof(ExtQualsTypeCommonBase),
static_assert(sizeof(*this) <=
alignof(decltype(*this)) + sizeof(ExtQualsTypeCommonBase),
"changing bitfields changed sizeof(Type)!");
static_assert(alignof(decltype(*this)) % sizeof(void *) == 0,
static_assert(alignof(decltype(*this)) % TypeAlignment == 0,
"Insufficient alignment!");
TypeBits.TC = tc;
TypeBits.Dependence = static_cast<unsigned>(Dependence);
Expand Down Expand Up @@ -5348,7 +5350,7 @@ class DeducedType : public Type {

/// Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained
/// by a type-constraint.
class alignas(8) AutoType : public DeducedType, public llvm::FoldingSetNode {
class AutoType : public DeducedType, public llvm::FoldingSetNode {
friend class ASTContext; // ASTContext creates these

ConceptDecl *TypeConstraintConcept;
Expand Down Expand Up @@ -5456,9 +5458,7 @@ class DeducedTemplateSpecializationType : public DeducedType,
/// TemplateArguments, followed by a QualType representing the
/// non-canonical aliased type when the template is a type alias
/// template.
class alignas(8) TemplateSpecializationType
: public Type,
public llvm::FoldingSetNode {
class TemplateSpecializationType : public Type, public llvm::FoldingSetNode {
friend class ASTContext; // ASTContext creates these

/// The name of the template being specialized. This is
Expand Down Expand Up @@ -5872,9 +5872,8 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
/// Represents a template specialization type whose template cannot be
/// resolved, e.g.
/// A<T>::template B<T>
class alignas(8) DependentTemplateSpecializationType
: public TypeWithKeyword,
public llvm::FoldingSetNode {
class DependentTemplateSpecializationType : public TypeWithKeyword,
public llvm::FoldingSetNode {
friend class ASTContext; // ASTContext creates these

/// The nested name specifier containing the qualifier.
Expand Down