diff options
author | Jakub Kuderski <kubak@google.com> | 2023-03-13 20:48:38 -0400 |
---|---|---|
committer | Jakub Kuderski <kubak@google.com> | 2023-03-13 20:59:06 -0400 |
commit | b9db89fbcfdaece8656159a2a0f0a2f09cdd7db7 (patch) | |
tree | ab4257cb385d47cdc2e547d2bf0dced7bb8bb738 /clang/tools | |
parent | 7cc4e980e0f4032fd1bc4a736a9944c59aeff726 (diff) | |
download | llvm-b9db89fbcfdaece8656159a2a0f0a2f09cdd7db7.tar.gz |
[ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/
Replace references to `enumerate` results with either const lvalue
rerences or structured bindings. I did not use structured bindings
everywhere as it wasn't clear to me it would improve readability.
This is in preparation to the switch to `zip` semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D145987
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/clang-refactor/TestSupport.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp index 400313eeab5e..3fae18c2109a 100644 --- a/clang/tools/clang-refactor/TestSupport.cpp +++ b/clang/tools/clang-refactor/TestSupport.cpp @@ -176,11 +176,11 @@ std::pair<unsigned, unsigned> getLineColumn(StringRef Filename, bool TestRefactoringResultConsumer::handleAllResults() { bool Failed = false; - for (auto &Group : llvm::enumerate(Results)) { + for (const auto &Group : llvm::enumerate(Results)) { // All ranges in the group must produce the same result. std::optional<tooling::AtomicChanges> CanonicalResult; std::optional<std::string> CanonicalErrorMessage; - for (auto &I : llvm::enumerate(Group.value())) { + for (const auto &I : llvm::enumerate(Group.value())) { Expected<tooling::AtomicChanges> &Result = I.value(); std::string ErrorMessage; bool HasResult = !!Result; |