https://github.com/benshi001 created https://github.com/llvm/llvm-project/pull/69844
None >From 0e8edd8448b0bacfaf35f415a5760d5d1a3aabb7 Mon Sep 17 00:00:00 2001 From: Ben Shi <benn...@tencent.com> Date: Sat, 21 Oct 2023 21:33:50 +0800 Subject: [PATCH] [analyzer][NFC] Substitute operator() with lambda in StreamChecker --- .../StaticAnalyzer/Checkers/StreamChecker.cpp | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp index bad86682c91e25f..76df39cb37bd985 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp @@ -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)) + return Message; + return ""; + }); } const NoteTag *constructSetEofNoteTag(CheckerContext &C, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits