diff options
| author | David Blaikie <dblaikie@gmail.com> | 2013-07-13 21:08:03 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2013-07-13 21:08:03 +0000 |
| commit | ab277d64003cdc42ae74b1ff5bca9d869ec55a33 (patch) | |
| tree | 3b7a60bff79a12556ea19cce02aa745bd1ffc60f | |
| parent | b58f6a4211b5bd2760ecb88df8142c167e6ef057 (diff) | |
| download | bcm5719-llvm-ab277d64003cdc42ae74b1ff5bca9d869ec55a33.tar.gz bcm5719-llvm-ab277d64003cdc42ae74b1ff5bca9d869ec55a33.zip | |
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.
llvm-svn: 186260
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ed13347418c..7938d6a2927 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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<Class##Type>(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<TypeOfExprType>(T)->getUnderlyingExpr()->getType() - .getTypePtr()); - - case Type::TypeOf: - return getTypeInfo(cast<TypeOfType>(T)->getUnderlyingType().getTypePtr()); - - case Type::Decltype: - return getTypeInfo(cast<DecltypeType>(T)->getUnderlyingExpr()->getType() - .getTypePtr()); - - case Type::UnaryTransform: - return getTypeInfo(cast<UnaryTransformType>(T)->getUnderlyingType()); - case Type::Elaborated: return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr()); @@ -1665,18 +1655,6 @@ ASTContext::getTypeInfoImpl(const Type *T) const { return getTypeInfo( cast<AttributedType>(T)->getEquivalentType().getTypePtr()); - case Type::TemplateSpecialization: { - assert(getCanonicalType(T) != T && - "Cannot request the size of a dependent type"); - const TemplateSpecializationType *TST = cast<TemplateSpecializationType>(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<uint64_t, unsigned> Info |

