Skip to content

Commit c8af900

Browse files
committed
Remove structured bindings
1 parent 84af69c commit c8af900

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

lib/Interpreter/CXCppInterOp.cpp

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ CXStringSet* makeCXStringSet(const std::vector<std::string>& Strs) {
3333
auto* Set = new CXStringSet; // NOLINT(*-owning-memory)
3434
Set->Count = Strs.size();
3535
Set->Strings = new CXString[Set->Count]; // NOLINT(*-owning-memory)
36-
for (auto [Idx, Val] : llvm::enumerate(Strs)) {
37-
Set->Strings[Idx] = makeCXString(Val);
36+
for (auto En : llvm::enumerate(Strs)) {
37+
Set->Strings[En.index()] = makeCXString(En.value());
3838
}
3939
return Set;
4040
}
@@ -458,8 +458,9 @@ CXScopeSet* clang_scope_getEnumConstants(CXScope S) {
458458
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
459459
Set->Count = std::distance(ED->enumerator_begin(), ED->enumerator_end());
460460
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
461-
for (auto [Idx, Val] : llvm::enumerate(ED->enumerators())) {
462-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val, CXScope_EnumConstant);
461+
for (auto En : llvm::enumerate(ED->enumerators())) {
462+
Set->Scopes[En.index()] =
463+
makeCXScope(getMeta(S), En.value(), CXScope_EnumConstant);
463464
}
464465

465466
return Set;
@@ -477,7 +478,8 @@ CXQualType clang_scope_getEnumConstantType(CXScope S) {
477478
}
478479

479480
size_t clang_scope_getEnumConstantValue(CXScope S) {
480-
if (const auto* ECD = llvm::dyn_cast_or_null<clang::EnumConstantDecl>(getDecl(S))) {
481+
if (const auto* ECD =
482+
llvm::dyn_cast_or_null<clang::EnumConstantDecl>(getDecl(S))) {
481483
const llvm::APSInt& Val = ECD->getInitVal();
482484
return Val.getExtValue();
483485
}
@@ -569,9 +571,9 @@ CXScopeSet* clang_scope_getUsingNamespaces(CXScope S) {
569571
Set->Count = std::distance(DC->using_directives().begin(),
570572
DC->using_directives().end());
571573
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
572-
for (auto [Idx, Val] : llvm::enumerate(DC->using_directives())) {
573-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val->getNominatedNamespace(),
574-
CXScope_Namespace);
574+
for (auto En : llvm::enumerate(DC->using_directives())) {
575+
Set->Scopes[En.index()] = makeCXScope(
576+
getMeta(S), En.value()->getNominatedNamespace(), CXScope_Namespace);
575577
}
576578

577579
return Set;
@@ -750,8 +752,9 @@ CXScopeSet* clang_scope_getClassMethods(CXScope S) {
750752
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
751753
Set->Count = Methods.size();
752754
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
753-
for (auto [Idx, Val] : llvm::enumerate(Methods)) {
754-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val, CXScope_Function);
755+
for (auto En : llvm::enumerate(Methods)) {
756+
Set->Scopes[En.index()] =
757+
makeCXScope(getMeta(S), En.value(), CXScope_Function);
755758
}
756759

757760
return Set;
@@ -786,8 +789,9 @@ CXScopeSet* clang_scope_getFunctionTemplatedDecls(CXScope S) {
786789
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
787790
Set->Count = Methods.size();
788791
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
789-
for (auto [Idx, Val] : llvm::enumerate(Methods)) {
790-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val, CXScope_Function);
792+
for (auto En : llvm::enumerate(Methods)) {
793+
Set->Scopes[En.index()] =
794+
makeCXScope(getMeta(S), En.value(), CXScope_Function);
791795
}
792796

793797
return Set;
@@ -854,8 +858,9 @@ CXScopeSet* clang_scope_getFunctionsUsingName(CXScope S, const char* name) {
854858
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
855859
Set->Count = Funcs.size();
856860
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
857-
for (auto [Idx, Val] : llvm::enumerate(Funcs)) {
858-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val, CXScope_Function);
861+
for (auto En : llvm::enumerate(Funcs)) {
862+
Set->Scopes[En.index()] =
863+
makeCXScope(getMeta(S), En.value(), CXScope_Function);
859864
}
860865

861866
return Set;
@@ -1002,8 +1007,9 @@ CXScopeSet* clang_scope_getClassTemplatedMethods(const char* name,
10021007
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
10031008
Set->Count = Funcs.size();
10041009
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
1005-
for (auto [Idx, Val] : llvm::enumerate(Funcs)) {
1006-
Set->Scopes[Idx] = makeCXScope(getMeta(parent), Val, CXScope_Function);
1010+
for (auto En : llvm::enumerate(Funcs)) {
1011+
Set->Scopes[En.index()] =
1012+
makeCXScope(getMeta(parent), En.value(), CXScope_Function);
10071013
}
10081014

10091015
return Set;
@@ -1121,8 +1127,9 @@ CXScopeSet* clang_scope_getDatamembers(CXScope S) {
11211127
auto* Set = new CXScopeSet; // NOLINT(*-owning-memory)
11221128
Set->Count = std::distance(CXXRD->field_begin(), CXXRD->field_end());
11231129
Set->Scopes = new CXScope[Set->Count]; // NOLINT(*-owning-memory)
1124-
for (auto [Idx, Val] : llvm::enumerate(CXXRD->fields())) {
1125-
Set->Scopes[Idx] = makeCXScope(getMeta(S), Val, CXScope_Function);
1130+
for (auto En : llvm::enumerate(CXXRD->fields())) {
1131+
Set->Scopes[En.index()] =
1132+
makeCXScope(getMeta(S), En.value(), CXScope_Function);
11261133
}
11271134

11281135
return Set;

0 commit comments

Comments
 (0)