================
@@ -208,6 +211,71 @@ static bool PrettyPrintFunctionNameWithArgs(Stream 
&out_stream,
   return true;
 }
 
+static bool GetUseColor(ExecutionContextScope *exe_scope) {
+  if (!exe_scope)
+    return false;
+
+  auto target_sp = exe_scope->CalculateTarget();
+  if (!target_sp)
+    return false;
+
+  return target_sp->GetDebugger().GetUseColor();
+}
+
+static bool ShouldHighlightBasename(
+    ExecutionContextScope *exe_scope,
+    const FormatEntity::Entry::HighlightSettings &settings) {
+  if (!GetUseColor(exe_scope))
+    return false;
+
+  return settings.kind ==
+         FormatEntity::Entry::HighlightSettings::Kind::Basename;
+}
+
+/// If \c DemangledNameInfo is valid, we use it to print a function function
+/// name into \c out_stream (and if requested, highlight the basename).
+static bool PrettyPrintHighlightedBasenameWithArgs(
+    Stream &out_stream, llvm::StringRef full_name,
+    ExecutionContextScope *exe_scope, VariableList const &args,
+    const std::optional<DemangledNameInfo> &demangled_info,
+    const FormatEntity::Entry::HighlightSettings &settings) {
+  // If we didn't get sufficient information from the demangler, we fall back 
to
+  // parsing the and printing parts of the demangled name ourselves.
+  if (!demangled_info || !demangled_info->hasBasename())
+    return PrettyPrintFunctionNameWithArgs(out_stream, full_name, exe_scope,
----------------
Michael137 wrote:

Not sure we really need this fallback path tbh. Maybe if the demangler failed 
to give us information about this name we `return false` here and let 
`FormatEntity` just print out the raw demangled name, which seems like a 
reasonable fallback (and we wouldn't need to maintain the `CPlusPlusNameParser` 
here).

https://github.com/llvm/llvm-project/pull/131836
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to