Add a new disassembly-format specification so that the disassembler
output style can be customized.  Change the built-in default to be
more similar to gdb's disassembly formatting.

The disassembly-format for a gdb-like output is

${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>: 

The disassembly-format for the lldb style output is

{${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: 

The two backticks in the lldb style formatter triggers the sub-expression evaluation in
CommandInterpreter::PreprocessCommand() so you can't use that one as-is ... changing to
use ' characters instead of ` would work around that.

<rdar://problem/9885398> 

llvm-svn: 219544
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index c4fa10f..a7dbc5f 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -4986,10 +4986,12 @@
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/Timer.h"
+#include "lldb/Target/CPPLanguageRuntime.h"
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
 
+
 using namespace lldb_private;
 
 static inline bool
@@ -5000,6 +5002,58 @@
     return false;
 }
 
+static const ConstString &
+get_demangled_name_without_arguments (const Mangled *obj)
+{
+    // This pair is <mangled name, demangled name without function arguments>
+    static std::pair<ConstString, ConstString> g_most_recent_mangled_to_name_sans_args;
+
+    // Need to have the mangled & demangled names we're currently examining as statics
+    // so we can return a const ref to them at the end of the func if we don't have
+    // anything better.
+    static ConstString g_last_mangled;
+    static ConstString g_last_demangled;
+
+    ConstString mangled = obj->GetMangledName ();
+    ConstString demangled = obj->GetDemangledName ();
+
+    if (mangled && g_most_recent_mangled_to_name_sans_args.first == mangled)
+    {
+        return g_most_recent_mangled_to_name_sans_args.second;
+    }
+
+    g_last_demangled = demangled;
+    g_last_mangled = mangled;
+
+    const char *mangled_name_cstr = mangled.GetCString();
+    const char *demangled_name_cstr = demangled.GetCString();
+
+    if (demangled && mangled_name_cstr && mangled_name_cstr[0])
+    {
+        if (mangled_name_cstr[0] == '_' && mangled_name_cstr[1] == 'Z' &&
+            (mangled_name_cstr[2] != 'T' && // avoid virtual table, VTT structure, typeinfo structure, and typeinfo mangled_name
+            mangled_name_cstr[2] != 'G' && // avoid guard variables
+            mangled_name_cstr[2] != 'Z'))  // named local entities (if we eventually handle eSymbolTypeData, we will want this back)
+        {
+            CPPLanguageRuntime::MethodName cxx_method (demangled);
+            if (!cxx_method.GetBasename().empty() && !cxx_method.GetContext().empty())
+            {
+                std::string shortname = cxx_method.GetContext().str();
+                shortname += "::";
+                shortname += cxx_method.GetBasename().str();
+                ConstString result(shortname.c_str());
+                g_most_recent_mangled_to_name_sans_args.first = mangled;
+                g_most_recent_mangled_to_name_sans_args.second = result;
+                return g_most_recent_mangled_to_name_sans_args.second;
+            }
+        }
+    }
+
+    if (demangled)
+        return g_last_demangled;
+    return g_last_mangled;
+}
+
 #pragma mark Mangled
 //----------------------------------------------------------------------
 // Default constructor
@@ -5215,6 +5269,14 @@
 const ConstString&
 Mangled::GetName (Mangled::NamePreference preference) const
 {
+    if (preference == ePreferDemangledWithoutArguments)
+    {
+        // Call the accessor to make sure we get a demangled name in case
+        // it hasn't been demangled yet...
+        GetDemangledName();
+
+        return get_demangled_name_without_arguments (this);
+    }
     if (preference == ePreferDemangled)
     {
         // Call the accessor to make sure we get a demangled name in case