Skip to content
Browse files

Revert "Replaced libelftc's demangler with the one from libc++abi."

This reverts commit 958237c.
  • Loading branch information...
1 parent 7b63760 commit d54259432e7356448a1975dadb64cf97b528b340 C committed May 22, 2011
Showing with 3,526 additions and 15,125 deletions.
  1. +1 −1 src/CMakeLists.txt
  2. +0 −14,933 src/cxa_demangle.cpp
  3. +0 −160 src/cxa_demangle.h
  4. +0 −29 src/cxxabi.h
  5. +1 −2 src/doxygen_config
  6. +3,473 −0 src/libelftc_dem_gnu3.c
  7. +51 −0 src/typeinfo.cc
View
2 src/CMakeLists.txt
@@ -1,13 +1,13 @@
set(CXXRT_SOURCES
- cxa_demangle.h
dynamic_cast.cc
exception.cc
guard.cc
stdexcept.cc
typeinfo.cc
memory.cc
aux.cc
+ libelftc_dem_gnu3.c
)
View
14,933 src/cxa_demangle.cpp
0 additions, 14,933 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
160 src/cxa_demangle.h
@@ -1,160 +0,0 @@
-//===-------------------------- 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>
-
-namespace __cxxabiv1
-{
-
-namespace __libcxxabi
-{
-
-struct __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_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
-} // __cxxabiv1
-
-#endif // _CXA_DEMANGLE_H
View
29 src/cxxabi.h
@@ -1,29 +0,0 @@
-#ifndef __CXX_ABI_H_INCLUDED__
-#define __CXX_ABI_H_INCLUDED__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * Demangles a C++ symbol or type name. The buffer, if non-NULL, must be
- * allocated with malloc() and must be *n bytes or more long. This function
- * may call realloc() on the value pointed to by buf, and will return the
- * length of the string via *n.
- *
- * The value pointed to by status is set to one of the following:
- *
- * 0: success
- * -1: memory allocation failure
- * -2: invalid mangled name
- * -3: invalid arguments
- */
-char* __cxa_demangle(const char* mangled_name,
- char* buf,
- size_t* n,
- int* status);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __CXX_ABI_H_INCLUDED__
View
3 src/doxygen_config
@@ -617,8 +617,7 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
-# Exclude files from external sources from the doxygen stuff
-EXCLUDE_PATTERNS = cxa*
+EXCLUDE_PATTERNS = *libelf*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
View
3,473 src/libelftc_dem_gnu3.c
3,473 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
51 src/typeinfo.cc
@@ -43,3 +43,54 @@ ABI_NAMESPACE::__pbase_type_info::~__pbase_type_info() {}
ABI_NAMESPACE::__pointer_type_info::~__pointer_type_info() {}
ABI_NAMESPACE::__pointer_to_member_type_info::~__pointer_to_member_type_info() {}
+// From libelftc
+extern "C" char *__cxa_demangle_gnu3(const char *);
+
+/**
+ * Demangles a C++ symbol or type name. The buffer, if non-NULL, must be
+ * allocated with malloc() and must be *n bytes or more long. This function
+ * may call realloc() on the value pointed to by buf, and will return the
+ * length of the string via *n.
+ *
+ * The value pointed to by status is set to one of the following:
+ *
+ * 0: success
+ * -1: memory allocation failure
+ * -2: invalid mangled name
+ * -3: invalid arguments
+ */
+extern "C" char* __cxa_demangle(const char* mangled_name,
+ char* buf,
+ size_t* n,
+ int* status)
+{
+ // TODO: We should probably just be linking against libelf-tc, rather than
+ // copying their code. This requires them to do an actual release,
+ // however, and for our changes to be pushed upstream. We also need to
+ // call a different demangling function here depending on the ABI (e.g.
+ // ARM).
+ char *demangled = __cxa_demangle_gnu3(mangled_name);
+ if (NULL != demangled)
+ {
+ size_t len = strlen(demangled);
+ buf = (char*)realloc(buf, len+1);
+ if (0 != buf)
+ {
+ memcpy(buf, demangled, len);
+ buf[len] = 0;
+ *n = len;
+ *status = 0;
+ }
+ else
+ {
+ *status = -1;
+ }
+ free(demangled);
+ }
+ else
+ {
+ *status = -2;
+ return NULL;
+ }
+ return buf;
+}

0 comments on commit d542594

Please sign in to comment.
Something went wrong with that request. Please try again.