@@ -460,8 +460,9 @@ CXScopeSet* clang_scope_getEnumConstants(CXScope S) {
460460 Set->Count = std::distance (ED->enumerator_begin (), ED->enumerator_end ());
461461 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
462462 for (auto En : llvm::enumerate (ED->enumerators ())) {
463- Set->Scopes [En.index ()] =
464- makeCXScope (getMeta (S), En.value (), CXScope_EnumConstant);
463+ auto Idx = En.index ();
464+ auto Val = En.value ();
465+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val, CXScope_EnumConstant);
465466 }
466467
467468 return Set;
@@ -573,8 +574,10 @@ CXScopeSet* clang_scope_getUsingNamespaces(CXScope S) {
573574 DC->using_directives ().end ());
574575 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
575576 for (auto En : llvm::enumerate (DC->using_directives ())) {
576- Set->Scopes [En.index ()] = makeCXScope (
577- getMeta (S), En.value ()->getNominatedNamespace (), CXScope_Namespace);
577+ auto Idx = En.index ();
578+ auto Val = En.value ();
579+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val->getNominatedNamespace (),
580+ CXScope_Namespace);
578581 }
579582
580583 return Set;
@@ -753,8 +756,9 @@ CXScopeSet* clang_scope_getClassMethods(CXScope S) {
753756 Set->Count = Methods.size ();
754757 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
755758 for (auto En : llvm::enumerate (Methods)) {
756- Set->Scopes [En.index ()] =
757- makeCXScope (getMeta (S), En.value (), CXScope_Function);
759+ auto Idx = En.index ();
760+ auto Val = En.value ();
761+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val, CXScope_Function);
758762 }
759763
760764 return Set;
@@ -790,8 +794,9 @@ CXScopeSet* clang_scope_getFunctionTemplatedDecls(CXScope S) {
790794 Set->Count = Methods.size ();
791795 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
792796 for (auto En : llvm::enumerate (Methods)) {
793- Set->Scopes [En.index ()] =
794- makeCXScope (getMeta (S), En.value (), CXScope_Function);
797+ auto Idx = En.index ();
798+ auto Val = En.value ();
799+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val, CXScope_Function);
795800 }
796801
797802 return Set;
@@ -859,8 +864,9 @@ CXScopeSet* clang_scope_getFunctionsUsingName(CXScope S, const char* name) {
859864 Set->Count = Funcs.size ();
860865 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
861866 for (auto En : llvm::enumerate (Funcs)) {
862- Set->Scopes [En.index ()] =
863- makeCXScope (getMeta (S), En.value (), CXScope_Function);
867+ auto Idx = En.index ();
868+ auto Val = En.value ();
869+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val, CXScope_Function);
864870 }
865871
866872 return Set;
@@ -1008,8 +1014,9 @@ CXScopeSet* clang_scope_getClassTemplatedMethods(const char* name,
10081014 Set->Count = Funcs.size ();
10091015 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
10101016 for (auto En : llvm::enumerate (Funcs)) {
1011- Set->Scopes [En.index ()] =
1012- makeCXScope (getMeta (parent), En.value (), CXScope_Function);
1017+ auto Idx = En.index ();
1018+ auto Val = En.value ();
1019+ Set->Scopes [Idx] = makeCXScope (getMeta (parent), Val, CXScope_Function);
10131020 }
10141021
10151022 return Set;
@@ -1128,8 +1135,9 @@ CXScopeSet* clang_scope_getDatamembers(CXScope S) {
11281135 Set->Count = std::distance (CXXRD->field_begin (), CXXRD->field_end ());
11291136 Set->Scopes = new CXScope[Set->Count ]; // NOLINT(*-owning-memory)
11301137 for (auto En : llvm::enumerate (CXXRD->fields ())) {
1131- Set->Scopes [En.index ()] =
1132- makeCXScope (getMeta (S), En.value (), CXScope_Function);
1138+ auto Idx = En.index ();
1139+ auto Val = En.value ();
1140+ Set->Scopes [Idx] = makeCXScope (getMeta (S), Val, CXScope_Function);
11331141 }
11341142
11351143 return Set;
0 commit comments