[lldb][NFCI] Minor cleanup of default OptionValue::GetSubValue implementation
authorAlex Langford <alangford@apple.com>
Mon, 3 Jul 2023 20:29:48 +0000 (13:29 -0700)
committerAlex Langford <alangford@apple.com>
Wed, 5 Jul 2023 16:00:59 +0000 (09:00 -0700)
This does 2 things:
- Corrects a minor typo (`value subvalue` -> `valid subvalue`)
- Removes an unnecessary instance of `str().c_str()` (creating a
  temporary std::string from a StringRef just to get a valid
  null-terminated string).

Differential Revision: https://reviews.llvm.org/D154387

lldb/include/lldb/Interpreter/OptionValue.h

index b437153..4fa0b23 100644 (file)
@@ -114,8 +114,7 @@ public:
   virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
                                           llvm::StringRef name,
                                           Status &error) const {
-    error.SetErrorStringWithFormat("'%s' is not a value subvalue",
-                                   name.str().c_str());
+    error.SetErrorStringWithFormatv("'{0}' is not a valid subvalue", name);
     return lldb::OptionValueSP();
   }