Remove the ConstantArrayType subtypes. This information is preserved in the

TypeLoc records for declarations;  it should not be necessary to represent it
directly in the type system.

Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.

llvm-svn: 84222
This commit is contained in:
John McCall 2009-10-16 00:14:28 +00:00
parent dae45e9079
commit c5b8225285
15 changed files with 11 additions and 364 deletions

View File

@ -431,22 +431,6 @@ public:
ArrayType::ArraySizeModifier ASM, ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals); unsigned EltTypeQuals);
/// getConstantArrayWithExprType - Return a reference to the type for a
/// constant array of the specified element type.
QualType getConstantArrayWithExprType(QualType EltTy,
const llvm::APInt &ArySize,
Expr *ArySizeExpr,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals,
SourceRange Brackets);
/// getConstantArrayWithoutExprType - Return a reference to the type
/// for a constant array of the specified element type.
QualType getConstantArrayWithoutExprType(QualType EltTy,
const llvm::APInt &ArySize,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals);
/// getVectorType - Return the unique reference to a vector type of /// getVectorType - Return the unique reference to a vector type of
/// the specified element type and size. VectorType must be a built-in type. /// the specified element type and size. VectorType must be a built-in type.
QualType getVectorType(QualType VectorType, unsigned NumElts); QualType getVectorType(QualType VectorType, unsigned NumElts);

View File

@ -486,30 +486,6 @@ struct CanProxyAdaptor<ConstantArrayType>
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
}; };
template<>
struct CanProxyAdaptor<ConstantArrayWithExprType>
: public CanProxyBase<ConstantArrayWithExprType> {
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
getSizeModifier)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getIndexTypeQualifiers)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getSizeExpr)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceRange, getBracketsRange)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getLBracketLoc)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getRBracketLoc)
};
template<>
struct CanProxyAdaptor<ConstantArrayWithoutExprType>
: public CanProxyBase<ConstantArrayWithoutExprType> {
LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayType::ArraySizeModifier,
getSizeModifier)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getIndexTypeQualifiers)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const llvm::APInt &, getSize)
};
template<> template<>
struct CanProxyAdaptor<IncompleteArrayType> struct CanProxyAdaptor<IncompleteArrayType>
: public CanProxyBase<IncompleteArrayType> { : public CanProxyBase<IncompleteArrayType> {

View File

@ -1239,8 +1239,6 @@ public:
static bool classof(const Type *T) { static bool classof(const Type *T) {
return T->getTypeClass() == ConstantArray || return T->getTypeClass() == ConstantArray ||
T->getTypeClass() == ConstantArrayWithExpr ||
T->getTypeClass() == ConstantArrayWithoutExpr ||
T->getTypeClass() == VariableArray || T->getTypeClass() == VariableArray ||
T->getTypeClass() == IncompleteArray || T->getTypeClass() == IncompleteArray ||
T->getTypeClass() == DependentSizedArray; T->getTypeClass() == DependentSizedArray;
@ -1285,86 +1283,11 @@ public:
ID.AddInteger(TypeQuals); ID.AddInteger(TypeQuals);
} }
static bool classof(const Type *T) { static bool classof(const Type *T) {
return T->getTypeClass() == ConstantArray || return T->getTypeClass() == ConstantArray;
T->getTypeClass() == ConstantArrayWithExpr ||
T->getTypeClass() == ConstantArrayWithoutExpr;
} }
static bool classof(const ConstantArrayType *) { return true; } static bool classof(const ConstantArrayType *) { return true; }
}; };
/// ConstantArrayWithExprType - This class represents C arrays with a
/// constant size specified by means of an integer constant expression.
/// For example 'int A[sizeof(int)]' has ConstantArrayWithExprType where
/// the element type is 'int' and the size expression is 'sizeof(int)'.
/// These types are non-canonical.
class ConstantArrayWithExprType : public ConstantArrayType {
/// SizeExpr - The ICE occurring in the concrete syntax.
Expr *SizeExpr;
/// Brackets - The left and right array brackets.
SourceRange Brackets;
ConstantArrayWithExprType(QualType et, QualType can,
const llvm::APInt &size, Expr *e,
ArraySizeModifier sm, unsigned tq,
SourceRange brackets)
: ConstantArrayType(ConstantArrayWithExpr, et, can, size, sm, tq),
SizeExpr(e), Brackets(brackets) {}
friend class ASTContext; // ASTContext creates these.
virtual void Destroy(ASTContext& C);
public:
Expr *getSizeExpr() const { return SizeExpr; }
SourceRange getBracketsRange() const { return Brackets; }
SourceLocation getLBracketLoc() const { return Brackets.getBegin(); }
SourceLocation getRBracketLoc() const { return Brackets.getEnd(); }
virtual void getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const;
bool isSugared() const { return false; }
QualType desugar() const { return QualType(this, 0); }
static bool classof(const Type *T) {
return T->getTypeClass() == ConstantArrayWithExpr;
}
static bool classof(const ConstantArrayWithExprType *) { return true; }
void Profile(llvm::FoldingSetNodeID &ID) {
assert(0 && "Cannot unique ConstantArrayWithExprTypes.");
}
};
/// ConstantArrayWithoutExprType - This class represents C arrays with a
/// constant size that was not specified by an integer constant expression,
/// but inferred by static semantics.
/// For example 'int A[] = { 0, 1, 2 }' has ConstantArrayWithoutExprType.
/// These types are non-canonical: the corresponding canonical type,
/// having the size specified in an APInt object, is a ConstantArrayType.
class ConstantArrayWithoutExprType : public ConstantArrayType {
ConstantArrayWithoutExprType(QualType et, QualType can,
const llvm::APInt &size,
ArraySizeModifier sm, unsigned tq)
: ConstantArrayType(ConstantArrayWithoutExpr, et, can, size, sm, tq) {}
friend class ASTContext; // ASTContext creates these.
public:
virtual void getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const;
bool isSugared() const { return false; }
QualType desugar() const { return QualType(this, 0); }
static bool classof(const Type *T) {
return T->getTypeClass() == ConstantArrayWithoutExpr;
}
static bool classof(const ConstantArrayWithoutExprType *) { return true; }
void Profile(llvm::FoldingSetNodeID &ID) {
assert(0 && "Cannot unique ConstantArrayWithoutExprTypes.");
}
};
/// IncompleteArrayType - This class represents C arrays with an unspecified /// IncompleteArrayType - This class represents C arrays with an unspecified
/// size. For example 'int A[]' has an IncompleteArrayType where the element /// size. For example 'int A[]' has an IncompleteArrayType where the element
/// type is 'int' and the size is unspecified. /// type is 'int' and the size is unspecified.

