From e035b27686940997d4a28fa97f3c0edd107faea4 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 21 Dec 2018 14:35:12 +0200 Subject: [PATCH] Fixed a crash when parsing type aliases. This was caused by a change in behaviour in Clang - https://github.com/llvm-mirror/clang/commit/a8770a7e8e8797a860773c2e0959274b1db4fc7a (SVN revision 346146). Signed-off-by: Dimitar Dobrev --- src/CppParser/Parser.cpp | 8 ++++---- tests/Common/Common.h | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index e84fb8af..9792e986 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -2475,7 +2475,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, TST->_template = static_cast(WalkDeclaration( Name.getAsTemplateDecl())); if (TS->isSugared()) - TST->desugared = GetQualifiedType(TS->desugar(), TL); + TST->desugared = GetQualifiedType(TS->getCanonicalTypeInternal(), TL); TypeLoc UTL, ETL, ITL; @@ -2518,7 +2518,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, auto TST = new DependentTemplateSpecializationType(); if (TS->isSugared()) - TST->desugared = GetQualifiedType(TS->desugar(), TL); + TST->desugared = GetQualifiedType(TS->getCanonicalTypeInternal(), TL); TypeLoc UTL, ETL, ITL; @@ -2706,7 +2706,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, auto UTT = new UnaryTransformType(); auto Loc = TL->getAs().getUnderlyingTInfo()->getTypeLoc(); - UTT->desugared = GetQualifiedType(UT->isSugared() ? UT->desugar() : UT->getBaseType(), &Loc); + UTT->desugared = GetQualifiedType(UT->isSugared() ? UT->getCanonicalTypeInternal() : UT->getBaseType(), &Loc); UTT->baseType = GetQualifiedType(UT->getBaseType(), &Loc); Ty = UTT; @@ -2733,7 +2733,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, { auto AT = Type->getAs(); if (AT->isSugared()) - Ty = WalkType(AT->desugar()); + Ty = WalkType(AT->getCanonicalTypeInternal()); else return nullptr; break; diff --git a/tests/Common/Common.h b/tests/Common/Common.h index 8e32acd0..0b6117dd 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -1457,3 +1457,12 @@ class MyIntList : public MyList }; void MyFunc(MyList *list); + +template using InvokeGenSeq = typename T::Type; + +template struct DerivedTypeAlias; +template using TypeAlias = InvokeGenSeq>; + +template +struct DerivedTypeAlias : TypeAlias {}; +