-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Use StringRef in a range-based for loop (NFC) #144243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISCV] Use StringRef in a range-based for loop (NFC) #144243
Conversation
When we iterate over std::vector<std::string>, we can directly assign each element to StringRef. We do not need to go through a separate statement.
@llvm/pr-subscribers-backend-risc-v Author: Kazu Hirata (kazutakahirata) ChangesWhen we iterate over std::vector<std::string>, we can directly assign Full diff: https://github.com/llvm/llvm-project/pull/144243.diff 1 Files Affected:
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<RISCVISAInfo> 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 '-'
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/7361 Here is the relevant piece of the build log for the reference
|
When we iterate over std::vector<std::string>, we can directly assign each element to StringRef. We do not need to go through a separate statement.
When we iterate over std::vectorstd::string, we can directly assign
each element to StringRef. We do not need to go through a separate
statement.