[llvm] [clang] [RISCV] Deduplicate RISCVISAInfo::toFeatures/toFeatureVector. NFC (PR #76942)
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 4 18:52:58 PST 2024
================
@@ -470,17 +470,17 @@ std::vector<std::string> RISCVISAInfo::toFeatures(bool AddAllExtensions,
bool IgnoreUnknown) const {
std::vector<std::string> Features;
for (auto const &Ext : Exts) {
- std::string ExtName = Ext.first;
+ StringRef ExtName = Ext.first;
if (ExtName == "i") // i is not recognized in clang -cc1
continue;
if (IgnoreUnknown && !isSupportedExtension(ExtName))
continue;
if (isExperimentalExtension(ExtName)) {
- Features.push_back("+experimental-" + ExtName);
+ Features.push_back("+experimental-" + std::string(ExtName));
} else {
- Features.push_back("+" + ExtName);
+ Features.push_back("+" + std::string(ExtName));
----------------
compnerd wrote:
These do a double string allocation, you can use `Twine` to do a single allocation. e.g.,
```c++
(llvm::Twine("+") + ExtName).str()
```
https://github.com/llvm/llvm-project/pull/76942
More information about the cfe-commits
mailing list