initial import

llvm-svn: 130921
This commit is contained in:
Howard Hinnant 2011-05-05 15:27:28 +00:00
parent cd5afc5feb
commit d3da57f99b
9 changed files with 45145 additions and 0 deletions

13
libcxxabi/CREDITS.TXT Normal file
View File

@ -0,0 +1,13 @@
This file is a partial list of people who have contributed to the LLVM/libc++abi
project. If you have contributed a patch or made some other contribution to
LLVM/libc++abi, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++abi

76
libcxxabi/LICENSE.TXT Normal file
View File

@ -0,0 +1,76 @@
==============================================================================
libc++abi License
==============================================================================
The libc++abi library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,160 @@
//===-------------------------- 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

177
libcxxabi/include/cxxabi.h Normal file
View File

@ -0,0 +1,177 @@
//===--------------------------- cxxabi.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 __CXXABI_H
#define __CXXABI_H
/*
* This header provides the interface to the C++ ABI as defined at:
* http://www.codesourcery.com/cxx-abi/
*/
#include <stddef.h>
#include <stdint.h>
namespace std {
class type_info; // forward declaration
}
// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
namespace __cxxabiv1 {
extern "C" {
// 2.4.2 Allocating the Exception Object
extern void * __cxa_allocate_exception(size_t thrown_size) throw();
extern void __cxa_free_exception(void * thrown_exception) throw();
// 2.4.3 Throwing the Exception Object
extern void __cxa_throw(void * thrown_exception, struct std::type_info * tinfo,
void (*dest)(void *));
// 2.5.3 Exception Handlers
extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
extern void * __cxa_begin_catch(void * exceptionObject) throw();
extern void __cxa_end_catch();
extern std::type_info * __cxa_current_exception_type();
// 2.5.4 Rethrowing Exceptions
extern void __cxa_rethrow();
// 2.6 Auxiliary Runtime APIs
extern void __cxa_bad_cast();
extern void __cxa_bad_typeid();
// 3.2.6 Pure Virtual Function API
extern void __cxa_pure_virtual(void);
// 3.3.2 One-time Construction API
extern int __cxa_guard_acquire(uint64_t*);
extern void __cxa_guard_release(uint64_t*);
extern void __cxa_guard_abort(uint64_t*);
// 3.3.3 Array Construction and Destruction API
extern void* __cxa_vec_new(size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor)(void*),
void (*destructor)(void*) );
extern void* __cxa_vec_new2(size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor)(void*),
void (*destructor)(void*),
void* (*alloc)(size_t),
void (*dealloc)(void*) );
extern void* __cxa_vec_new3(size_t element_count,
size_t element_size,
size_t padding_size,
void (*constructor)(void*),
void (*destructor)(void*),
void* (*alloc)(size_t),
void (*dealloc)(void*, size_t) );
extern void __cxa_vec_ctor(void* array_address,
size_t element_count,
size_t element_size,
void (*constructor)(void*),
void (*destructor)(void*) );
extern void __cxa_vec_dtor(void* array_address,
size_t element_count,
size_t element_size,
void (*destructor)(void*) );
extern void __cxa_vec_cleanup(void* array_address,
size_t element_count,
size_t element_size,
void (*destructor)(void*) );
extern void __cxa_vec_delete(void* array_address,
size_t element_size,
size_t padding_size,
void (*destructor)(void*) );
extern void __cxa_vec_delete2(void* array_address,
size_t element_size,
size_t padding_size,
void (*destructor)(void*),
void (*dealloc)(void*) );
extern void __cxa_vec_delete3(void* __array_address,
size_t element_size,
size_t padding_size,
void (*destructor)(void*),
void (*dealloc) (void*, size_t));
extern void __cxa_vec_cctor(void* dest_array,
void* src_array,
size_t element_count,
size_t element_size,
void (*constructor) (void*, void*),
void (*destructor)(void*) );
// 3.3.5.3 Runtime API
extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
extern int __cxa_finalize(void*);
// 3.4 Demangler API
extern char* __cxa_demangle(const char* mangled_name,
char* output_buffer,
size_t* length,
int* status);
} // extern "C"
} // namespace __cxxabiv1
namespace abi = __cxxabiv1;
// Below are Apple extensions to support implementing C++ ABI in a seperate dylib
namespace __cxxabiapple {
extern "C" {
// Apple additions to support multiple STL stacks that share common
// terminate, unexpected, and new handlers
extern void (*__cxa_terminate_handler)();
extern void (*__cxa_unexpected_handler)();
extern void (*__cxa_new_handler)();
// Apple additions to support C++ 0x exception_ptr class
// These are primitives to wrap a smart pointer around an exception object
extern void * __cxa_current_primary_exception() throw();
extern void __cxa_rethrow_primary_exception(void* primary_exception);
extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
// Apple addition to support std::uncaught_exception()
extern bool __cxa_uncaught_exception() throw();
} // extern "C"
} // namespace __cxxabiv1
#endif // __CXXABI_H

