[PATCH] D118370: [clang-tidy] bugprone-signal-handler: Code refactor (NFC)
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 28 08:37:56 PST 2022
balazske marked 2 inline comments as done.
balazske added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:151
CallGraphNode *HandlerNode = CG.getNode(HandlerDecl);
- // Signal handler can be external but not unsafe, no call graph in this case.
- if (!HandlerNode)
- return;
+ assert(HandlerNode &&
+ "Handler has body, should be present in the call graph.");
----------------
balazske wrote:
> There are problems with this approach in C++ code.
The call graph adds nodes for the canonical declaration only. When getting a node it works only with the CanonicalDecl unless the `CallGraph` code is changed (it seems to be worth to do this change).
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:167
+ const Expr *CallOrRef) {
+ const bool FunctionIsCalled = isa<CallExpr>(CallOrRef);
+
----------------
njames93 wrote:
> This can probably just be inlined into its only use.
The value is used now multiple times. (But maybe the `diag` call can be put into a lambda later.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118370/new/
https://reviews.llvm.org/D118370
More information about the cfe-commits
mailing list