Skip to content

Commit e035b27

Browse files
committed
Fixed a crash when parsing type aliases.
This was caused by a change in behaviour in Clang - llvm-mirror/clang@a8770a7 (SVN revision 346146). Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 21d2dbd commit e035b27

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/CppParser/Parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
24752475
TST->_template = static_cast<Template*>(WalkDeclaration(
24762476
Name.getAsTemplateDecl()));
24772477
if (TS->isSugared())
2478-
TST->desugared = GetQualifiedType(TS->desugar(), TL);
2478+
TST->desugared = GetQualifiedType(TS->getCanonicalTypeInternal(), TL);
24792479

24802480
TypeLoc UTL, ETL, ITL;
24812481

@@ -2518,7 +2518,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
25182518
auto TST = new DependentTemplateSpecializationType();
25192519

25202520
if (TS->isSugared())
2521-
TST->desugared = GetQualifiedType(TS->desugar(), TL);
2521+
TST->desugared = GetQualifiedType(TS->getCanonicalTypeInternal(), TL);
25222522

25232523
TypeLoc UTL, ETL, ITL;
25242524

@@ -2706,7 +2706,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
27062706

27072707
auto UTT = new UnaryTransformType();
27082708
auto Loc = TL->getAs<UnaryTransformTypeLoc>().getUnderlyingTInfo()->getTypeLoc();
2709-
UTT->desugared = GetQualifiedType(UT->isSugared() ? UT->desugar() : UT->getBaseType(), &Loc);
2709+
UTT->desugared = GetQualifiedType(UT->isSugared() ? UT->getCanonicalTypeInternal() : UT->getBaseType(), &Loc);
27102710
UTT->baseType = GetQualifiedType(UT->getBaseType(), &Loc);
27112711

27122712
Ty = UTT;
@@ -2733,7 +2733,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
27332733
{
27342734
auto AT = Type->getAs<clang::AutoType>();
27352735
if (AT->isSugared())
2736-
Ty = WalkType(AT->desugar());
2736+
Ty = WalkType(AT->getCanonicalTypeInternal());
27372737
else
27382738
return nullptr;
27392739
break;

tests/Common/Common.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,3 +1457,12 @@ class MyIntList : public MyList<int>
14571457
};
14581458

14591459
void MyFunc(MyList<void *> *list);
1460+
1461+
template<class T> using InvokeGenSeq = typename T::Type;
1462+
1463+
template<int N> struct DerivedTypeAlias;
1464+
template<int N> using TypeAlias = InvokeGenSeq<DerivedTypeAlias<N>>;
1465+
1466+
template<int N>
1467+
struct DerivedTypeAlias : TypeAlias<N / 2> {};
1468+

0 commit comments

Comments
 (0)