[llvm] 7ca4079 - [TargetParser] Use StringRef::consume_back (NFC) (#139416)
via llvm-commits
llvm-commits at lists.llvm.org
Sun May 11 07:11:56 PDT 2025
Author: Kazu Hirata
Date: 2025-05-11T07:11:53-07:00
New Revision: 7ca4079504232769ca418ae9b78bd944cb374677
URL: https://github.com/llvm/llvm-project/commit/7ca4079504232769ca418ae9b78bd944cb374677
DIFF: https://github.com/llvm/llvm-project/commit/7ca4079504232769ca418ae9b78bd944cb374677.diff
LOG: [TargetParser] Use StringRef::consume_back (NFC) (#139416)
Added:
Modified:
llvm/lib/TargetParser/ARMTargetParserCommon.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TargetParser/ARMTargetParserCommon.cpp b/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
index e2ed8df78f95e..89d5e0d320f86 100644
--- a/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
+++ b/llvm/lib/TargetParser/ARMTargetParserCommon.cpp
@@ -82,9 +82,9 @@ StringRef ARM::getCanonicalArchName(StringRef Arch) {
// Ex. "armebv7", move past the "eb".
if (offset != StringRef::npos && A.substr(offset, 2) == "eb")
offset += 2;
- // Or, if it ends with eb ("armv7eb"), chop it off.
- else if (A.ends_with("eb"))
- A = A.substr(0, A.size() - 2);
+ else
+ // Or, if it ends with eb ("armv7eb"), chop it off.
+ A.consume_back("eb");
// Trim the head
if (offset != StringRef::npos)
A = A.substr(offset);
More information about the llvm-commits
mailing list