annotate libcxxabi/test/uncaught_exceptions.pass.cpp @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents 1d019706d866
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===------------------- uncaught_exceptions.pass.cpp ---------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 // UNSUPPORTED: no-exceptions
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 #include <cxxabi.h>
anatofuz
parents:
diff changeset
12 #include <cassert>
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 // namespace __cxxabiv1 {
anatofuz
parents:
diff changeset
15 // extern unsigned int __cxa_uncaught_exceptions() throw();
anatofuz
parents:
diff changeset
16 // }
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 struct A {
anatofuz
parents:
diff changeset
19 A(unsigned cnt) : data_(cnt) {}
anatofuz
parents:
diff changeset
20 ~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
anatofuz
parents:
diff changeset
21 unsigned data_;
anatofuz
parents:
diff changeset
22 };
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 int main () {
anatofuz
parents:
diff changeset
25 try { A a(1); throw 3; assert(false); }
anatofuz
parents:
diff changeset
26 catch (int) {}
anatofuz
parents:
diff changeset
27 }