https://github.com/RKSimon created 
https://github.com/llvm/llvm-project/pull/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).

>From 3194b593fbb50ee20b9f7d73beef4472657e6e00 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-...@redking.me.uk>
Date: Thu, 27 Jun 2024 11:09:32 +0100
Subject: [PATCH] [Sema] LambdaScopeForCallOperatorInstantiationRAII - fix typo
 in early out logic

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).
---
 clang/lib/Sema/SemaLambda.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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