================
@@ -22,8 +22,26 @@ Status SaveCoreOptions::SetPluginName(const char *name) {
   }
 
   if (!PluginManager::IsRegisteredObjectFilePluginName(name)) {
-    return Status::FromErrorStringWithFormat(
-        "plugin name '%s' is not a valid ObjectFile plugin name", name);
+    StreamString stream;
+    stream.Printf("plugin name '%s' is not a valid ObjectFile plugin name.",
+                  name);
+
+    llvm::SmallVector<llvm::StringRef> plugin_names =
+        PluginManager::GetSaveCorePluginNames();
+    if (!plugin_names.empty()) {
+      stream.PutCString(" valid values are: ");
+      bool is_first = true;
+      for (llvm::StringRef plugin_name : plugin_names) {
+        llvm::StringRef delimiter = ", ";
+        if (is_first) {
----------------
DavidSpickett wrote:

There is an llvm::join somewhere in ADT, that will handle first and last for 
you. Just have to accumulate it into a std::string to print it which is fine, 
we don't care about one extra copy here.

Look in llvm/include/llvm/ADT/StringExtras.h.

https://github.com/llvm/llvm-project/pull/143126
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to