[PATCH] D41815: [clang-tidy] implement check for goto

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 08:27:35 PST 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp:43
+
+  // Backward jumps are diagnosed in all language modes. Forward jumps
+  // are sometimes required in C to free resources or do other clean-up
----------------
aaron.ballman wrote:
> I think that this check should be C++ only. C makes far more use of `goto`, and backwards jumps are not always bad there (they don't have to consider things like destructors or RAII like you do in C++).
> 
> Esp since this is a check for the C++ core guidelines and HICPP (both are C++ standards). 
Ok. I merged the matchers too.


================
Comment at: docs/ReleaseNotes.rst:67-68
 
+- New `cppcoreguidelines-avoid-goto
+  <http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-avoid-goto.html>`_ check
+
----------------
aaron.ballman wrote:
> I think you should also add the HICPP changes as well, given that this check also covers that rule.
I think `Only forward jumps in nested loops are accepted.` covers it, but i reformulated it.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41815





More information about the cfe-commits mailing list