[PATCH] D41815: [clang-tidy] implement check for goto
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 01:38:15 PST 2018
JonasToth created this revision.
JonasToth added reviewers: aaron.ballman, alexfh, hokein.
Herald added subscribers: cfe-commits, kbarton, xazax.hun, mgorny, nemanjai, klimek.
The usage of `goto` is discourage in C++ since forever. This check implements
a warning for every `goto`. Even though there are (rare) valid use cases for
`goto`, better high level constructs should be used.
`goto` is used sometimes in C programs to free resources at the end of
functions in the case of errors. This pattern is better implemented with
RAII in C++.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41815
Files:
clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp
clang-tidy/cppcoreguidelines/AvoidGotoCheck.h
clang-tidy/cppcoreguidelines/CMakeLists.txt
clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
docs/ReleaseNotes.rst
docs/clang-tidy/checks/cppcoreguidelines-avoid-goto.rst
docs/clang-tidy/checks/list.rst
test/clang-tidy/cppcoreguidelines-avoid-goto.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41815.128896.patch
Type: text/x-patch
Size: 6616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180108/72fc8f2b/attachment.bin>
More information about the cfe-commits
mailing list