Author: Timm Baeder Date: 2025-05-19T17:11:34+02:00 New Revision: bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e
URL: https://github.com/llvm/llvm-project/commit/bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e DIFF: https://github.com/llvm/llvm-project/commit/bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e.diff LOG: [clang][bytecode][NFC] Simplify VisitCompoundLiteralExpr (#140547) Added: Modified: clang/lib/AST/ByteCode/Compiler.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index aa8f009f58bb9..36380543e5991 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -2922,32 +2922,22 @@ bool Compiler<Emitter>::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) { if (T && !E->isLValue()) { // For primitive types, we just visit the initializer. return this->delegate(Init); - } else { - unsigned LocalIndex; - - if (T) - LocalIndex = this->allocateLocalPrimitive(Init, *T, /*IsConst=*/false); - else if (std::optional<unsigned> MaybeIndex = this->allocateLocal(Init)) - LocalIndex = *MaybeIndex; - else - return false; + } - if (!this->emitGetPtrLocal(LocalIndex, E)) - return false; + unsigned LocalIndex; + if (T) + LocalIndex = this->allocateLocalPrimitive(Init, *T, /*IsConst=*/false); + else if (std::optional<unsigned> MaybeIndex = this->allocateLocal(Init)) + LocalIndex = *MaybeIndex; + else + 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 (!this->emitGetPtrLocal(LocalIndex, E)) + return false; - return false; + if (T) + return this->visit(Init) && this->emitInit(*T, E); + return this->visitInitializer(Init) && this->emitFinishInit(E); } template <class Emitter> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits