<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This would be an awesome topic for a talk or tutorial at one of the semi-annual LLVM Developer Meetings.  Just saying.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> cfe-dev [mailto:cfe-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>Michael Jabbour via cfe-dev<br>
<b>Sent:</b> Wednesday, July 11, 2018 11:07 AM<br>
<b>To:</b> Manuel Klimek<br>
<b>Cc:</b> Clang Dev<br>
<b>Subject:</b> Re: [cfe-dev] ignoring*() and hasParent() matchers<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>I am certainly planning to invest some time writing blog posts/scripts to make clang-tidy checks easier to use. Giving a talk seems a bit impossible in the near future, as there isn't much interest in clang in my local community (hope that this changes).<o:p></o:p></p>
<p>Also, I have written <a href="https://github.com/micjabbour/pronto-clang_format">
some</a> <a href="https://github.com/micjabbour/pronto-clang_tidy">scripts</a> (that are meant to be used in continuous integration) to get clang-tidy/clang-format output as comments in popular web-based git repo managers (e.g. github, gitlab, bitbucket, ...).
 This can help enforce some coding conventions when reviewing code changes. Here is a screenshot on gitlab (I'll be deploying this into production soon):<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><img border="0" width="998" height="454" id="_x0000_i1025" src="cid:image001.png@01D4190D.E6E73B90"><o:p></o:p></p>
<p>Sorry for the long email, Just wanted to share my enthusiasm :D<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks again,<br>
Mike<o:p></o:p></p>
<div>
<p class="MsoNormal">On 07/07/2018 6:04 PM, Manuel Klimek wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks! You can pay that back by giving a talk about clang tooling from a user's point of view at some point, as you seem to have mastered the subject :)<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On Sat, 7 Jul 2018, 17:23 Michael Jabbour, <<a href="mailto:micjabbour@gmail.com">micjabbour@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p>Thanks for the confirmation. I have learned a lot from your great talks/presentations :-)<o:p></o:p></p>
<p>Thanks,<o:p></o:p></p>
<p>Mike<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 06/07/2018 11:03 AM, Manuel Klimek wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">That's what I'd do, too.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, 6 Jul 2018, 00:50 Michael Jabbour via cfe-dev, <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p>I ended up writing my matcher like this:<o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">integerLiteral(</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>  expr().bind("literal"),       //inline bind call using a redundant node matcher</tt><br>
<tt>  hasAncestor(                  //climb up the AST to the nearest varDecl ancestor</tt><br>
<tt>    varDecl(hasInitializer(ignoringParenCasts(equalsBoundNode("literal"))))    //check that this varDecl satisfies the original condition</tt><br>
<tt>  )</tt><br>
<tt>)</tt></span><o:p></o:p></p>
<p>Any feedback is appreciated, as I am completely new to LibTooling...<o:p></o:p></p>
<p>P.S.: The actual matcher I am working on is far more complicated. Inverting it (i.e. using my very first example) would result in much more difficult problems. Although this seems like a roundabout hack, it might be effective when nested inside matchers
 that have already been tested<o:p></o:p></p>
<p>Thanks,<o:p></o:p></p>
<p>Mike<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 05/07/2018 7:31 PM, Michael Jabbour wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Hello all,<o:p></o:p></p>
<p>When using has*() it is sometimes desirable to use ignoringParenCasts(), for example (from the docs):<o:p></o:p></p>
<pre style="background:white;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px"><span style="color:#222222">varDecl(hasInitializer(ignoringParenCasts(integerLiteral())))<o:p></o:p></span></pre>
<p>Is there any way to get the same effect when hasParent(), e.g.:<o:p></o:p></p>
<pre style="background:white;font-variant-ligatures:normal;font-variant-caps:normal;text-align:start;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px"><span style="color:#222222">integerLiteral(hasParent(ignoringParenCasts(varDecl())))<o:p></o:p></span></pre>
<p>Obviously this does not work, but what is the best way to achieve a similar effect?<o:p></o:p></p>
<p>cheers,<o:p></o:p></p>
<p>Mike<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<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" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p>
</blockquote>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>