View File

@ -62,8 +62,6 @@ TYPE(RValueReference, ReferenceType)
TYPE(MemberPointer, Type) TYPE(MemberPointer, Type)
ABSTRACT_TYPE(Array, Type) ABSTRACT_TYPE(Array, Type)
TYPE(ConstantArray, ArrayType) TYPE(ConstantArray, ArrayType)
NON_CANONICAL_TYPE(ConstantArrayWithExpr, ConstantArrayType)
NON_CANONICAL_TYPE(ConstantArrayWithoutExpr, ConstantArrayType)
TYPE(IncompleteArray, ArrayType) TYPE(IncompleteArray, ArrayType)
TYPE(VariableArray, ArrayType) TYPE(VariableArray, ArrayType)
DEPENDENT_TYPE(DependentSizedArray, ArrayType) DEPENDENT_TYPE(DependentSizedArray, ArrayType)

View File

@ -406,12 +406,8 @@ namespace clang {
TYPE_OBJC_PROTOCOL_LIST = 23, TYPE_OBJC_PROTOCOL_LIST = 23,
/// \brief a DecltypeType record. /// \brief a DecltypeType record.
TYPE_DECLTYPE = 24, TYPE_DECLTYPE = 24,
/// \brief A ConstantArrayWithExprType record.
TYPE_CONSTANT_ARRAY_WITH_EXPR = 25,
/// \brief A ConstantArrayWithoutExprType record.
TYPE_CONSTANT_ARRAY_WITHOUT_EXPR = 26,
/// \brief An ElaboratedType record. /// \brief An ElaboratedType record.
TYPE_ELABORATED = 27 TYPE_ELABORATED = 25
}; };
/// \brief The type IDs for special types constructed by semantic /// \brief The type IDs for special types constructed by semantic