14933
libcxxabi/src/cxa_demangle.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

27
libcxxabi/www/content.css Normal file
View File

@ -0,0 +1,27 @@
html { margin: 0px; } body { margin: 8px; }
html, body {
padding:0px;
font-size:small; font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, Helvetica, sans-serif; background-color: #fff; color: #222;
line-height:1.5;
}
h1, h2, h3, tt { color: #000 }
h1 { padding-top:0px; margin-top:0px;}
h2 { color:#333333; padding-top:0.5em; }
h3 { padding-top: 0.5em; margin-bottom: -0.25em; color:#2d58b7}
li { padding-bottom: 0.5em; }
ul { padding-left:1.5em; }
/* Slides */
IMG.img_slide {
display: block;
margin-left: auto;
margin-right: auto
}
.itemTitle { color:#2d58b7 }
/* Tables */
tr { vertical-align:top }

85
libcxxabi/www/index.html Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>"libc++abi" C++ Standard Library Support</title>
<link type="text/css" rel="stylesheet" href="menu.css">
<link type="text/css" rel="stylesheet" href="content.css">
</head>
<body>
<div id="menu">
<div>
<a href="http://llvm.org/">LLVM Home</a>
</div>
<div class="submenu">
<label>libc++abi Info</label>
<a href="/index.html">About</a>
</div>
<div class="submenu">
<label>Quick Links</label>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a>
<a href="http://llvm.org/bugs/">Bug Reports</a>
<a href="http://llvm.org/svn/llvm-project/libcxxabi/trunk/">Browse SVN</a>
<a href="http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/">Browse ViewVC</a>
</div>
</div>
<div id="content">
<!--*********************************************************************-->
<h1>"libc++abi" C++ Standard Library Support</h1>
<!--*********************************************************************-->
<p>libc++abi is a new implementation of low level support for a standard
C++ library.</p>
<p>All of the code in libc++abi is <a
href="http://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a>
under the MIT license and the UIUC License (a BSD-like license).</p>
<!--=====================================================================-->
<h2 id="goals">Features and Goals</h2>
<!--=====================================================================-->
<ul>
<li>Correctness as defined by the C++11 standard.</li>
<li>Provide a portable sublayer to ease the porting of libc++</li>
</ul>
<!--=====================================================================-->
<h2 id="requirements">Platform Support</h2>
<!--=====================================================================-->
<p>libc++abi is known to work on the following platforms, using clang.</p>
<ul>
</ul>
<!--=====================================================================-->
<h2 id="dir-structure">Current Status</h2>
<!--=====================================================================-->
<p>libc++abi is still under development. Most of it is currently missing.</p>
<!--=====================================================================-->
<h2>Get it and get involved!</h2>
<!--=====================================================================-->
<p>To check out the code, use:</p>
<ul>
<li><code>svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi</code></li>
</ul>
<p>Send discussions to the
(<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">clang mailing list</a>).</p>
</div>
</body>
</html>

39
libcxxabi/www/menu.css Normal file
View File

@ -0,0 +1,39 @@
/***************/
/* page layout */
/***************/
[id=menu] {
position:fixed;
width:25ex;
}
[id=content] {
/* ***** EDIT THIS VALUE IF CONTENT OVERLAPS MENU ***** */
position:absolute;
left:29ex;
padding-right:4ex;
}
/**************/
/* menu style */
/**************/
#menu .submenu {
padding-top:1em;
display:block;
}
#menu label {
display:block;
font-weight: bold;
text-align: center;
background-color: rgb(192,192,192);
}
#menu a {
padding:0 .2em;
display:block;
text-align: center;
background-color: rgb(235,235,235);
}
#menu a:visited {
color:rgb(100,50,100);
}