<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-03-12 19:39 GMT+00:00 Aaron Ballman via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Mar 12, 2018 at 3:34 PM, Richard via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> [Please reply *only* to the list and do not include my email directly<br>
> in the To: or Cc: of your reply; otherwise I will not see your reply.<br>
> Thanks.]<br>
><br>
> In article <<wbr>CAAt6xTvjSPEg7OVPWVbtqWdsDp5zj<wbr>a9_TfLTkdzoNoksmEr=<a href="mailto:KQ@mail.gmail.com">KQ@mail.<wbr>gmail.com</a>>,<br>
>     Aaron Ballman via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> writes:<br>
><br>
>> I believe the matcher you're looking for is:<br>
>> varDecl(hasType(references(<wbr>qualType(isConstQualified())))<wbr>)<br>
>><br>
>> For example, given:<br>
>><br>
>> void f1() {<br>
>>   try {<br>
>>   } catch (int &e) {<br>
>>   }<br>
>> }<br>
>><br>
>> void f2() {<br>
>>   try {<br>
>>   } catch (const int &e) {<br>
>>   }<br>
>> }<br>
>><br>
>> produces:<br>
>><br>
>> clang-query> match<br>
>> varDecl(hasType(references(<wbr>qualType(isConstQualified())))<wbr>)<br>
>><br>
>> Match #1:<br>
>><br>
>> C:\Users\Aaron\Desktop\test.<wbr>cpp:9:12: note: "root" binds here<br>
>>   } catch (const int &e) {<br>
>>            ^~~~~~~~~~~~<br>
>> 1 match.<br>
><br>
> I think they want to match the catches that aren't const qualified, so<br>
> it might be (untested):<br>
><br>
> varDecl(hasType(references(<wbr>qualType(not(isConstQualified(<wbr>))))))<br>
<br>
</div></div>Ah, oops, I didn't see that I had the predicate reversed. Your matcher<br>
is close, but instead of not(), you use unless().<br>
<br>
~Aaron<br>
<div class="HOEnZb"><div class="h5"><br>
> --<br>
> "The Direct3D Graphics Pipeline" free book <<a href="http://tinyurl.com/d3d-pipeline" rel="noreferrer" target="_blank">http://tinyurl.com/d3d-<wbr>pipeline</a>><br>
>             The Terminals Wiki <<a href="http://terminals-wiki.org" rel="noreferrer" target="_blank">http://terminals-wiki.org</a>><br>
>      The Computer Graphics Museum <<a href="http://ComputerGraphicsMuseum.org" rel="noreferrer" target="_blank">http://<wbr>ComputerGraphicsMuseum.org</a>><br>
>   Legalize Adulthood! (my blog) <<a href="http://LegalizeAdulthood.wordpress.com" rel="noreferrer" target="_blank">http://LegalizeAdulthood.<wbr>wordpress.com</a>><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>
______________________________<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>
</div></div></blockquote></div><div class="gmail_extra"><br></div>Excellent! I thought I had to use the catch statement, but this is indeed far better.</div><div class="gmail_extra">I guess you have to know the AST matcher expressions... Are there tutorials on top of the doxygen doc? Or perhaps even books?<br><br clear="all"><div>Regards,</div><div><br></div><div>Matthieu</div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Quantitative analyst, Ph.D.<br>Blog: <a href="http://blog.audio-tk.com/" target="_blank">http://blog.audio-tk.com/</a><br>LinkedIn: <a href="http://www.linkedin.com/in/matthieubrucher" target="_blank">http://www.linkedin.com/in/matthieubrucher</a></div></div></div></div></div>
</div></div>