logic: fixed template argument parsing crash

* handled case when clang doesn't know the source info of an explicitly specified template argument :(
This commit is contained in:
malte_langkabel
2015-12-16 13:27:00 +01:00
parent f06bb0e031
commit 103c8242f5
+11 -4
View File
@@ -786,16 +786,23 @@ void ASTVisitor::processTemplateArgumentsOfExplicitSpecialization(clang::ClassTe
getParseLocationForTokensInRange(argumentLoc.getSourceRange()),
argumentNameHierarchy,
specializedRecordNameHierarchy
);
);
}
}
}
else
{
clang::TypeLoc loc = specializationDecl->getTypeAsWritten()->getTypeLoc();
if (loc.getTypeLocClass() == clang::TypeLoc::TypeLocClass::TemplateSpecialization)
if (clang::TypeSourceInfo* typeSourceInfo = specializationDecl->getTypeAsWritten())
{
processTemplateArguments(loc.getAs<clang::TemplateSpecializationTypeLoc>());
clang::TypeLoc loc = typeSourceInfo->getTypeLoc();
if (loc.getTypeLocClass() == clang::TypeLoc::TypeLocClass::TemplateSpecialization)
{
processTemplateArguments(loc.getAs<clang::TemplateSpecializationTypeLoc>());
}
}
else
{
LOG_WARNING("Could not locate template arguments of explicit template specialization: " + specializedRecordNameHierarchy.getFullName());
}
}
}