Skip to content

Commit 6083460

Browse files
committed
Reorder SwitchArm fields
1 parent 860c804 commit 6083460

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cpp2rust/converter/converter_lib.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,9 @@ std::vector<SwitchArm> AnalyzeSwitchArms(clang::CompoundStmt *body) {
861861
}
862862

863863
if (auto *sc = clang::dyn_cast<clang::SwitchCase>(inner)) {
864-
arms.push_back({sc,
864+
arms.push_back({{GetLastStmtOfSwitchCase(sc)},
865865
label,
866-
{GetLastStmtOfSwitchCase(sc)},
866+
sc,
867867
CaseChainHasDefault(sc),
868868
/*has_fallthrough=*/false});
869869
} else if (!arms.empty()) {

cpp2rust/converter/converter_lib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ bool ContainsVAArgExpr(const clang::Stmt *stmt);
170170
clang::Expr *NormalizeToBool(clang::Expr *expr, clang::ASTContext &ctx);
171171

172172
struct SwitchArm {
173-
clang::SwitchCase *head;
174-
llvm::StringRef label;
175173
std::vector<clang::Stmt *> body;
174+
llvm::StringRef label;
175+
clang::SwitchCase *head;
176176
bool is_default_case;
177177
bool has_fallthrough;
178178
};

0 commit comments

Comments
 (0)