<div dir="ltr">Hello!<div><br></div><div>Apologies for the late reply, but in case it's helpful, it looks like the following may be a good (though moderately verbose) starting point :)</div><div><br></div><div>declRefExpr(hasType(pointsTo(<wbr>templateSpecializationType(<wbr>hasDeclaration(<br></div><div> typeAliasTemplateDecl(<wbr>hasName("Addr32")))))))</div><div><br></div><div><br></div><div>George</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 25, 2017 at 3:54 AM, Patrik Eklöf via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="SV" link="#0563C1" vlink="#954F72"><div class="m_-7971732966911118030WordSection1"><p class="MsoNormal">Hi,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span lang="EN-GB">I’m trying to match certain expressions with clang-tidy, see code:<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">template</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">typename</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2b91af">T</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">using</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"> </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Addr32</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"> = </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2b91af">T</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">;<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Addr32</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">>* p32 = </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">nullptr</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">;<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">* p64 = p32; </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:green">// I want to match this</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black">* pTestNative = p64; </span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:green">// I don't want to match this</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> main()<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">{<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">}<u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-GB">So I want to match any DeclRefExpr whose type is Addr32<T>, but I can’t figure out how.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-GB">The closest I’ve gotten using clang-query is match declRefExpr(hasType( asString("Addr32<int> *") )), but I don’t want to have the specify the type int. I want to match all possible types Addr32<T>.<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-GB">Any ideas?<u></u><u></u></span></p><div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0cm 0cm 1.0pt 0cm"><p class="MsoNormal" style="margin-top:12.0pt;page-break-after:avoid;border:none;padding:0cm"><a name="m_-7971732966911118030__Toc454264584"><span style="font-size:16.0pt;color:#a5a5a5">Regards,</span></a><span></span><span style="font-size:16.0pt;font-family:"Calibri Light",sans-serif;color:#a5a5a5"><u></u><u></u></span></p></div><table class="m_-7971732966911118030MsoTableGrid" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse;border:none"><tbody><tr><td width="302" valign="top" style="width:226.55pt;padding:0cm 5.4pt 0cm 5.4pt"></td><td width="302" valign="top" style="width:226.55pt;padding:0cm 5.4pt 0cm 5.4pt"></td></tr></tbody></table><p class="MsoNormal" style="margin-bottom:10.0pt;line-height:120%"><b><span style="font-size:8.5pt;line-height:120%;font-family:"Arial",sans-serif;color:#2a2a2a">Patrik Eklöf</span></b><span><br></span><span style="font-size:8.5pt;line-height:120%;font-family:"Arial",sans-serif;color:#2a2a2a">Programmer</span><span><br></span><u><span style="font-size:8.5pt;line-height:120%;font-family:"Arial",sans-serif;color:#00b050"><a href="mailto:patrik.eklof@vmssoftware.com" target="_blank"><span style="color:blue">patrik.eklof@vmssoftware.com</span></a><u></u><u></u></span></u></p><p class="MsoNormal"><span><img border="0" width="150" height="41" style="width:1.5625in;height:.427in" id="m_-7971732966911118030Picture_x0020_1" src="cid:image001.gif@01D2BDC1.B75ED930" alt="cid:BE4BF572-C003-4AAA-B3E1-F94F88D12D24@netgear.local"></span><span lang="EN-GB" style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u><u></u></span></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;color:black"><br>VMS Software, inc.</span></b><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;color:black"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8.5pt;font-family:"Arial,";color:#2a2a2a">Skeppsgatan 19, SE-211 11 Malmö Sweden</span><span><br></span><u><span style="font-size:8.5pt;font-family:"Arial",sans-serif;color:#00b050"><a href="http://vmssoftware.com/" target="_blank"><span style="color:blue">http://vmssoftware.com/</span></a></span></u><span><u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">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/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>