================
@@ -253,9 +264,20 @@ void Symbol::GetDescription(Stream *s,
lldb::DescriptionLevel level,
m_addr_range.GetBaseAddress().GetOffset());
}
ConstString demangled = GetMangled().GetDemangledName();
- if (demangled)
+
+ // Checking if the name (i.e., searched symbol is passed as an argument to
the function)
+ // In that case, we use the re_pattern function to colorize the symbol.
+ if (demangled && name){
+ s->Printf(", name=");
+ Address::re_pattern(s, demangled.AsCString(), name);
+ }
+ else if(demangled && name == nullptr)
s->Printf(", name=\"%s\"", demangled.AsCString());
- if (m_mangled.GetMangledName())
+ if (m_mangled.GetMangledName() && name){
+ s->Printf(", mangled=");
+ Address::re_pattern(s, m_mangled.GetMangledName().AsCString(), name);
+ }
+ else if(m_mangled.GetMangledName() && name == nullptr)
----------------
DavidSpickett wrote:
The `if (m_mangled.GetMangledName..` should be the outer if. Within that, you
can see if you have a name/pattern to use.
Also, you can do this trick to simplify things:
```
if (auto mangled_name = m_mangled.GetMangledName()) {
// If you get here then bool(m_mangled_name.GetMangledName()) is True so you
can use it.
do_stuff(m_mangled_name);
} else {
// it was false
}
```
(which is more the code being from before that feature existed than anything
you're doing wrong)
https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits