[PATCH] D70638: [Diagnostic] add a warning which warns about misleading indentation
Dave Lee via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 7 12:00:19 PST 2021
kastiglione added a comment.
@Tyker Hi, I noticed a case that isn't caught by `-Wmisleading-indentation`. In code that uses two space indents, there's a corner case that isn't caught when the preceding `if` uses curly braces. I've noticed a couple instances of this in lldb.
For example:
if (cond) {
then1();
then2();
// ...
} else
else1();
else2();
The `else2();` statement doesn't trigger the warning.
It seems that the logic is to use the column of the `else` keyword, not the column of the right brace. When using a four space indent (any indent != 2), the warning is emitted:
} else
else1();
else2();
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70638/new/
https://reviews.llvm.org/D70638
More information about the cfe-commits
mailing list