Skip to content

Commit d3f4b9b

Browse files
committed
add test
1 parent c723475 commit d3f4b9b

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

clang/test/3C/bodiless.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// RUN: 3c %s > %S/temp_bodiless.c
2+
// RUN: %clang -c %S/temp_bodiless.c
3+
// RUN: FileCheck -match-full-lines --input-file %S/temp_bodiless.c %s
4+
// RUN: rm %S/temp_bodiless.c
5+
6+
/***********************************************/
7+
/* Tests that functions without bodies */
8+
/* are marked wild when there is no interface */
9+
/***********************************************/
10+
11+
static int *foo1(void) { return (void *)0; }
12+
void test1() {
13+
int *a = foo1();
14+
}
15+
//CHECK _Ptr<int> a = foo1();
16+
17+
static int *foo2(void);
18+
void test2() {
19+
int *a = foo2();
20+
}
21+
//CHECK int *a = foo2();
22+
23+
int *foo3(void) { return (void *)0; }
24+
void test3() {
25+
int *a = foo3();
26+
}
27+
//CHECK: _Ptr<int> a = foo3();
28+
29+
int *foo4(void);
30+
void test4() {
31+
int *a = foo4();
32+
}
33+
//CHECK: int *a = foo4();
34+
35+
int *foo5(void) : itype(_Ptr<int>);
36+
void test5() {
37+
int *a = foo5();
38+
}
39+
//CHECK: _Ptr<int> a = foo5();
40+
41+
extern int *foo6(void);
42+
void test6() {
43+
int *a = foo6();
44+
}
45+
//CHECK: int *a = foo6();
46+
47+
extern int *foo7(void) : itype(_Ptr<int>);
48+
void test7() {
49+
int *a = foo7();
50+
}
51+
//CHECK: _Ptr<int> a = foo7();
52+
53+
54+
// parameters are not defined and therefore unchecked
55+
extern int *foo8() : itype(_Ptr<int>);
56+
void test8() {
57+
int *a = foo8();
58+
}
59+
//CHECK: int *a = foo8();
60+

0 commit comments

Comments
 (0)