Eliminate CXXRecordType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65671 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 702dba2..749655d 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -448,7 +448,6 @@
break;
}
case Type::Record:
- case Type::CXXRecord:
case Type::Enum: {
const TagType *TT = cast<TagType>(T);
@@ -1231,13 +1230,7 @@
} else if (ObjCInterfaceDecl *ObjCInterface = dyn_cast<ObjCInterfaceDecl>(Decl))
return getObjCInterfaceType(ObjCInterface);
- if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(Decl)) {
- if (PrevDecl)
- Decl->TypeForDecl = PrevDecl->TypeForDecl;
- else
- Decl->TypeForDecl = new (*this,8) CXXRecordType(CXXRecord);
- }
- else if (RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
+ if (RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
if (PrevDecl)
Decl->TypeForDecl = PrevDecl->TypeForDecl;
else
@@ -2841,7 +2834,6 @@
case Type::FunctionNoProto:
return mergeFunctionTypes(LHS, RHS);
case Type::Record:
- case Type::CXXRecord:
case Type::Enum:
// FIXME: Why are these compatible?
if (isObjCIdStructType(LHS) && isObjCClassStructType(RHS)) return LHS;
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 06ae9eb..3b06b4e 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -119,7 +119,6 @@
case FunctionNoProto:
case Reference:
case Record:
- case CXXRecord:
return true;
default:
return false;
@@ -709,10 +708,13 @@
/// subsumes the notion of C aggregates (C99 6.2.5p21) because it also
/// includes union types.
bool Type::isAggregateType() const {
- if (const CXXRecordType *CXXClassType = dyn_cast<CXXRecordType>(CanonicalType))
- return CXXClassType->getDecl()->isAggregate();
- if (isa<RecordType>(CanonicalType))
+ if (const RecordType *Record = dyn_cast<RecordType>(CanonicalType)) {
+ if (CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(Record->getDecl()))
+ return ClassDecl->isAggregate();
+
return true;
+ }
+
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
return EXTQT->getBaseType()->isAggregateType();
return isa<ArrayType>(CanonicalType);
@@ -743,7 +745,6 @@
// be completed.
return isVoidType();
case Record:
- case CXXRecord:
case Enum:
// A tagged type (struct/union/enum/class) is incomplete if the decl is a
// forward declaration, but not a full definition (C99 6.2.5p22).
@@ -784,11 +785,12 @@
return true;
case Record:
+ if (CXXRecordDecl *ClassDecl
+ = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
+ return ClassDecl->isPOD();
+
// C struct/union is POD.
return true;
-
- case CXXRecord:
- return cast<CXXRecordType>(CanonicalType)->getDecl()->isPOD();
}
}
@@ -915,10 +917,6 @@
return isa<RecordDecl>(TT->getDecl());
}
-bool CXXRecordType::classof(const TagType *TT) {
- return isa<CXXRecordDecl>(TT->getDecl());
-}
-
bool EnumType::classof(const TagType *TT) {
return isa<EnumDecl>(TT->getDecl());
}
diff --git a/lib/AST/TypeSerialization.cpp b/lib/AST/TypeSerialization.cpp
index 2d052aa..b7a8f1a 100644
--- a/lib/AST/TypeSerialization.cpp
+++ b/lib/AST/TypeSerialization.cpp
@@ -112,7 +112,6 @@
break;
case Type::Record:
- case Type::CXXRecord:
case Type::Enum:
// FIXME: Implement this!
assert(false && "Can't deserialize tag types!");