[llvm] [TargetParser] Use StringRef::consume_back (NFC) (PR #139416)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat May 10 16:15:28 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/139416
None
>From 6f9aab8b168952597926949a834099f68e19a525 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 10 May 2025 16:11:58 -0700
Subject: [PATCH] [TargetParser] Use StringRef::consume_back (NFC)
---
llvm/lib/TargetParser/ARMTargetParserCommon.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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