summaryrefslogtreecommitdiffstats
path: root/libcxxabi
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2016-01-15 15:44:14 +0000
committerNico Weber <nicolasweber@gmx.de>2016-01-15 15:44:14 +0000
commit6977ee7f4cbb9d55ff4251ce8dcbc8103571758b (patch)
tree97d70ce783ca4ef5cd40f1b22b2575a74e092dc7 /libcxxabi
parentf7d5e4086023df156a103578b8870732b808ecbc (diff)
downloadbcm5719-llvm-6977ee7f4cbb9d55ff4251ce8dcbc8103571758b.tar.gz
bcm5719-llvm-6977ee7f4cbb9d55ff4251ce8dcbc8103571758b.zip
Revert r256322 (and follow-up 256323), the test it added does not pass on OS X.
llvm-svn: 257896
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/src/private_typeinfo.cpp34
-rw-r--r--libcxxabi/test/incomplete_type.sh.cpp162
2 files changed, 17 insertions, 179 deletions
diff --git a/libcxxabi/src/private_typeinfo.cpp b/libcxxabi/src/private_typeinfo.cpp
index df03596e8b6..beacd701d51 100644
--- a/libcxxabi/src/private_typeinfo.cpp
+++ b/libcxxabi/src/private_typeinfo.cpp
@@ -34,12 +34,9 @@
//
// _LIBCXX_DYNAMIC_FALLBACK is currently off by default.
-
-#include <string.h>
-
-
#ifdef _LIBCXX_DYNAMIC_FALLBACK
#include "abort_message.h"
+#include <string.h>
#include <sys/syslog.h>
#endif
@@ -60,19 +57,31 @@ namespace __cxxabiv1
#pragma GCC visibility push(hidden)
+#ifdef _LIBCXX_DYNAMIC_FALLBACK
+
inline
bool
is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
{
-#ifndef _WIN32
if (!use_strcmp)
return x == y;
return strcmp(x->name(), y->name()) == 0;
+}
+
+#else // !_LIBCXX_DYNAMIC_FALLBACK
+
+inline
+bool
+is_equal(const std::type_info* x, const std::type_info* y, bool)
+{
+#ifndef _WIN32
+ return x == y;
#else
return (x == y) || (strcmp(x->name(), y->name()) == 0);
-#endif
+#endif
}
+#endif // _LIBCXX_DYNAMIC_FALLBACK
// __shim_type_info
@@ -342,17 +351,8 @@ bool
__pbase_type_info::can_catch(const __shim_type_info* thrown_type,
void*&) const
{
- if (is_equal(thrown_type, &typeid(std::nullptr_t), false)) return true;
- bool use_strcmp = this->__flags & (__incomplete_class_mask |
- __incomplete_mask);
- if (!use_strcmp) {
- const __pbase_type_info* thrown_pbase = dynamic_cast<const __pbase_type_info*>(
- thrown_type);
- if (!thrown_pbase) return false;
- use_strcmp = thrown_pbase->__flags & (__incomplete_class_mask |
- __incomplete_mask);
- }
- return is_equal(this, thrown_type, use_strcmp);
+ return is_equal(this, thrown_type, false) ||
+ is_equal(thrown_type, &typeid(std::nullptr_t), false);
}
#ifdef __clang__
diff --git a/libcxxabi/test/incomplete_type.sh.cpp b/libcxxabi/test/incomplete_type.sh.cpp
deleted file mode 100644
index a806c6d33d7..00000000000
--- a/libcxxabi/test/incomplete_type.sh.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-//===------------------------- incomplete_type.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.
-//
-//===----------------------------------------------------------------------===//
-// http://mentorembedded.github.io/cxx-abi/abi.html#rtti-layout
-
-// Two abi::__pbase_type_info objects can always be compared for equality
-// (i.e. of the types represented) or ordering by comparison of their name
-// NTBS addresses. In addition, unless either or both have either of the
-// incomplete flags set, equality can be tested by comparing the type_info
-// addresses.
-
-// RUN: %cxx %flags %compile_flags -c %s -o %t.one.o
-// RUN: %cxx %flags %compile_flags -c %s -o %t.two.o -DTU_ONE
-// RUN: %cxx %flags %link_flags -o %t.exe %t.one.o %t.two.o
-// RUN: %t.exe
-
-#include <stdio.h>
-#include <cassert>
-#include <typeinfo>
-
-struct NeverDefined;
-void ThrowNeverDefinedMP();
-
-struct IncompleteAtThrow;
-void ThrowIncompleteMP();
-void ThrowIncompletePP();
-void ThrowIncompletePMP();
-std::type_info const& ReturnTypeInfoIncompleteMP();
-std::type_info const& ReturnTypeInfoIncompletePP();
-
-struct CompleteAtThrow;
-void ThrowCompleteMP();
-void ThrowCompletePP();
-void ThrowCompletePMP();
-std::type_info const& ReturnTypeInfoCompleteMP();
-std::type_info const& ReturnTypeInfoCompletePP();
-
-void ThrowNullptr();
-
-#ifndef TU_ONE
-
-void ThrowNeverDefinedMP() { throw (int NeverDefined::*)nullptr; }
-
-void ThrowIncompleteMP() { throw (int IncompleteAtThrow::*)nullptr; }
-void ThrowIncompletePP() { throw (IncompleteAtThrow**)nullptr; }
-void ThrowIncompletePMP() { throw (int IncompleteAtThrow::**)nullptr; }
-
-std::type_info const& ReturnTypeInfoIncompleteMP() { return typeid(int IncompleteAtThrow::*); }
-std::type_info const& ReturnTypeInfoIncompletePP() { return typeid(IncompleteAtThrow**); }
-
-struct CompleteAtThrow {};
-void ThrowCompleteMP() { throw (int CompleteAtThrow::*)nullptr; }
-void ThrowCompletePP() { throw (CompleteAtThrow**)nullptr; }
-void ThrowCompletePMP() { throw (int CompleteAtThrow::**)nullptr; }
-
-std::type_info const& ReturnTypeInfoCompleteMP() { return typeid(int CompleteAtThrow::*); }
-std::type_info const& ReturnTypeInfoCompletePP() { return typeid(CompleteAtThrow**); }
-
-void ThrowNullptr() { throw nullptr; }
-
-#else
-
-struct IncompleteAtThrow {};
-
-int main() {
- try {
- ThrowNeverDefinedMP();
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (int CompleteAtThrow::*) {
- assert(false);
- } catch (int NeverDefined::*) {}
-
- assert(ReturnTypeInfoIncompleteMP() != typeid(int IncompleteAtThrow::*));
- try {
- ThrowIncompleteMP();
- assert(false);
- } catch (CompleteAtThrow**) {
- assert(false);
- } catch (int CompleteAtThrow::*) {
- assert(false);
- } catch (IncompleteAtThrow**) {
- assert(false);
- } catch (int IncompleteAtThrow::*) {}
-
- assert(ReturnTypeInfoIncompletePP() != typeid(IncompleteAtThrow**));
- try {
- ThrowIncompletePP();
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (IncompleteAtThrow**) {}
-
- try {
- ThrowIncompletePMP();
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (IncompleteAtThrow**) {
- assert(false);
- } catch (int IncompleteAtThrow::**) {}
-
- assert(ReturnTypeInfoCompleteMP() != typeid(int CompleteAtThrow::*));
- try {
- ThrowCompleteMP();
- assert(false);
- } catch (IncompleteAtThrow**) {
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (CompleteAtThrow**) {
- assert(false);
- } catch (int CompleteAtThrow::*) {}
-
- assert(ReturnTypeInfoCompletePP() != typeid(CompleteAtThrow**));
- try {
- ThrowCompletePP();
- assert(false);
- } catch (IncompleteAtThrow**) {
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (int CompleteAtThrow::*) {
- assert(false);
- } catch (CompleteAtThrow**) {}
-
- try {
- ThrowCompletePMP();
- assert(false);
- } catch (IncompleteAtThrow**) {
- assert(false);
- } catch (int IncompleteAtThrow::*) {
- assert(false);
- } catch (int CompleteAtThrow::*) {
- assert(false);
- } catch (CompleteAtThrow**) {
- assert(false);
- } catch (int CompleteAtThrow::**) {}
-
-#if __cplusplus >= 201103L
- // Catch nullptr as complete type
- try {
- ThrowNullptr();
- } catch (int IncompleteAtThrow::*) {}
-
- // Catch nullptr as an incomplete type
- try {
- ThrowNullptr();
- } catch (int CompleteAtThrow::*) {}
- // Catch nullptr as a type that is never complete.
- try {
- ThrowNullptr();
- } catch (int NeverDefined::*) {}
-#endif
-}
-#endif
OpenPOWER on IntegriCloud