<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Andy,</p>
<p><br>
</p>
<p>this sounds like a great clang-tidy check in the
readability-module. You can check out the documentation
(<a class="moz-txt-link-freetext" href="https://clang.llvm.org/extra/clang-tidy/">https://clang.llvm.org/extra/clang-tidy/</a>) which has a section on
writing the check and emitting diagnostics with fixits.</p>
<p><br>
</p>
<p>If you want to produce a standalone tool that does the job, this
information will still be relevant, is it will use the same
functionality of clang.</p>
<p><br>
</p>
<p>Best, Jonas</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 12.12.18 um 11:03 schrieb Andy Gibbs
via cfe-dev:<br>
</div>
<blockquote type="cite"
cite="mid:AM6PR0702MB36064BFE5553F2709110D19FE7A70@AM6PR0702MB3606.eurprd07.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
I'd like to add a fixit (or two) to suggest parentheses in the
following expressions:</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<div style="color: #000000;background-color:
#fffffe;font-family: Consolas, ">
<div><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;"> struct</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> S {
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">float</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> value; };</span></div>
<div><span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> S
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">operator</span><span style="color:
rgb(163, 21, 21); font-family: Consolas, Courier,
monospace; font-size: 10pt; line-height: normal;">""</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> _f(</span><span
style="color: rgb(0, 0, 255); font-family: Consolas,
Courier, monospace; font-size: 10pt; line-height: normal;">long</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">double</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> t);</span></div>
<br>
<div><span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">void</span><span style="font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;"> test() {</span></div>
<div><span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">int</span><span style="font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;"> i =
</span><span style="color: rgb(48, 48, 192); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">0x2e</span><span style="font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">+</span><span style="color: rgb(163,
21, 21); font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">'a'</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">; //
fixit: (0x2e)+'a'<br>
</span></div>
<span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt; line-height:
normal;">float</span><span style="font-family: Consolas,
Courier, monospace; font-size: 10pt; line-height: normal;">
j =
</span><span style="color: rgb(9, 136, 90); font-family:
Consolas, Courier, monospace; font-size: 10pt; line-height:
normal;">100.0</span><span style="font-family: Consolas,
Courier, monospace; font-size: 10pt; line-height: normal;">_e-</span><span
style="color: rgb(9, 136, 90); font-family: Consolas,
Courier, monospace; font-size: 10pt; line-height: normal;">10.0</span><span
style="font-family: Consolas, Courier, monospace; font-size:
10pt; line-height: normal;">; // fixit: (100.0_e)-10.0<br>
</span>
<div><span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">float</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> k =
</span><span style="color: rgb(9, 136, 90); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">100.0</span><span
style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">_f.value; //
fixit: (100.0_f).value<br>
</span></div>
<div><span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;">
</span><span style="color: rgb(0, 0, 255); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">int</span><span style="font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;"> l =
</span><span style="color: rgb(48, 48, 192); font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">0x2e</span><span style="font-family:
Consolas, Courier, monospace; font-size: 10pt;
line-height: normal;">+i; // fixit: (0x2e)+i<br>
</span></div>
<div><span></span></div>
</div>
<span style="font-family: Consolas, Courier, monospace;
font-size: 10pt; line-height: normal;"> }</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
However, I am not sure of the correct way to do this.</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Would someone, please, give me a quick tutorial or, if easier,
point out an similar example in the clang code.</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Many thanks,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
Andy<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
</body>
</html>