[PATCH] D69181: [clang-tidy] Adding misc-signal-terminated-thread check
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 18 11:53:40 PDT 2019
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:28
+
+namespace {
+static Preprocessor *PP;
----------------
static is enough, no need for anonymous namespace.
================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:33
+void BadSignalToKillThreadCheck::check(const MatchFinder::MatchResult &Result) {
+
+ Preprocessor::macro_iterator It = PP->macro_begin();
----------------
Unnecessary empty line.
================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:37
+ if (It->first->getName() == "SIGTERM") {
+ const auto *MI = PP->getMacroInfo(It->first);
+ const auto &T = MI->tokens().back();
----------------
Please don't use auto unless type is spelled in same statement or iterator.
================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:67
+} // namespace clang
\ No newline at end of file
----------------
Please add new line.
================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.h:40
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_BADSIGNALTOKILLTHREADCHECK_H
\ No newline at end of file
----------------
Please add new line.
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:76
+- New :doc:`misc-signal-terminated-thread
+ <clang-tidy/checks/misc-signal-terminated-thread>` check.
----------------
Please keep alphabetical order in new checks list.
================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:79
+
+ Do not send an uncaught signal to kill a thread because the signal kills the entire process, not just the individual thread.
+ To learn more about this rule please visit the following page:
----------------
Please synchronize with first sentence in documentation. Link belongs to documentation.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-bad-signal-to-kill-thread.rst:8
+terminated by ``SIGTERM`` signal.
+.. code-block: c++
+
----------------
Please separate with empty line.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-bad-signal-to-kill-thread.rst:11
+ pthread_kill(thread, SIGTERM);
\ No newline at end of file
----------------
Please add new line.
================
Comment at: clang-tools-extra/test/clang-tidy/misc-bad-signal-to-kill-thread.cpp:31
+}
\ No newline at end of file
----------------
Please add new line.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69181/new/
https://reviews.llvm.org/D69181
More information about the cfe-commits
mailing list