View File

@ -571,8 +571,6 @@ ASTContext::getTypeInfo(const Type *T) {
Align = getTypeAlign(cast<ArrayType>(T)->getElementType()); Align = getTypeAlign(cast<ArrayType>(T)->getElementType());
break; break;
case Type::ConstantArrayWithExpr:
case Type::ConstantArrayWithoutExpr:
case Type::ConstantArray: { case Type::ConstantArray: {
const ConstantArrayType *CAT = cast<ConstantArrayType>(T); const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
@ -1358,53 +1356,6 @@ QualType ASTContext::getConstantArrayType(QualType EltTy,
return QualType(New, 0); return QualType(New, 0);
} }
/// getConstantArrayWithExprType - Return a reference to the type for
/// an array of the specified element type.
QualType
ASTContext::getConstantArrayWithExprType(QualType EltTy,
const llvm::APInt &ArySizeIn,
Expr *ArySizeExpr,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals,
SourceRange Brackets) {
// Convert the array size into a canonical width matching the pointer
// size for the target.
llvm::APInt ArySize(ArySizeIn);
ArySize.zextOrTrunc(Target.getPointerWidth(EltTy.getAddressSpace()));
// Compute the canonical ConstantArrayType.
QualType Canonical = getConstantArrayType(getCanonicalType(EltTy),
ArySize, ASM, EltTypeQuals);
// Since we don't unique expressions, it isn't possible to unique VLA's
// that have an expression provided for their size.
ConstantArrayWithExprType *New = new(*this, TypeAlignment)
ConstantArrayWithExprType(EltTy, Canonical, ArySize, ArySizeExpr,
ASM, EltTypeQuals, Brackets);
Types.push_back(New);
return QualType(New, 0);
}
/// getConstantArrayWithoutExprType - Return a reference to the type for
/// an array of the specified element type.
QualType
ASTContext::getConstantArrayWithoutExprType(QualType EltTy,
const llvm::APInt &ArySizeIn,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals) {
// Convert the array size into a canonical width matching the pointer
// size for the target.
llvm::APInt ArySize(ArySizeIn);
ArySize.zextOrTrunc(Target.getPointerWidth(EltTy.getAddressSpace()));
// Compute the canonical ConstantArrayType.
QualType Canonical = getConstantArrayType(getCanonicalType(EltTy),
ArySize, ASM, EltTypeQuals);
ConstantArrayWithoutExprType *New = new(*this, TypeAlignment)
ConstantArrayWithoutExprType(EltTy, Canonical, ArySize, ASM, EltTypeQuals);
Types.push_back(New);
return QualType(New, 0);
}
/// getVariableArrayType - Returns a non-unique reference to the type for a /// getVariableArrayType - Returns a non-unique reference to the type for a
/// variable array of the specified element type. /// variable array of the specified element type.
QualType ASTContext::getVariableArrayType(QualType EltTy, QualType ASTContext::getVariableArrayType(QualType EltTy,

View File

@ -37,18 +37,6 @@ void Type::Destroy(ASTContext& C) {
C.Deallocate(this); C.Deallocate(this);
} }
void ConstantArrayWithExprType::Destroy(ASTContext& C) {
// FIXME: destruction of SizeExpr commented out due to resource contention.
// SizeExpr->Destroy(C);
// See FIXME in SemaDecl.cpp:1536: if we were able to either steal
// or clone the SizeExpr there, then here we could freely delete it.
// Since we do not know how to steal or clone, we keep a pointer to
// a shared resource, but we cannot free it.
// (There probably is a trivial solution ... for people knowing clang!).
this->~ConstantArrayWithExprType();
C.Deallocate(this);
}
void VariableArrayType::Destroy(ASTContext& C) { void VariableArrayType::Destroy(ASTContext& C) {
if (SizeExpr) if (SizeExpr)
SizeExpr->Destroy(C); SizeExpr->Destroy(C);
@ -177,8 +165,6 @@ bool Type::isDerivedType() const {
case Pointer: case Pointer:
case VariableArray: case VariableArray:
case ConstantArray: case ConstantArray:
case ConstantArrayWithExpr:
case ConstantArrayWithoutExpr:
case IncompleteArray: case IncompleteArray:
case FunctionProto: case FunctionProto:
case FunctionNoProto: case FunctionNoProto:
@ -1111,29 +1097,6 @@ void ConstantArrayType::getAsStringInternal(std::string &S, const PrintingPolicy
getElementType().getAsStringInternal(S, Policy); getElementType().getAsStringInternal(S, Policy);
} }
void ConstantArrayWithExprType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
if (Policy.ConstantArraySizeAsWritten) {
std::string SStr;
llvm::raw_string_ostream s(SStr);
getSizeExpr()->printPretty(s, 0, Policy);
S += '[';
S += s.str();
S += ']';
getElementType().getAsStringInternal(S, Policy);
}
else
ConstantArrayType::getAsStringInternal(S, Policy);
}
void ConstantArrayWithoutExprType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
if (Policy.ConstantArraySizeAsWritten) {
S += "[]";
getElementType().getAsStringInternal(S, Policy);
}
else
ConstantArrayType::getAsStringInternal(S, Policy);
}
void IncompleteArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const { void IncompleteArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
S += "[]"; S += "[]";

View File

@ -846,8 +846,6 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
Unit); Unit);
case Type::ConstantArray: case Type::ConstantArray:
case Type::ConstantArrayWithExpr:
case Type::ConstantArrayWithoutExpr:
case Type::VariableArray: case Type::VariableArray:
case Type::IncompleteArray: case Type::IncompleteArray:
return CreateType(cast<ArrayType>(Ty), Unit); return CreateType(cast<ArrayType>(Ty), Unit);

View File

@ -1839,30 +1839,6 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
ASM, IndexTypeQuals); ASM, IndexTypeQuals);
} }
case pch::TYPE_CONSTANT_ARRAY_WITH_EXPR: {
QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
unsigned IndexTypeQuals = Record[2];
SourceLocation LBLoc = SourceLocation::getFromRawEncoding(Record[3]);
SourceLocation RBLoc = SourceLocation::getFromRawEncoding(Record[4]);
unsigned Idx = 5;
llvm::APInt Size = ReadAPInt(Record, Idx);
return Context->getConstantArrayWithExprType(ElementType,
Size, ReadTypeExpr(),
ASM, IndexTypeQuals,
SourceRange(LBLoc, RBLoc));
}
case pch::TYPE_CONSTANT_ARRAY_WITHOUT_EXPR: {
QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];
unsigned IndexTypeQuals = Record[2];
unsigned Idx = 3;
llvm::APInt Size = ReadAPInt(Record, Idx);
return Context->getConstantArrayWithoutExprType(ElementType, Size,
ASM, IndexTypeQuals);
}
case pch::TYPE_INCOMPLETE_ARRAY: { case pch::TYPE_INCOMPLETE_ARRAY: {
QualType ElementType = GetType(Record[0]); QualType ElementType = GetType(Record[0]);
ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1]; ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1];

