[Lldb-commits] [lldb] fd5748c - [lldb][NFCI] Minor cleanup of default OptionValue::GetSubValue implementation

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 5 09:06:18 PDT 2023


Author: Alex Langford
Date: 2023-07-05T09:00:59-07:00
New Revision: fd5748cb5a45c4178b84eb329bea9055f8ee485d

URL: https://github.com/llvm/llvm-project/commit/fd5748cb5a45c4178b84eb329bea9055f8ee485d
DIFF: https://github.com/llvm/llvm-project/commit/fd5748cb5a45c4178b84eb329bea9055f8ee485d.diff

LOG: [lldb][NFCI] Minor cleanup of default OptionValue::GetSubValue implementation

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

Added: 
    

Modified: 
    lldb/include/lldb/Interpreter/OptionValue.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h
index b43715357a01c3..4fa0b23042669d 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -114,8 +114,7 @@ class OptionValue {
   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();
   }
 


        


More information about the lldb-commits mailing list