When a statement contains a line continuation, google-readability-braces-around-statements creates invalid code when fixit is applied. Original code: #include <stdio.h> void f(int i) { if (i > 0) printf("This is one line\n\ This is another line.\n\ This is yet another line.\n"); } Code as modified by clang-tidy: #include <stdio.h> void f(int i) { if (i > 0) { printf("This is one line\n\ This is another line.\n\ This is yet another line.\n") }; } Correct code should be: #include <stdio.h> void f(int i) { if (i > 0) { printf("This is one line\n\ This is another line.\n\ This is yet another line.\n"); } }
A smaller repro: $ cat /tmp/q.cc void f(const char *p) { if (!p) f("\ "); } $ clang_tidy -checks=-*,google-readability-braces-around-statements -fix /tmp/q.cc -- 1 warning generated. /tmp/q.cc:2:10: warning: statement should be inside braces [google-readability-braces-around-statements] if (!p) ^ /tmp/q.cc:2:10: note: FIX-IT applied suggested code changes /tmp/q.cc:4:3: note: FIX-IT applied suggested code changes "); ^ clang-tidy applied 2 of 2 suggested fixes. $ cat /tmp/q.cc void f(const char *p) { if (!p) { f("\ ") }; }
Paweł's patch addressing this is in review here: https://reviews.llvm.org/D30748.