================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to