View File

@ -117,23 +117,6 @@ void PCHTypeWriter::VisitConstantArrayType(const ConstantArrayType *T) {
Code = pch::TYPE_CONSTANT_ARRAY; Code = pch::TYPE_CONSTANT_ARRAY;
} }
void PCHTypeWriter
::VisitConstantArrayWithExprType(const ConstantArrayWithExprType *T) {
VisitArrayType(T);
Writer.AddSourceLocation(T->getLBracketLoc(), Record);
Writer.AddSourceLocation(T->getRBracketLoc(), Record);
Writer.AddAPInt(T->getSize(), Record);
Writer.AddStmt(T->getSizeExpr());
Code = pch::TYPE_CONSTANT_ARRAY_WITH_EXPR;
}
void PCHTypeWriter
::VisitConstantArrayWithoutExprType(const ConstantArrayWithoutExprType *T) {
VisitArrayType(T);
Writer.AddAPInt(T->getSize(), Record);
Code = pch::TYPE_CONSTANT_ARRAY_WITHOUT_EXPR;
}
void PCHTypeWriter::VisitIncompleteArrayType(const IncompleteArrayType *T) { void PCHTypeWriter::VisitIncompleteArrayType(const IncompleteArrayType *T) {
VisitArrayType(T); VisitArrayType(T);
Code = pch::TYPE_INCOMPLETE_ARRAY; Code = pch::TYPE_INCOMPLETE_ARRAY;

View File

@ -361,9 +361,8 @@ void Sema::ActOnEndOfTranslationUnit() {
// Set the length of the array to 1 (C99 6.9.2p5). // Set the length of the array to 1 (C99 6.9.2p5).
Diag(VD->getLocation(), diag::warn_tentative_incomplete_array); Diag(VD->getLocation(), diag::warn_tentative_incomplete_array);
llvm::APInt One(Context.getTypeSize(Context.getSizeType()), true); llvm::APInt One(Context.getTypeSize(Context.getSizeType()), true);
QualType T QualType T = Context.getConstantArrayType(ArrayT->getElementType(),
= Context.getConstantArrayWithoutExprType(ArrayT->getElementType(), One, ArrayType::Normal, 0);
One, ArrayType::Normal, 0);
VD->setType(T); VD->setType(T);
} else if (RequireCompleteType(VD->getLocation(), VD->getType(), } else if (RequireCompleteType(VD->getLocation(), VD->getType(),
diag::err_tentative_def_incomplete_type)) diag::err_tentative_def_incomplete_type))

View File

@ -1903,16 +1903,9 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T,
llvm::APSInt &Res = EvalResult.Val.getInt(); llvm::APSInt &Res = EvalResult.Val.getInt();
if (Res >= llvm::APSInt(Res.getBitWidth(), Res.isUnsigned())) { if (Res >= llvm::APSInt(Res.getBitWidth(), Res.isUnsigned())) {
Expr* ArySizeExpr = VLATy->getSizeExpr(); // TODO: preserve the size expression in declarator info
// FIXME: here we could "steal" (how?) ArySizeExpr from the VLA, return Context.getConstantArrayType(VLATy->getElementType(),
// so as to transfer ownership to the ConstantArrayWithExpr. Res, ArrayType::Normal, 0);
// Alternatively, we could "clone" it (how?).
// Since we don't know how to do things above, we just use the
// very same Expr*.
return Context.getConstantArrayWithExprType(VLATy->getElementType(),
Res, ArySizeExpr,
ArrayType::Normal, 0,
VLATy->getBracketsRange());
} }
SizeIsNegative = true; SizeIsNegative = true;

View File

@ -109,9 +109,9 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, Sema &S) {
llvm::APSInt ConstVal(32); llvm::APSInt ConstVal(32);
ConstVal = StrLength; ConstVal = StrLength;
// Return a new array type (C99 6.7.8p22). // Return a new array type (C99 6.7.8p22).
DeclT = S.Context.getConstantArrayWithoutExprType(IAT->getElementType(), DeclT = S.Context.getConstantArrayType(IAT->getElementType(),
ConstVal, ConstVal,
ArrayType::Normal, 0); ArrayType::Normal, 0);
return; return;
} }

