@@ -300,36 +300,12 @@ clang::QualType EnableIfSameType(const clang::Decl *rule) {
300300 !type_param->hasDefaultArgument ()) {
301301 continue ;
302302 }
303- auto enable_if = type_param->getDefaultArgument ()
304- .getArgument ()
305- .getAsType ()
306- ->getAs <clang::DependentNameType>();
307- if (!enable_if || enable_if->getQualifier ().getKind () !=
308- clang::NestedNameSpecifier::Kind::Type) {
309- continue ;
310- }
311- auto condition_type = enable_if->getQualifier ()
312- .getAsType ()
313- ->getAs <clang::TemplateSpecializationType>();
314- if (!condition_type || condition_type->template_arguments ().empty () ||
315- condition_type->template_arguments ()[0 ].getKind () !=
316- clang::TemplateArgument::Expression) {
317- continue ;
318- }
319- auto condition = llvm::dyn_cast<clang::DependentScopeDeclRefExpr>(
320- condition_type->template_arguments ()[0 ]
321- .getAsExpr ()
322- ->IgnoreParenImpCasts ());
323- if (!condition || condition->getQualifier ().getKind () !=
324- clang::NestedNameSpecifier::Kind::Type) {
325- continue ;
326- }
327- auto same = condition->getQualifier ()
303+ auto same = type_param->getDefaultArgument ()
304+ .getArgument ()
328305 .getAsType ()
329306 ->getAs <clang::TemplateSpecializationType>();
330- if (!same || same->template_arguments ().size () != 2 ||
331- same->template_arguments ()[1 ].getKind () !=
332- clang::TemplateArgument::Type) {
307+ if (!same || !same->isTypeAlias () ||
308+ same->getTemplateName ().getAsTemplateDecl ()->getName () != " SameAs" ) {
333309 continue ;
334310 }
335311 return same->template_arguments ()[1 ].getAsType ();
0 commit comments