[llvm] fc4350c - [NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter
Piyou Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 23:55:40 PDT 2023
Author: Piyou Chen
Date: 2023-06-13T23:55:34-07:00
New Revision: fc4350cb4396cc7b28f10a697d45269beda03ff5
URL: https://github.com/llvm/llvm-project/commit/fc4350cb4396cc7b28f10a697d45269beda03ff5
DIFF: https://github.com/llvm/llvm-project/commit/fc4350cb4396cc7b28f10a697d45269beda03ff5.diff
LOG: [NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D152506
Added:
Modified:
llvm/lib/Support/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 5bb393bd3e895..0c564ac64540c 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -176,14 +176,14 @@ static bool stripExperimentalPrefix(StringRef &Ext) {
return Ext.consume_front("experimental-");
}
-// This function finds the first character that doesn't belong to a version
+// This function finds the last character that doesn't belong to a version
// (e.g. zba1p0 is extension 'zba' of version '1p0'). So the function will
// consume [0-9]*p[0-9]* starting from the backward. An extension name will not
// end with a digit or the letter 'p', so this function will parse correctly.
// 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(StringRef Ext) {
+static size_t findLastNonVersionCharacter(StringRef Ext) {
assert(!Ext.empty() &&
"Already guarded by if-statement in ::parseArchString");
@@ -791,7 +791,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
StringRef Type = getExtensionType(Ext);
StringRef Desc = getExtensionTypeDesc(Ext);
- auto Pos = findFirstNonVersionCharacter(Ext) + 1;
+ auto Pos = findLastNonVersionCharacter(Ext) + 1;
StringRef Name(Ext.substr(0, Pos));
StringRef Vers(Ext.substr(Pos));
More information about the llvm-commits
mailing list