From 832995c0d9816a06a39a15c9f90065d3c74528d5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 13 Jun 2025 13:30:47 -0700 Subject: [PATCH] [RISCV] Use StringRef in a range-based for loop (NFC) When we iterate over std::vector, we can directly assign each element to StringRef. We do not need to go through a separate statement. --- llvm/lib/TargetParser/RISCVISAInfo.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp index e76ddd4b648dc..17c98332ab0af 100644 --- a/llvm/lib/TargetParser/RISCVISAInfo.cpp +++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp @@ -449,8 +449,7 @@ RISCVISAInfo::parseFeatures(unsigned XLen, assert(XLen == 32 || XLen == 64); std::unique_ptr ISAInfo(new RISCVISAInfo(XLen)); - for (auto &Feature : Features) { - StringRef ExtName = Feature; + for (StringRef ExtName : Features) { assert(ExtName.size() > 1 && (ExtName[0] == '+' || ExtName[0] == '-')); bool Add = ExtName[0] == '+'; ExtName = ExtName.drop_front(1); // Drop '+' or '-'