[PATCH] [clang-tidy] Add check misc-braces-around-statements.

Marek Kurdej curdeius at gmail.com
Tue Sep 30 07:27:01 PDT 2014


I wanted to apply your suggestion about skip functions, but stumbled upon a new problem: how should we handle macros when searching for brace location (in skip function)?
They are not expanded on the moment when clang-tidy runs over the file, so how can I expand them to check if they're empty?
I tried `Token::hasLeadingEmptyMacro()`, but it doesn't work as I expected.

================
Comment at: test/clang-tidy/misc-braces-around-statements.cpp:179
@@ +178,3 @@
+  // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
+  // CHECK-FIXES: if (1) { while (2) { if (3) { for (;;) { do { ; } while(false) /**/;
+  // CHECK-FIXES-NEXT: }
----------------
alexfh wrote:
> What happens with the comment that was after the semicolon? Could you please add it to the appropriate check line?
I deleted it somehow. Restored.

http://reviews.llvm.org/D5395






More information about the cfe-commits mailing list