[llvm] 7e73fd9 - [RISCV] Minor code cleanups in RISCVISAInfo. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 26 13:35:46 PST 2022
Author: Craig Topper
Date: 2022-01-26T13:35:40-08:00
New Revision: 7e73fd95a0ee5fa05f3426068a9f709853b24e54
URL: https://github.com/llvm/llvm-project/commit/7e73fd95a0ee5fa05f3426068a9f709853b24e54
DIFF: https://github.com/llvm/llvm-project/commit/7e73fd95a0ee5fa05f3426068a9f709853b24e54.diff
LOG: [RISCV] Minor code cleanups in RISCVISAInfo. NFCI
Pass StringRef by value instead of const reference.
Replace if () llvm_unreachable with an assert.
Replace size() == 0 with empty()
Added:
Modified:
llvm/lib/Support/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 55a644e98aacd..a78c7057c881b 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -110,9 +110,9 @@ static bool stripExperimentalPrefix(StringRef &Ext) {
// NOTE: This function is NOT able to take empty strings or strings that only
// have version numbers and no extension name. It assumes the extension name
// will be at least more than one character.
-static size_t findFirstNonVersionCharacter(const StringRef &Ext) {
- if (Ext.size() == 0)
- llvm_unreachable("Already guarded by if-statement in ::parseArchString");
+static size_t findFirstNonVersionCharacter(StringRef Ext) {
+ assert(!Ext.empty() &&
+ "Already guarded by if-statement in ::parseArchString");
int Pos = Ext.size() - 1;
while (Pos > 0 && isDigit(Ext[Pos]))
More information about the llvm-commits
mailing list