[clang] [clang][bytecode][NFC] Simplify VisitCompoundLiteralExpr (PR #140547)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 07:25:45 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/140547.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3-10) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index aa8f009f58bb9..a8687044ca4d5 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2935,16 +2935,9 @@ bool Compiler<Emitter>::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
     if (!this->emitGetPtrLocal(LocalIndex, E))
       return false;
 
-    if (T) {
-      if (!this->visit(Init)) {
-        return false;
-      }
-      return this->emitInit(*T, E);
-    } else {
-      if (!this->visitInitializer(Init) || !this->emitFinishInit(E))
-        return false;
-    }
-    return true;
+    if (T)
+      return this->visit(Init) && this->emitInit(*T, E);
+    return this->visitInitializer(Init) && this->emitFinishInit(E);
   }
 
   return false;

``````````

</details>


https://github.com/llvm/llvm-project/pull/140547


More information about the cfe-commits mailing list