Skip to content

Commit 2c00df3

Browse files
authored
[clang][bytecode][NFC] Remove LabelScope (#151498)
It did almost nothing
1 parent dcc71f2 commit 2c00df3

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,14 @@ bool InitLink::emit(Compiler<Emitter> *Ctx, const Expr *E) const {
106106
return true;
107107
}
108108

109-
/// Scope managing label targets.
110-
template <class Emitter> class LabelScope {
111-
public:
112-
virtual ~LabelScope() {}
113-
114-
protected:
115-
LabelScope(Compiler<Emitter> *Ctx) : Ctx(Ctx) {}
116-
/// Compiler instance.
117-
Compiler<Emitter> *Ctx;
118-
};
119-
120109
/// Sets the context for break/continue statements.
121-
template <class Emitter> class LoopScope final : public LabelScope<Emitter> {
110+
template <class Emitter> class LoopScope final {
122111
public:
123112
using LabelTy = typename Compiler<Emitter>::LabelTy;
124113
using OptLabelTy = typename Compiler<Emitter>::OptLabelTy;
125114

126115
LoopScope(Compiler<Emitter> *Ctx, LabelTy BreakLabel, LabelTy ContinueLabel)
127-
: LabelScope<Emitter>(Ctx), OldBreakLabel(Ctx->BreakLabel),
116+
: Ctx(Ctx), OldBreakLabel(Ctx->BreakLabel),
128117
OldContinueLabel(Ctx->ContinueLabel),
129118
OldBreakVarScope(Ctx->BreakVarScope),
130119
OldContinueVarScope(Ctx->ContinueVarScope) {
@@ -142,22 +131,23 @@ template <class Emitter> class LoopScope final : public LabelScope<Emitter> {
142131
}
143132

144133
private:
134+
Compiler<Emitter> *Ctx;
145135
OptLabelTy OldBreakLabel;
146136
OptLabelTy OldContinueLabel;
147137
VariableScope<Emitter> *OldBreakVarScope;
148138
VariableScope<Emitter> *OldContinueVarScope;
149139
};
150140

151141
// Sets the context for a switch scope, mapping labels.
152-
template <class Emitter> class SwitchScope final : public LabelScope<Emitter> {
142+
template <class Emitter> class SwitchScope final {
153143
public:
154144
using LabelTy = typename Compiler<Emitter>::LabelTy;
155145
using OptLabelTy = typename Compiler<Emitter>::OptLabelTy;
156146
using CaseMap = typename Compiler<Emitter>::CaseMap;
157147

158148
SwitchScope(Compiler<Emitter> *Ctx, CaseMap &&CaseLabels, LabelTy BreakLabel,
159149
OptLabelTy DefaultLabel)
160-
: LabelScope<Emitter>(Ctx), OldBreakLabel(Ctx->BreakLabel),
150+
: Ctx(Ctx), OldBreakLabel(Ctx->BreakLabel),
161151
OldDefaultLabel(this->Ctx->DefaultLabel),
162152
OldCaseLabels(std::move(this->Ctx->CaseLabels)),
163153
OldLabelVarScope(Ctx->BreakVarScope) {
@@ -175,6 +165,7 @@ template <class Emitter> class SwitchScope final : public LabelScope<Emitter> {
175165
}
176166

177167
private:
168+
Compiler<Emitter> *Ctx;
178169
OptLabelTy OldBreakLabel;
179170
OptLabelTy OldDefaultLabel;
180171
CaseMap OldCaseLabels;

0 commit comments

Comments
 (0)