llvm-capstone/libcxxabi/test/uncaught_exceptions.pass.cpp
Louis Dionne 549048f390 [libc++] Make sure we re-export some missing libc++abi symbols from libc++
Summary:
Ensure we re-export __cxa_throw_bad_array_new_length and
__cxa_uncaught_exceptions from libc++, since they are now
provided by libc++abi.

Doing this allows us to stop linking explicitly against libc++abi in
the libc++abi tests, since libc++ re-exports all the necessary symbols.
However, there is one caveat to that. We don't want libc++ to re-export
__cxa_uncaught_exception (the singular form), since it's only provided
for backwards compatibility. Hence, for the single test where we check
this backwards compatibility, we explicitly link against libc++abi.

PR27405
PR22654

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D60424

llvm-svn: 358690
2019-04-18 17:18:15 +00:00

28 lines
770 B
C++

//===------------------- uncaught_exceptions.pass.cpp ---------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcxxabi-no-exceptions
#include <cxxabi.h>
#include <cassert>
// namespace __cxxabiv1 {
// extern unsigned int __cxa_uncaught_exceptions() throw();
// }
struct A {
A(unsigned cnt) : data_(cnt) {}
~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
unsigned data_;
};
int main () {
try { A a(1); throw 3; assert(false); }
catch (int) {}
}