Author: Simon Pilgrim
Date: 2022-02-11T15:09:44Z
New Revision: f162036fcd065d34a7f0e2c9279bc79bf7db0f14

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

LOG: [clang] RewriteModernObjC::SynthBlockInitExpr - remove block nullptr check

All paths have already dereferenced the block pointer

Added: 
    

Modified: 
    clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp 
b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index b4487f0047155..1eb6b835e2d01 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -5356,16 +5356,15 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr 
*Exp,
       Exp = new (Context) DeclRefExpr(*Context, FD, false, FD->getType(),
                                       VK_LValue, SourceLocation());
       bool isNestedCapturedVar = false;
-      if (block)
-        for (const auto &CI : block->captures()) {
-          const VarDecl *variable = CI.getVariable();
-          if (variable == ND && CI.isNested()) {
-            assert (CI.isByRef() &&
-                    "SynthBlockInitExpr - captured block variable is not 
byref");
-            isNestedCapturedVar = true;
-            break;
-          }
+      for (const auto &CI : block->captures()) {
+        const VarDecl *variable = CI.getVariable();
+        if (variable == ND && CI.isNested()) {
+          assert(CI.isByRef() &&
+                 "SynthBlockInitExpr - captured block variable is not byref");
+          isNestedCapturedVar = true;
+          break;
         }
+      }
       // captured nested byref variable has its address passed. Do not take
       // its address again.
       if (!isNestedCapturedVar)


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

Reply via email to