[PATCH] D41815: [clang-tidy] implement check for goto
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 11 05:12:23 PST 2018
lebedev.ri added a comment.
In https://reviews.llvm.org/D41815#973260, @JonasToth wrote:
> - check that jumps will only be forward. AFAIK that is required in all sensefull usecases of goto, is it?
You could implement loops/recursion with goto, something like:
const int end = 10;
int i = 0;
assert(i < end);
begin:
<do stuff>
i++
if(i < end)
goto begin;
// end
But it really should be done with normal `for()`, or `while()`, so i think it would make sense to diagnose those.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41815
More information about the cfe-commits
mailing list