[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #91868)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Mon May 13 17:45:54 PDT 2024
================
@@ -658,6 +659,38 @@ static char ConvertValueObjectStyleToChar(
return '\0';
}
+static llvm::Regex LLVMFormatPattern{"x[-+]?\\d*|n|d", llvm::Regex::IgnoreCase};
+
+static bool DumpValueWithLLVMFormat(Stream &s, llvm::StringRef options,
+ ValueObject &valobj) {
+ std::string formatted;
+ std::string llvm_format = ("{0:" + options + "}").str();
+
+ // Options supported by format_provider<T> for integral arithmetic types.
+ // See table in FormatProviders.h.
+
+ auto type_info = valobj.GetTypeInfo();
+ if (type_info & eTypeIsInteger && LLVMFormatPattern.match(options)) {
----------------
adrian-prantl wrote:
```suggestion
if ((type_info & eTypeIsInteger) && LLVMFormatPattern.match(options)) {
```
https://github.com/llvm/llvm-project/pull/91868
More information about the lldb-commits
mailing list