[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 20 16:02:58 PDT 2024

@@ -658,6 +658,33 @@ static char ConvertValueObjectStyleToChar(
   return '\0';
+static bool DumpValueWithLLVMFormat(Stream &s, llvm::StringRef options,
+                                    ValueObject &target) {
+  std::string formatted;
+  std::string llvm_format = ("{0:" + options + "}").str();
kastiglione wrote:

> by switching over the supported options?

There are many supported options, and they vary from type to type (int has different options than say strings). See [FormatProviders.h](https://llvm.org/doxygen/FormatProviders_8h_source.html) for the builtins.

It would be possible to exhaustively iterate all the options llvm includes, but I'm not sure it would be worth it. Switching over them seems fragile to changes made to the source of truth in llvm.

I will check/test what llvm does for invalid options.


More information about the lldb-commits mailing list