[PATCH] D41815: [clang-tidy] implement check for goto
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 12 23:22:06 PST 2018
lebedev.ri added inline comments.
================
Comment at: clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp:21
+AST_MATCHER(GotoStmt, isForwardJumping) {
+ return Node.getLocStart() < Node.getLabel()->getLocStart();
+}
----------------
Hm, on a second thought, i think this will have false-positive if the label and the goto are on the same line, like
```
goto label; ; label: ;
```
I wonder we could **easily** compare accounting for the position in the line, or it is not worth the extra complexity.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41815
More information about the cfe-commits
mailing list