[clang] e9499e8 - [clang][bytecode][NFC] Remove some unnecessary if statements (#157329)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 7 09:55:52 PDT 2025
Author: Timm Baeder
Date: 2025-09-07T18:55:48+02:00
New Revision: e9499e82edafe2dc9f7475ff6cf321ba73206acc
URL: https://github.com/llvm/llvm-project/commit/e9499e82edafe2dc9f7475ff6cf321ba73206acc
DIFF: https://github.com/llvm/llvm-project/commit/e9499e82edafe2dc9f7475ff6cf321ba73206acc.diff
LOG: [clang][bytecode][NFC] Remove some unnecessary if statements (#157329)
We already checked that `IsStatic` is true above.
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 d4e10b32c470c..0a1a95d663fbd 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2918,19 +2918,13 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
const LifetimeExtendedTemporaryDecl *TempDecl =
E->getLifetimeExtendedTemporaryDecl();
- if (IsStatic)
- assert(TempDecl);
+ assert(TempDecl);
if (SubExprT) {
if (!this->visit(SubExpr))
return false;
- if (IsStatic) {
- if (!this->emitInitGlobalTemp(*SubExprT, *GlobalIndex, TempDecl, E))
- return false;
- } else {
- if (!this->emitInitGlobal(*SubExprT, *GlobalIndex, E))
- return false;
- }
+ if (!this->emitInitGlobalTemp(*SubExprT, *GlobalIndex, TempDecl, E))
+ return false;
return this->emitGetPtrGlobal(*GlobalIndex, E);
}
@@ -2941,9 +2935,7 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
return false;
if (!this->visitInitializer(SubExpr))
return false;
- if (IsStatic)
- return this->emitInitGlobalTempComp(TempDecl, E);
- return true;
+ return this->emitInitGlobalTempComp(TempDecl, E);
}
// For everyhing else, use local variables.
More information about the cfe-commits
mailing list