Author: Simon Pilgrim
Date: 2024-06-28T18:54:36+01:00
New Revision: dac366111e5560c117a06330efee14a2052d3a46

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

LOG: [Sema] LambdaScopeForCallOperatorInstantiationRAII - fix typo in early out 
logic (#96888)

We should be checking for a failed dyn_cast on the ParentFD result - not the 
loop invariant FD root value.

Seems to have been introduced in #65193

Noticed by static analyser (I have no specific test case).

Added: 
    

Modified: 
    clang/lib/Sema/SemaLambda.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index e9476a0c93c5d..ca9c7cb9faadf 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -2391,7 +2391,7 @@ Sema::LambdaScopeForCallOperatorInstantiationRAII::
       Pattern =
           dyn_cast<FunctionDecl>(getLambdaAwareParentOfDeclContext(Pattern));
 
-      if (!FD || !Pattern)
+      if (!ParentFD || !Pattern)
         break;
 
       SemaRef.addInstantiatedParametersToScope(ParentFD, Pattern, Scope, 
MLTAL);


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

Reply via email to