blob: 53ed0d724527231a80e5339d1d2749517987abbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code
// A destructor may be marked noreturn and should still influence the CFG.
void pr6884_abort() __attribute__((noreturn));
struct pr6884_abort_struct {
pr6884_abort_struct() {}
~pr6884_abort_struct() __attribute__((noreturn)) { pr6884_abort(); }
};
int pr6884_f(int x) {
switch (x) { default: pr6884_abort(); }
}
int pr6884_g(int x) {
switch (x) { default: pr6884_abort_struct(); }
}
int pr6884_g_positive(int x) {
switch (x) { default: ; }
} // expected-warning {{control reaches end of non-void function}}
int pr6884_h(int x) {
switch (x) {
default: {
pr6884_abort_struct a;
}
}
}
// PR9380
struct PR9380 {
~PR9380();
};
struct PR9380_B : public PR9380 {
PR9380_B( const PR9380& str );
};
void test_PR9380(const PR9380& aKey) {
const PR9380& flatKey = PR9380_B(aKey);
}
// Array of objects with destructors. This is purely a coverage test case.
void test_array() {
PR9380 a[2];
}
// Test classes wrapped in typedefs. This is purely a coverage test case
// for CFGImplictDtor::getDestructorDecl().
void test_typedefs() {
typedef PR9380 PR9380_Ty;
PR9380_Ty test;
PR9380_Ty test2[20];
}
// PR9412 - Handle CFG traversal with null successors.
enum PR9412_MatchType { PR9412_Exact };
template <PR9412_MatchType type> int PR9412_t() {
switch (type) {
case PR9412_Exact:
default:
break;
}
} // expected-warning {{control reaches end of non-void function}}
void PR9412_f() {
PR9412_t<PR9412_Exact>(); // expected-note {{in instantiation of function template specialization 'PR9412_t<0>' requested here}}
}
|