[PATCH] D91164: [clang-tidy] Improve C++ support in bugprone-signal-handler.
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 1 10:18:59 PST 2021
njames93 added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:100-101
const LangOptions &LangOpts) const {
- // FIXME: Make the checker useful on C++ code.
- if (LangOpts.CPlusPlus)
+ // FIXME: Improve C++ support.
+ if (LangOpts.CPlusPlus17)
return false;
----------------
What happens differently in c++17 and later?
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:137
+ if (!HandlerDecl->isExternC()) {
+ reportNonExternCBug(HandlerExpr, HandlerDecl);
----------------
Why can't c++ linkage functions be used a signal handlers.
This is also not sticking to the documentation of this check. Ths documentation just lists that it guards against non asynchronous-safe functions being called from signal handlers.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:241-242
+void SignalHandlerCheck::reportLambdaBug(const Expr *HandlerRef) {
+ diag(HandlerRef->getBeginLoc(),
+ "lambda expression is not allowed as signal handler");
+}
----------------
Why can't lambdas be used as signal handlers, If they are stateless they can be implicitly converted to function pointers. Or is this something about needing C linkage?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91164/new/
https://reviews.llvm.org/D91164
More information about the cfe-commits
mailing list