[PATCH] D33825: [clang-tidy] signal handler must be plain old function check

Tibor Brunner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 29 06:40:36 PDT 2020


bruntib added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cert-signal-handler-must-be-plain-old-function.cpp:22
+  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: do not use C++ constructs in signal handlers [cert-msc54-cpp]
+  // CHECK-MESSAGES: :[[@LINE+1]]:3: note: C++ construct used here
+  throw "error message";
----------------
jfb wrote:
> "C++ construct" isn't particularly useful. Here it needs to call out throwing exceptions.
Thanks for the review!
I think the clang-tidy message is understandable, because the next line after "note: C++ construct used here" displays the exact source location where this C++ construct is used. I included this line in the test file so it is visible here. The full message looks like this:

llvm-project/clang-tools-extra/test/clang-tidy/checkers/cert-signal-handler-must-be-plain-old-function.cpp:20:17: warning: do not use C++ constructs in signal handlers [cert-msc54-cpp]
extern "C" void cpp_signal_handler(int sig) {
                ^
llvm-project/clang-tools-extra/test/clang-tidy/checkers/cert-signal-handler-must-be-plain-old-function.cpp:23:3: note: C++ construct used here
  throw "error message";
  ^

Do you think it's enough, or should the note text be different for all C++ constructs?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D33825/new/

https://reviews.llvm.org/D33825



More information about the cfe-commits mailing list