Browse Source

Fixed a crash when parsing type aliases.

This was caused by a change in behaviour in Clang - a8770a7e8e (SVN revision 346146).

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1146/head
Dimitar Dobrev 7 years ago
parent
commit
e035b27686
  1. 8
      src/CppParser/Parser.cpp
  2. 9
      tests/Common/Common.h

8
src/CppParser/Parser.cpp

@ -2475,7 +2475,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL, @@ -2475,7 +2475,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
TST->_template = static_cast<Template*>(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, @@ -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, @@ -2706,7 +2706,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
auto UTT = new UnaryTransformType();
auto Loc = TL->getAs<UnaryTransformTypeLoc>().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, @@ -2733,7 +2733,7 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
{
auto AT = Type->getAs<clang::AutoType>();
if (AT->isSugared())
Ty = WalkType(AT->desugar());
Ty = WalkType(AT->getCanonicalTypeInternal());
else
return nullptr;
break;

9
tests/Common/Common.h

@ -1457,3 +1457,12 @@ class MyIntList : public MyList<int> @@ -1457,3 +1457,12 @@ class MyIntList : public MyList<int>
};
void MyFunc(MyList<void *> *list);
template<class T> using InvokeGenSeq = typename T::Type;
template<int N> struct DerivedTypeAlias;
template<int N> using TypeAlias = InvokeGenSeq<DerivedTypeAlias<N>>;
template<int N>
struct DerivedTypeAlias : TypeAlias<N / 2> {};

Loading…
Cancel
Save