swift-module-digester: diagnose reordering of members in a fixed layout type under ABI mode.

This commit is contained in:
Xi Ge
2018-09-18 12:14:24 -07:00
parent 0eb756f2f4
commit 05e15927a3
13 changed files with 385 additions and 8 deletions

View File

@@ -709,6 +709,17 @@ static void detectDeclChange(NodePtr L, NodePtr R, SDKContext &Ctx) {
Desc);
}
}
// Detect re-ordering if they're from structs with a fixed layout.
auto *LV = dyn_cast<SDKNodeDeclVar>(L);
auto *RV = dyn_cast<SDKNodeDeclVar>(R);
if (LV && RV &&
LV->hasFixedBinaryOrder() && RV->hasFixedBinaryOrder() &&
LV->getFixedBinaryOrder() != RV->getFixedBinaryOrder()) {
Ctx.getDiags().diagnose(SourceLoc(), diag::decl_reorder,
LV->getScreenInfo(),
LV->getFixedBinaryOrder(),
RV->getFixedBinaryOrder());
}
}
// Diagnose generic signature change