aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-19 17:11:34 +0200
committerGitHub <noreply@github.com>2025-05-19 17:11:34 +0200
commitbb92c80dbb09e4d958d8c3c6bfc21570916d5f0e (patch)
tree8eff8a345a6230549ee51ca4f872d44535f5128c /clang/lib/AST/ByteCode/Compiler.cpp
parentdc25ab389c2d441ba378d4db56a4a61e3eedb889 (diff)
downloadllvm-bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e.zip
llvm-bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e.tar.gz
llvm-bb92c80dbb09e4d958d8c3c6bfc21570916d5f0e.tar.bz2
[clang][bytecode][NFC] Simplify VisitCompoundLiteralExpr (#140547)
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index aa8f009..3638054 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>