[cfe-dev] [clang-tidy] Error when applying braces around single statement fix

Matthieu Brucher via cfe-dev cfe-dev at lists.llvm.org
Sat Mar 17 02:50:57 PDT 2018


Hi all,

I don't know if this was reported before (I didn't see anything online),
but the fix for this checker breaks code.
For instance:

for(int i = 0; i < size; ++i)
  for(int j = 0; j < size; ++j)
    do(i, j);

is turned into:
for(int i = 0; i < size; ++i) {
  for(int j = 0; j < size; ++j) {
    do(i, j);
  }

without the second (or third or fourth...) brace.
I suspect this is because the identical diags are removed? Is this expected
behavior? Or is there a way to fix these?

Regards,

Matthieu
-- 
Quantitative analyst, Ph.D.
Blog: http://blog.audio-tk.com/
LinkedIn: http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180317/6114749e/attachment.html>


More information about the cfe-dev mailing list