[PATCH] D69181: [clang-tidy] Adding misc-signal-terminated-thread check

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 12:53:56 PDT 2019


steakhal added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:28
+
+static Preprocessor *PP;
+
----------------
Can't we place this `PP` variable to the checker class?
Like the [[ https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h#L39 | modernize/UseTrailingReturnTypeCheck ]] does?


================
Comment at: clang-tools-extra/clang-tidy/misc/BadSignalToKillThreadCheck.cpp:35
+  const auto TryExpandAsInteger =
+      [PP = PP](Preprocessor::macro_iterator It) -> Optional<unsigned> {
+    if (It == PP->macro_end())
----------------
aaron.ballman wrote:
> This lambda capture looks suspicious -- why do you need to initialize the capture?
You are right, I forgot that `PP` is a global variable when I offered this solution.
Global variables should not be captured, so empty capture is good enough.


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