From e8daa2f843e280607db9e5c8ca1b72db1f62c21e Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Sat, 17 May 2014 19:14:17 +0000 Subject: Introduce the concept of a "display name" for types Rationale: Pretty simply, the idea is that sometimes type names are way too long and contain way too many details for the average developer to care about. For instance, a plain ol' vector of int might be shown as std::__1::vector form, which is what most developers would actually type in their code Proposed solution: Introduce a notion of "display name" and a corresponding API GetDisplayTypeName() to return such a crafted for visual representation type name Obviously, the display name and the fully qualified (or "true") name are not necessarily the same - that's the whole point LLDB could choose to pick the "display name" as its one true notion of a type name, and if somebody really needs the fully qualified version of it, let them deal with the problem Or, LLDB could rename what it currently calls the "type name" to be the "display name", and add new APIs for the fully qualified name, making the display name the default choice The choice that I am making here is that the type name will keep meaning the same, and people who want a type name suited for display will explicitly ask for one It is the less risky/disruptive choice - and it should eventually make it fairly obvious when someone is asking for the wrong type Caveats: - for now, GetDisplayTypeName() == GetTypeName(), there is no logic to produce customized display type names yet. - while the fully-qualified type name is still the main key to the kingdom of data formatters, if we start showing custom names to people, those should match formatters llvm-svn: 209072 --- lldb/source/DataFormatters/ValueObjectPrinter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lldb/source/DataFormatters/ValueObjectPrinter.cpp') diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 565d4d419da..65e5e3f4582 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -222,7 +222,11 @@ ValueObjectPrinter::PrintTypeIfNeeded () { // Some ValueObjects don't have types (like registers sets). Only print // the type if there is one to print - ConstString qualified_type_name(m_valobj->GetQualifiedTypeName()); + ConstString qualified_type_name; + if (options.m_be_raw) + qualified_type_name = m_valobj->GetQualifiedTypeName(); + else + qualified_type_name = m_valobj->GetDisplayTypeName(); if (qualified_type_name) m_stream->Printf("(%s) ", qualified_type_name.GetCString()); else -- cgit v1.2.3