[llvm] 24bc5f3 - [RISCV] Replace std::string with StringRef in RISCVISAInfo. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 22:24:43 PDT 2023
Author: Craig Topper
Date: 2023-03-29T22:24:08-07:00
New Revision: 24bc5f3f3104a48351b95516ec5a9e6773c6da4a
URL: https://github.com/llvm/llvm-project/commit/24bc5f3f3104a48351b95516ec5a9e6773c6da4a
DIFF: https://github.com/llvm/llvm-project/commit/24bc5f3f3104a48351b95516ec5a9e6773c6da4a.diff
LOG: [RISCV] Replace std::string with StringRef in RISCVISAInfo. NFC
We're just slicing off part of an existing StringRef. No need to
allocate any new storage.
Added:
Modified:
llvm/lib/Support/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 96dee400643a..bd243f7a0d5f 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -713,10 +713,10 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
// Move to next char to prevent repeated letter.
++StdExtsItr;
- std::string Next;
+ StringRef Next;
unsigned Major, Minor, ConsumeLength;
if (std::next(I) != E)
- Next = std::string(std::next(I), E);
+ Next = StringRef(std::next(I), E - std::next(I));
if (auto E = getExtensionVersion(StringRef(&C, 1), Next, Major, Minor,
ConsumeLength, EnableExperimentalExtension,
ExperimentalExtensionVersionCheck)) {
More information about the llvm-commits
mailing list