Skip to content

Commit edfbb2a

Browse files
committed
use llvm::enumerate instead of manually tracking index
1 parent 13e3a63 commit edfbb2a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8541,7 +8541,7 @@ class PointerParamInfoPrinter {
85418541
out << "sizedBy";
85428542
else
85438543
out << "countedBy";
8544-
out << "(pointer: " << pointerIndex << ", ";
8544+
out << "(pointer: " << pointerIndex + 1 << ", ";
85458545
if (isSizedBy)
85468546
out << "size";
85478547
else
@@ -8568,13 +8568,11 @@ void ClangImporter::Implementation::importBoundsAttributes(
85688568
{
85698569
llvm::raw_svector_ostream out(MacroString);
85708570

8571-
size_t parameterIndex = 1;
85728571
PointerParamInfoPrinter printer(getClangASTContext(), out);
8573-
for (auto param : ClangDecl->parameters()) {
8572+
for (auto [index, param] : llvm::enumerate(ClangDecl->parameters())) {
85748573
if (auto CAT = param->getType()->getAs<clang::CountAttributedType>()) {
8575-
printer.printCountedBy(CAT, parameterIndex);
8574+
printer.printCountedBy(CAT, index);
85768575
}
8577-
parameterIndex++;
85788576
}
85798577
}
85808578

0 commit comments

Comments
 (0)