mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 22:38:56 -04:00

Currently there is only support for a -fno-exceptions libc++ build. This is problematic for functions such as std::terminate() which are defined in libc++abi and using any of those functions throws away most of the benefits of using -fno-exceptions (code-size). This patch introduces a -fno-exceptions libc++abi build to address this issue. This new variant of libc++abi cannot be linked against any with-exceptions code as some symbols necessary for handling exceptions are missing in this library. Differential revision: http://reviews.llvm.org/D20677 Reviewers: EricWF, mclow.lists, bcraig llvm-svn: 271267
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
//===-------------------------- test_aux_runtime_op_array_new.cpp ---------===//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: libcxxabi-no-exceptions
|
|
|
|
#include <iostream>
|
|
#include <cxxabi.h>
|
|
|
|
// If the expression passed to operator new[] would result in an overflow, the
|
|
// allocation function is not called, and a std::bad_array_new_length exception
|
|
// is thrown instead (5.3.4p7).
|
|
bool bad_array_new_length_test() {
|
|
try {
|
|
// We test this directly because Clang does not currently codegen the
|
|
// correct call to __cxa_bad_array_new_length, so this test would result
|
|
// in passing -1 to ::operator new[], which would then throw a
|
|
// std::bad_alloc, causing the test to fail.
|
|
__cxxabiv1::__cxa_throw_bad_array_new_length();
|
|
} catch ( const std::bad_array_new_length &banl ) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int main(int argc, char *argv []) {
|
|
int ret_val = 0;
|
|
|
|
if ( !bad_array_new_length_test ()) {
|
|
std::cerr << "Bad array new length test failed!" << std::endl;
|
|
ret_val = 1;
|
|
}
|
|
|
|
return ret_val;
|
|
}
|