View File

@ -610,8 +610,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
<< ArraySize->getSourceRange(); << ArraySize->getSourceRange();
} }
} }
T = Context.getConstantArrayWithExprType(T, ConstVal, ArraySize, T = Context.getConstantArrayType(T, ConstVal, ASM, Quals);
ASM, Quals, Brackets);
} }
// If this is not C99, extwarn about VLA's and C99 array size modifiers. // If this is not C99, extwarn about VLA's and C99 array size modifiers.
if (!getLangOptions().C99) { if (!getLangOptions().C99) {

View File

@ -340,29 +340,6 @@ public:
const llvm::APInt &Size, const llvm::APInt &Size,
unsigned IndexTypeQuals); unsigned IndexTypeQuals);
/// \brief Build a new constant array type given the element type, size
/// modifier, (known) size of the array, size expression, and index type
/// qualifiers.
///
/// By default, performs semantic analysis when building the array type.
/// Subclasses may override this routine to provide different behavior.
QualType RebuildConstantArrayWithExprType(QualType ElementType,
ArrayType::ArraySizeModifier SizeMod,
const llvm::APInt &Size,
Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange);
/// \brief Build a new constant array type given the element type, size
/// modifier, (known) size of the array, and index type qualifiers.
///
/// By default, performs semantic analysis when building the array type.
/// Subclasses may override this routine to provide different behavior.
QualType RebuildConstantArrayWithoutExprType(QualType ElementType,
ArrayType::ArraySizeModifier SizeMod,
const llvm::APInt &Size,
unsigned IndexTypeQuals);
/// \brief Build a new incomplete array type given the element type, size /// \brief Build a new incomplete array type given the element type, size
/// modifier, and index type qualifiers. /// modifier, and index type qualifiers.
/// ///
@ -2076,52 +2053,6 @@ TreeTransform<Derived>::TransformConstantArrayType(const ConstantArrayType *T) {
T->getIndexTypeCVRQualifiers()); T->getIndexTypeCVRQualifiers());
} }
template<typename Derived>
QualType
TreeTransform<Derived>::TransformConstantArrayWithExprType(
const ConstantArrayWithExprType *T) {
QualType ElementType = getDerived().TransformType(T->getElementType());
if (ElementType.isNull())
return QualType();
// Array bounds are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
if (Size.isInvalid())
return QualType();
if (!getDerived().AlwaysRebuild() &&
ElementType == T->getElementType() &&
Size.get() == T->getSizeExpr())
return QualType(T, 0);
return getDerived().RebuildConstantArrayWithExprType(ElementType,
T->getSizeModifier(),
T->getSize(),
Size.takeAs<Expr>(),
T->getIndexTypeCVRQualifiers(),
T->getBracketsRange());
}
template<typename Derived>
QualType
TreeTransform<Derived>::TransformConstantArrayWithoutExprType(
const ConstantArrayWithoutExprType *T) {
QualType ElementType = getDerived().TransformType(T->getElementType());
if (ElementType.isNull())
return QualType();
if (!getDerived().AlwaysRebuild() &&
ElementType == T->getElementType())
return QualType(T, 0);
return getDerived().RebuildConstantArrayWithoutExprType(ElementType,
T->getSizeModifier(),
T->getSize(),
T->getIndexTypeCVRQualifiers());
}
template<typename Derived> template<typename Derived>
QualType TreeTransform<Derived>::TransformIncompleteArrayType( QualType TreeTransform<Derived>::TransformIncompleteArrayType(
const IncompleteArrayType *T) { const IncompleteArrayType *T) {
@ -4547,29 +4478,6 @@ TreeTransform<Derived>::RebuildConstantArrayType(QualType ElementType,
IndexTypeQuals, SourceRange()); IndexTypeQuals, SourceRange());
} }
template<typename Derived>
QualType
TreeTransform<Derived>::RebuildConstantArrayWithExprType(QualType ElementType,
ArrayType::ArraySizeModifier SizeMod,
const llvm::APInt &Size,
Expr *SizeExpr,
unsigned IndexTypeQuals,
SourceRange BracketsRange) {
return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, SizeExpr,
IndexTypeQuals, BracketsRange);
}
template<typename Derived>
QualType
TreeTransform<Derived>::RebuildConstantArrayWithoutExprType(
QualType ElementType,
ArrayType::ArraySizeModifier SizeMod,
const llvm::APInt &Size,
unsigned IndexTypeQuals) {
return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0,
IndexTypeQuals, SourceRange());
}
template<typename Derived> template<typename Derived>
QualType QualType
TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType, TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType,