Skip to content

Commit 98c808f

Browse files
committed
Use range for vtable data verification
1 parent d37efd2 commit 98c808f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/CIR/Dialect/IR/CIRAttrs.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,14 @@ LogicalResult cir::VTableAttr::verify(
437437
if (sTy.getMembers().empty() || vtableData.empty())
438438
return emitError() << "expected record type with one or more subtype";
439439

440-
for (size_t i = 0; i < sTy.getMembers().size(); ++i) {
441-
auto constArrayAttr = mlir::dyn_cast<cir::ConstArrayAttr>(vtableData[i]);
440+
if (cir::ConstRecordAttr::verify(emitError, type, vtableData).failed())
441+
return failure();
442+
443+
for (const auto &data : vtableData.getAsRange<mlir::Attribute>()) {
444+
const auto &constArrayAttr = mlir::dyn_cast<cir::ConstArrayAttr>(data);
442445
if (!constArrayAttr)
443446
return emitError() << "expected constant array subtype";
444447

445-
if (cir::ConstRecordAttr::verify(emitError, type, vtableData).failed())
446-
return failure();
447-
448448
LogicalResult eltTypeCheck = success();
449449
auto arrayElts = mlir::cast<ArrayAttr>(constArrayAttr.getElts());
450450
arrayElts.walkImmediateSubElements(

0 commit comments

Comments
 (0)