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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 09:19:28 PDT 2017


aaron.ballman added a comment.

Aside from a few small nits, this looks reasonable. Have you run it over any large code bases that use signals to test the quality of the check?



================
Comment at: docs/clang-tidy/checks/cert-msc54-cpp.rst:23
+    extern "C" void cpp_signal_handler(int sig) {
+      // warning: do not use C++ representations in signal handlers
+      throw "error message";
----------------
The warning text should match the actual warning.


================
Comment at: test/clang-tidy/cert-signal-handler-must-be-plain-old-function.cpp:56-57
+  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: do not call functions with C++ constructs in signal handlers [cert-msc54-cpp]
+  // CHECK-MESSAGES: :[[@LINE-11]]:3: note: function called here
+  // CHECK-MESSAGES: :[[@LINE-23]]:3: note: C++ construct used here
+  recursive_function();
----------------
Can you move these to be closer to where the actual note appears? It makes it easier to ensure that the diagnostic appears on the proper line.


Repository:
  rL LLVM

https://reviews.llvm.org/D33825





More information about the cfe-commits mailing list