Pull in cxa_demangle.cpp/.h from llvm's libcxxabi project. Change the namespace to lldb_cxxabiv1 for the time being.

Mangled.cpp is not wired in to call it yet.

llvm-svn: 161293
This commit is contained in:
Johnny Chen 2012-08-04 01:36:57 +00:00
parent 10b90b45c1
commit 0efe2743f8
4 changed files with 11190 additions and 0 deletions

View File

@ -0,0 +1,171 @@
//===-------------------------- cxa_demangle.h ----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _CXA_DEMANGLE_H
#define _CXA_DEMANGLE_H
#include <cxxabi.h>
#pragma GCC visibility push(hidden)
namespace lldb_cxxabiv1
{
namespace __libcxxabi
{
class __demangle_tree;
class __node;
char*
__demangle(__demangle_tree, char*, size_t*, int*);
struct __demangle_tree_rv
{
__demangle_tree* ptr_;
explicit __demangle_tree_rv(__demangle_tree* ptr)
: ptr_(ptr) {}
};
class __demangle_tree
{
const char* __mangled_name_begin_;
const char* __mangled_name_end_;
int __status_;
__node* __root_;
__node* __node_begin_;
__node* __node_end_;
__node* __node_cap_;
__node** __sub_begin_;
__node** __sub_end_;
__node** __sub_cap_;
__node** __t_begin_;
__node** __t_end_;
__node** __t_cap_;
bool __tag_templates_;
bool __fix_forward_references_;
bool __owns_buf_;
__demangle_tree& operator=(const __demangle_tree&);
public:
__demangle_tree(const char*, char*, size_t);
~__demangle_tree();
__demangle_tree(__demangle_tree&);
__demangle_tree(__demangle_tree_rv);
operator __demangle_tree_rv() {return __demangle_tree_rv(this);}
int __status() const;
size_t size() const;
char* __get_demangled_name(char*) const;
void __parse();
private:
const char* __parse_encoding(const char*, const char*);
const char* __parse_type(const char*, const char*,
bool = true, bool = false);
const char* __parse_special_name(const char*, const char*);
const char* __parse_name(const char*, const char*);
const char* __parse_bare_function_type(const char*, const char*);
const char* __parse_call_offset(const char*, const char*);
const char* __parse_number(const char*, const char*);
const char* __parse_cv_qualifiers(const char* first, const char* last,
unsigned& cv, bool = false);
const char* __parse_nested_name(const char*, const char*);
const char* __parse_discriminator(const char*, const char*);
const char* __parse_local_name(const char*, const char*);
const char* __parse_unscoped_template_name(const char*, const char*);
const char* __parse_unscoped_name(const char*, const char*);
const char* __parse_operator_name(const char*, const char*, int* = 0);
const char* __parse_unqualified_name(const char*, const char*);
const char* __parse_source_name(const char*, const char*);
const char* __parse_ctor_dtor_name(const char*, const char*);
const char* __parse_unnamed_type_name(const char*, const char*);
const char* __parse_template_args(const char*, const char*);
const char* __parse_template_arg(const char*, const char*);
const char* __parse_expression(const char*, const char*);
const char* __parse_expr_primary(const char*, const char*);
const char* __parse_substitution(const char*, const char*);
const char* __parse_builtin_type(const char*, const char*);
const char* __parse_function_type(const char*, const char*);
const char* __parse_class_enum_type(const char*, const char*);
const char* __parse_array_type(const char*, const char*);
const char* __parse_pointer_to_member_type(const char*, const char*);
const char* __parse_decltype(const char*, const char*);
const char* __parse_template_param(const char*, const char*);
const char* __parse_unresolved_name(const char*, const char*);
const char* __parse_unresolved_type(const char*, const char*);
const char* __parse_base_unresolved_name(const char*, const char*);
const char* __parse_simple_id(const char*, const char*);
const char* __parse_destructor_name(const char*, const char*);
const char* __parse_function_param(const char*, const char*);
const char* __parse_const_cast_expr(const char*, const char*);
const char* __parse_alignof_expr(const char*, const char*);
const char* __parse_call_expr(const char*, const char*);
const char* __parse_conversion_expr(const char*, const char*);
const char* __parse_delete_array_expr(const char*, const char*);
const char* __parse_delete_expr(const char*, const char*);
const char* __parse_dynamic_cast_expr(const char*, const char*);
const char* __parse_dot_star_expr(const char*, const char*);
const char* __parse_dot_expr(const char*, const char*);
const char* __parse_decrement_expr(const char*, const char*);
const char* __parse_new_expr(const char*, const char*);
const char* __parse_increment_expr(const char*, const char*);
const char* __parse_arrow_expr(const char*, const char*);
const char* __parse_reinterpret_cast_expr(const char*, const char*);
const char* __parse_static_cast_expr(const char*, const char*);
const char* __parse_sizeof_type_expr(const char*, const char*);
const char* __parse_sizeof_param_pack_expr(const char*, const char*);
const char* __parse_typeid_expr(const char*, const char*);
const char* __parse_throw_expr(const char*, const char*);
const char* __parse_pack_expansion(const char*, const char*);
const char* __parse_sizeof_function_param_pack_expr(const char*, const char*);
const char* __parse_dot_suffix(const char*, const char*);
const char* __parse_unresolved_qualifier_level(const char*, const char*);
const char* __parse_vector_type(const char*, const char*);
const char* __parse_hex_number(const char*, const char*, unsigned long long&);
template <class _Tp> bool __make();
template <class _Tp, class _A0> bool __make(_A0 __a0);
template <class _Tp, class _A0, class _A1> bool __make(_A0 __a0, _A1 __a1);
template <class _Tp, class _A0, class _A1, class _A2>
bool __make(_A0 __a0, _A1 __a1, _A2 __a2);
template <class _Tp, class _A0, class _A1, class _A2, class _A3>
bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3);
template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4>
bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4);
template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4,
class _A5>
bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4, _A5 __a5);
friend
char*
__demangle(__demangle_tree, char*, size_t*, int*);
};
__demangle_tree
__demangle(const char*);
__demangle_tree
__demangle(const char*, char*, size_t);
} // __libcxxabi
char*
__cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status);
} // lldb__cxxabiv1
#pragma GCC visibility pop
#endif // _CXA_DEMANGLE_H

