<div dir="ltr"><div><span style="font-family:monospace">This works for me:</span></div><span style="font-family:monospace">loc(qualType(hasDeclaration(classTemplateDecl(hasName("std::enable_if")))))<br>
<br></span></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Apr 20, 2018 at 12:21 AM David Lai via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_679957527277289424WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">Hi,</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">I am trying to write a matcher to change</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">template <typename T></span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">typename std::enable_if<std::is_reference<T>::value, bool>::type is_ref() { return true; }</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black">to </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">template <typename T></span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">std::enable_if_t<std::is_reference<T>::value, bool> is_ref() { return true; }</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">I have been struggling to write a match for the “typename std::enable_if…” line.</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">I am able to match the template <…> line using “typeAliasTemplateDecl” and perhaps just retrieve the next line and check if it has “typename …”.</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">I was wondering if you could give me pointers to write a better matcher?</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">Thanks,</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129">David Lai</span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:Helvetica;color:#1d2129"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:black"> </span><span style="color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><u></u> <u></u></span></p>
</div>
</div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>