summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-16 00:14:28 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-16 00:14:28 +0000
commitc5b8225285fb47be39fe0af7f3339844e39f2d35 (patch)
treead3e9f0289502d0bfd4271a29dad4ba82184b77c /clang/lib/AST
parentdae45e90797558506785c07c318ec1f645a0871a (diff)
downloadbcm5719-llvm-c5b8225285fb47be39fe0af7f3339844e39f2d35.tar.gz
bcm5719-llvm-c5b8225285fb47be39fe0af7f3339844e39f2d35.zip
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
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp49
-rw-r--r--clang/lib/AST/Type.cpp37
2 files changed, 0 insertions, 86 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index e028186d46e..507baeab27a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -571,8 +571,6 @@ ASTContext::getTypeInfo(const Type *T) {
Align = getTypeAlign(cast<ArrayType>(T)->getElementType());
break;
- case Type::ConstantArrayWithExpr:
- case Type::ConstantArrayWithoutExpr:
case Type::ConstantArray: {
const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
@@ -1358,53 +1356,6 @@ QualType ASTContext::getConstantArrayType(QualType EltTy,
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
/// variable array of the specified element type.
QualType ASTContext::getVariableArrayType(QualType EltTy,
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 0293862baed..bb9f57b6d1c 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -37,18 +37,6 @@ void Type::Destroy(ASTContext& C) {
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) {
if (SizeExpr)
SizeExpr->Destroy(C);
@@ -177,8 +165,6 @@ bool Type::isDerivedType() const {
case Pointer:
case VariableArray:
case ConstantArray:
- case ConstantArrayWithExpr:
- case ConstantArrayWithoutExpr:
case IncompleteArray:
case FunctionProto:
case FunctionNoProto:
@@ -1111,29 +1097,6 @@ void ConstantArrayType::getAsStringInternal(std::string &S, const PrintingPolicy
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 {
S += "[]";
OpenPOWER on IntegriCloud