[clang] [analyzer][NFC] Substitute operator() with lambda in StreamChecker (PR #69844)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 21 06:50:00 PDT 2023
================
@@ -407,23 +407,15 @@ class StreamChecker : public Checker<check::PreCall, eval::Call,
/// Generate a message for BugReporterVisitor if the stored symbol is
/// marked as interesting by the actual bug report.
- // FIXME: Use lambda instead.
- struct NoteFn {
- const BugType *BT_ResourceLeak;
- SymbolRef StreamSym;
- std::string Message;
-
- std::string operator()(PathSensitiveBugReport &BR) const {
- if (BR.isInteresting(StreamSym) && &BR.getBugType() == BT_ResourceLeak)
- return Message;
-
- return "";
- }
- };
-
const NoteTag *constructNoteTag(CheckerContext &C, SymbolRef StreamSym,
const std::string &Message) const {
- return C.getNoteTag(NoteFn{&BT_ResourceLeak, StreamSym, Message});
+ return C.getNoteTag(
+ [this, StreamSym, Message](PathSensitiveBugReport &BR) -> std::string {
+ if (BR.isInteresting(StreamSym) &&
+ &BR.getBugType() == &(this->BT_ResourceLeak))
----------------
steakhal wrote:
```suggestion
&BR.getBugType() == &BT_ResourceLeak)
```
https://github.com/llvm/llvm-project/pull/69844
More information about the cfe-commits
mailing list