Skip to content

Commit e9499e8

Browse files
authored
[clang][bytecode][NFC] Remove some unnecessary if statements (#157329)
We already checked that `IsStatic` is true above.
1 parent 7bc342e commit e9499e8

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,19 +2918,13 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
29182918

29192919
const LifetimeExtendedTemporaryDecl *TempDecl =
29202920
E->getLifetimeExtendedTemporaryDecl();
2921-
if (IsStatic)
2922-
assert(TempDecl);
2921+
assert(TempDecl);
29232922

29242923
if (SubExprT) {
29252924
if (!this->visit(SubExpr))
29262925
return false;
2927-
if (IsStatic) {
2928-
if (!this->emitInitGlobalTemp(*SubExprT, *GlobalIndex, TempDecl, E))
2929-
return false;
2930-
} else {
2931-
if (!this->emitInitGlobal(*SubExprT, *GlobalIndex, E))
2932-
return false;
2933-
}
2926+
if (!this->emitInitGlobalTemp(*SubExprT, *GlobalIndex, TempDecl, E))
2927+
return false;
29342928
return this->emitGetPtrGlobal(*GlobalIndex, E);
29352929
}
29362930

@@ -2941,9 +2935,7 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
29412935
return false;
29422936
if (!this->visitInitializer(SubExpr))
29432937
return false;
2944-
if (IsStatic)
2945-
return this->emitInitGlobalTempComp(TempDecl, E);
2946-
return true;
2938+
return this->emitInitGlobalTempComp(TempDecl, E);
29472939
}
29482940

29492941
// For everyhing else, use local variables.

0 commit comments

Comments
 (0)