View File

@ -512,6 +512,7 @@
AFF87C89150FF672000E1742 /* com.apple.debugserver-secure.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C88150FF672000E1742 /* com.apple.debugserver-secure.plist */; };
AFF87C8F150FF688000E1742 /* com.apple.debugserver.applist.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */; };
B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */; };
B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B21EB71415CC99F100E60059 /* cxa_demangle.cpp */; };
B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; };
B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; };
B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp */; };
@ -1538,6 +1539,8 @@
AFF87C8E150FF688000E1742 /* com.apple.debugserver.applist.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = com.apple.debugserver.applist.plist; path = tools/debugserver/source/com.apple.debugserver.applist.plist; sourceTree = "<group>"; };
B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectWatchpoint.cpp; path = source/Commands/CommandObjectWatchpoint.cpp; sourceTree = "<group>"; };
B207C4941429609C00F36E4E /* CommandObjectWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommandObjectWatchpoint.h; path = source/Commands/CommandObjectWatchpoint.h; sourceTree = "<group>"; };
B21EB71415CC99F100E60059 /* cxa_demangle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cxa_demangle.cpp; path = source/Core/cxa_demangle.cpp; sourceTree = "<group>"; };
B21EB71815CC9B7500E60059 /* cxa_demangle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cxa_demangle.h; path = include/lldb/Core/cxa_demangle.h; sourceTree = "<group>"; };
B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = "<group>"; };
B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupWatchpoint.cpp; path = source/Interpreter/OptionGroupWatchpoint.cpp; sourceTree = "<group>"; };
B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupWatchpoint.h; path = include/lldb/Interpreter/OptionGroupWatchpoint.h; sourceTree = "<group>"; };
@ -2399,7 +2402,9 @@
26BC7D6810F1B77400F91463 /* Log.h */,
26BC7E7F10F1B85900F91463 /* Log.cpp */,
26BC7D6910F1B77400F91463 /* Mangled.h */,
B21EB71815CC9B7500E60059 /* cxa_demangle.h */,
26BC7E8010F1B85900F91463 /* Mangled.cpp */,
B21EB71415CC99F100E60059 /* cxa_demangle.cpp */,
2682100C143A59AE004BCF2D /* MappedHash.h */,
26BC7D6A10F1B77400F91463 /* Module.h */,
26BC7E8110F1B85900F91463 /* Module.cpp */,
@ -3922,6 +3927,7 @@
2694E99D14FC0BB30076DE67 /* PlatformFreeBSD.cpp in Sources */,
2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */,
26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */,
B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include <cxxabi.h>
//#include "lldb/Core/cxa_demangle.h"
#include "llvm/ADT/DenseMap.h"
@ -195,6 +196,7 @@ Mangled::GetDemangledName () const
// We didn't already mangle this name, demangle it and if all goes well
// add it to our map.
char *demangled_name = abi::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
//char *demangled_name = lldb_cxxabiv1::__cxa_demangle (mangled_cstr, NULL, NULL, NULL);
if (demangled_name)
{

File diff suppressed because it is too large Load Diff