Author: Shafik Yaghmour
Date: 2025-05-02T14:31:32-07:00
New Revision: f313b0af15857dada7743af310229b6944fd1c61

URL: 
https://github.com/llvm/llvm-project/commit/f313b0af15857dada7743af310229b6944fd1c61
DIFF: 
https://github.com/llvm/llvm-project/commit/f313b0af15857dada7743af310229b6944fd1c61.diff

LOG: [Clang][NFC] Capture by ref to avoid copying std::string (#138231)

Static analysis flagged capturing BName by value as opposed to by
reference. Updated capture to be by reference.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/CheckerContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp 
b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
index d0145293fa3e5..1c4f08ae5dff5 100644
--- a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
@@ -67,10 +67,10 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl 
*FD,
       //   _xxxxx_
       //   ^     ^ lookbehind and lookahead characters
 
-      const auto MatchPredecessor = [=]() -> bool {
+      const auto MatchPredecessor = [&]() -> bool {
         return start <= 0 || !llvm::isAlpha(BName[start - 1]);
       };
-      const auto MatchSuccessor = [=]() -> bool {
+      const auto MatchSuccessor = [&]() -> bool {
         std::size_t LookbehindPlace = start + Name.size();
         return LookbehindPlace >= BName.size() ||
                !llvm::isAlpha(BName[LookbehindPlace]);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to