2020-09-03 05:50:32 +08:00
|
|
|
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple %itanium_abi_triple -std=c++11 -fexceptions -fcxx-exceptions -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name trycatch.cpp %s | FileCheck %s
|
2014-08-20 01:32:30 +08:00
|
|
|
|
|
|
|
class Error {
|
|
|
|
};
|
|
|
|
|
|
|
|
class ImportantError {
|
|
|
|
};
|
|
|
|
|
|
|
|
class Warning {
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: func
|
2015-04-28 14:31:55 +08:00
|
|
|
void func(int i) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> {{[0-9]+}}:2 = #0
|
|
|
|
// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:11 = #0
|
2017-11-09 10:33:38 +08:00
|
|
|
if(i % 2) { // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+4]]:4 = #1
|
2021-03-05 03:50:31 +08:00
|
|
|
throw Error(); // CHECK-NEXT: Gap,File 0, [[@LINE]]:19 -> [[@LINE+1]]:5 = 0
|
2015-04-28 14:31:55 +08:00
|
|
|
int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:4 = 0
|
2017-11-09 10:33:38 +08:00
|
|
|
// CHECK: File 0, [[@LINE+1]]:10 -> [[@LINE+2]]:27 = (#0 - #1)
|
2015-04-28 14:31:55 +08:00
|
|
|
} else if(i == 8) // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE]]:19 = (#0 - #1)
|
2017-11-09 10:33:38 +08:00
|
|
|
throw ImportantError(); // CHECK: File 0, [[@LINE]]:5 -> [[@LINE]]:27 = #2
|
2018-05-31 07:35:44 +08:00
|
|
|
}
|
2014-08-20 01:32:30 +08:00
|
|
|
|
|
|
|
// CHECK-NEXT: main
|
2015-02-04 05:35:49 +08:00
|
|
|
int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+13]]:2 = #0
|
2015-04-28 14:31:55 +08:00
|
|
|
int j = 1;
|
2016-06-23 03:57:58 +08:00
|
|
|
try { // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE+2]]:4 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
func(j);
|
2015-02-19 05:24:51 +08:00
|
|
|
} catch(const Error &e) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+2]]:4 = #2
|
2014-08-20 01:32:30 +08:00
|
|
|
j = 1;
|
2015-02-19 05:24:51 +08:00
|
|
|
} catch(const ImportantError &e) { // CHECK-NEXT: File 0, [[@LINE]]:36 -> [[@LINE+2]]:4 = #3
|
2014-08-20 01:32:30 +08:00
|
|
|
j = 11;
|
|
|
|
}
|
2015-02-04 05:35:49 +08:00
|
|
|
catch(const Warning &w) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+2]]:4 = #4
|
2014-08-20 01:32:30 +08:00
|
|
|
j = 0;
|
|
|
|
}
|
2015-02-04 05:35:49 +08:00
|
|
|
return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = #1
|
2014-08-20 01:32:30 +08:00
|
|
|
}
|