Skip to content

Commit 8401770

Browse files
Remove hard-coded checked declarations from 3C regression tests. (#576)
1 parent 1fac188 commit 8401770

File tree

302 files changed

+847
-3800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+847
-3800
lines changed

clang/test/3C/3d-allocation.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#include <stdio.h>
99
#include <stdlib.h>
1010

11-
extern _Itype_for_any(T) void *malloc(size_t size)
12-
: itype(_Array_ptr<T>) byte_count(size);
13-
1411
int ***malloc3d(int y, int x, int z) {
1512
//CHECK_NOALL: int ***malloc3d(int y, int x, int z) : itype(_Ptr<int **>) {
1613
//CHECK_ALL: _Array_ptr<_Array_ptr<_Array_ptr<int>>> malloc3d(int y, int x, int z) : count(y) {

clang/test/3C/add_bounds.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ void biz(){
3535
//CHECK_ALL: _Array_ptr<int> b : count(10) = a;
3636
}
3737

38-
#include<stddef.h>
39-
_Itype_for_any(T) void *malloc(size_t size) : itype(_Array_ptr<T>) byte_count(size);
38+
#include <stdlib.h>
4039
_Array_ptr<int> faz(void) {
4140
//CHECK_ALL: _Array_ptr<int> faz(void) : count(100) {
4241
int *c = malloc(100 * sizeof(int));

clang/test/3C/alloc_type_param.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/alloc_type_param.c -- | diff %t.checked/alloc_type_param.c -
77

8-
#include <stddef.h>
9-
extern _Itype_for_any(T) void *calloc(size_t nmemb, size_t size)
10-
: itype(_Array_ptr<T>) byte_count(nmemb * size);
11-
extern _Itype_for_any(T) void *malloc(size_t size)
12-
: itype(_Array_ptr<T>) byte_count(size);
13-
extern _Itype_for_any(T) void *realloc(void *pointer
14-
: itype(_Array_ptr<T>) byte_count(1),
15-
size_t size)
16-
: itype(_Array_ptr<T>) byte_count(size);
8+
#include <stdlib.h>
179

1810
/* Check basic behavior with the three alloc functions */
1911
void foo() {

clang/test/3C/allocator.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
// RUN: 3c -base-dir=%t.checked %t.checked/allocator.c -- | diff %t.checked/allocator.c -
1010
// expected-no-diagnostics
1111
//
12-
#include <stddef.h>
13-
_Itype_for_any(T) void *malloc(size_t size)
14-
: itype(_Array_ptr<T>) byte_count(size);
15-
_Itype_for_any(T) void free(void *pointer : itype(_Array_ptr<T>) byte_count(0));
12+
#include <stdlib.h>
1613

1714
void dosomething(void) {
1815
int a = 0;

clang/test/3C/arrboundsbasic.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,7 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
10-
11-
extern _Itype_for_any(T) void *calloc(size_t nmemb, size_t size)
12-
: itype(_Array_ptr<T>) byte_count(nmemb * size);
13-
extern _Itype_for_any(T) void free(void *pointer
14-
: itype(_Array_ptr<T>) byte_count(0));
15-
extern _Itype_for_any(T) void *malloc(size_t size)
16-
: itype(_Array_ptr<T>) byte_count(size);
17-
extern _Itype_for_any(T) void *realloc(void *pointer
18-
: itype(_Array_ptr<T>) byte_count(1),
19-
size_t size)
20-
: itype(_Array_ptr<T>) byte_count(size);
9+
#include <stdlib.h>
2110

2211
struct bar {
2312
char *a;

clang/test/3C/arrboundsbasicinfer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
10-
11-
extern _Itype_for_any(T) void *malloc(size_t size)
12-
: itype(_Array_ptr<T>) byte_count(size);
9+
#include <stdlib.h>
1310

1411
struct bar {
1512
char *a;

clang/test/3C/arrboundsbyte.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
Array bounds (byte_bound) tests with data-flow analysis.
77
*/
88

9-
#include <stddef.h>
10-
_Itype_for_any(T) void *malloc(size_t size)
11-
: itype(_Array_ptr<T>) byte_count(size);
12-
int *memcpy(int *restrict dest
13-
: itype(restrict _Array_ptr<int>) byte_count(n),
14-
const int *restrict src
15-
: itype(restrict _Array_ptr<const int>) byte_count(n), size_t n)
9+
#include <stdlib.h>
10+
// This test needs a custom version of memcpy where src and dest are `int *`.
11+
int *memcpy_int(int *restrict dest
12+
: itype(restrict _Array_ptr<int>) byte_count(n),
13+
const int *restrict src
14+
: itype(restrict _Array_ptr<const int>) byte_count(n), size_t n)
1615
: itype(_Array_ptr<int>) byte_count(n);
16+
1717
struct foo {
1818
int *y;
1919
int l;
@@ -22,7 +22,7 @@ struct foo {
2222
void bar(int *x, int c) {
2323
struct foo f = {x, c};
2424
int *q = malloc(sizeof(int) * c);
25-
memcpy(q, f.y, c);
25+
memcpy_int(q, f.y, c);
2626
}
2727
//CHECK: void bar(_Array_ptr<int> x : byte_count(c), int c) {
2828
//CHECK: _Array_ptr<int> q : count(c) = malloc<int>(sizeof(int) * c);

clang/test/3C/arrboundsheuristics.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
int *glob;
1212
int lenplusone;
13-
#include <stddef.h>
14-
extern _Itype_for_any(T) void *malloc(size_t size)
15-
: itype(_Array_ptr<T>) byte_count(size);
13+
#include <stdlib.h>
1614
//CHECK_ALL: _Array_ptr<int> glob = ((void *)0);
1715
//CHECK_NOALL: int *glob;
1816

clang/test/3C/arrboundsinfer2.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
9+
#include <stdlib.h>
1010

11-
extern _Itype_for_any(T) void *malloc(size_t size)
12-
: itype(_Array_ptr<T>) byte_count(size);
1311
extern void ext_func(_Array_ptr<int> arr : count(len), unsigned len);
1412

1513
struct bar {

clang/test/3C/arrctxsenbounds.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
/*
66
Context-sensitive array-bounds inference.
77
*/
8-
typedef long size_t;
9-
extern _Itype_for_any(T) void *malloc(size_t size)
10-
: itype(_Array_ptr<T>) byte_count(size);
8+
#include <stdlib.h>
119
struct foo {
1210
int *x;
1311
unsigned olol;

0 commit comments

Comments
 (0)