From: David Blaikie Date: Sat, 13 Jul 2013 21:08:03 +0000 (+0000) Subject: Simplify getTypeInfoImpl handling of 'non-canonical unless dependent' types. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc80978ed59863c4d4eb251c109d312de0532611;p=clang Simplify getTypeInfoImpl handling of 'non-canonical unless dependent' types. These types are not dependent in this context, so just look through the sugar. Review by Richard Smith & Eli Friedman. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186260 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index ed13347418..7938d6a292 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1394,6 +1394,10 @@ ASTContext::getTypeInfoImpl(const Type *T) const { #define ABSTRACT_TYPE(Class, Base) #define NON_CANONICAL_TYPE(Class, Base) #define DEPENDENT_TYPE(Class, Base) case Type::Class: +#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ + case Type::Class: \ + assert(!T->isDependentType() && "should not see dependent types here"); \ + return getTypeInfo(cast(T)->desugar().getTypePtr()); #include "clang/AST/TypeNodes.def" llvm_unreachable("Should not see dependent types"); @@ -1644,20 +1648,6 @@ ASTContext::getTypeInfoImpl(const Type *T) const { break; } - case Type::TypeOfExpr: - return getTypeInfo(cast(T)->getUnderlyingExpr()->getType() - .getTypePtr()); - - case Type::TypeOf: - return getTypeInfo(cast(T)->getUnderlyingType().getTypePtr()); - - case Type::Decltype: - return getTypeInfo(cast(T)->getUnderlyingExpr()->getType() - .getTypePtr()); - - case Type::UnaryTransform: - return getTypeInfo(cast(T)->getUnderlyingType()); - case Type::Elaborated: return getTypeInfo(cast(T)->getNamedType().getTypePtr()); @@ -1665,18 +1655,6 @@ ASTContext::getTypeInfoImpl(const Type *T) const { return getTypeInfo( cast(T)->getEquivalentType().getTypePtr()); - case Type::TemplateSpecialization: { - assert(getCanonicalType(T) != T && - "Cannot request the size of a dependent type"); - const TemplateSpecializationType *TST = cast(T); - // A type alias template specialization may refer to a typedef with the - // aligned attribute on it. - if (TST->isTypeAlias()) - return getTypeInfo(TST->getAliasedType().getTypePtr()); - else - return getTypeInfo(getCanonicalType(T)); - } - case Type::Atomic: { // Start with the base type information. std::pair Info