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

Alexander Kornienko alexfh at google.com
Tue Sep 30 07:49:47 PDT 2014


>>! In D5395#30, @curdeius wrote:
> 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)?

I think, you could iterate over all tokens located from after the WS->getCond()->getLocEnd(), but before the WS->getBody()->getLocStart(). If the first non-comment and non-whitespace token you find is not a closing parenthesis, you can bail out, because something weird is going on. I don't think you'll need to handle macros here.

> They are not expanded on the moment when clang-tidy runs over the file, 

This is not exactly true, but it doesn't matter for our problem.

> so how can I expand them to check if they're empty?
> I tried `Token::hasLeadingEmptyMacro()`, but it doesn't work as I expected.

http://reviews.llvm.org/D5395






More information about the cfe-commits mailing list