Updates Tests for Improved Bounds Inference (#180)

These tests go along with checkedc-clang cd04c02dd395d776b74e6c463af58384cdd5b7f2
This commit is contained in:
Sam Elliott 2017-07-06 10:20:19 -07:00 коммит произвёл GitHub
Родитель f11e01597b
Коммит 4d9dc92673
2 изменённых файлов: 2 добавлений и 7 удалений

Просмотреть файл

@ -815,12 +815,10 @@ void test_addrof_checked_scope(void) checked {
x = &a[i]; // ImplicitCastExpr _Ptr (UnaryOperator _Array_ptr<int>)
y = &b[1]; // ImplicitCastExpr _Ptr (UnaryOperator _Array_ptr<int>) \
// expected-error {{expression has no bounds, right-hand side of assignment expected to have bounds}} \
// expected-error {{expression has no bounds, cast to ptr<T> expects source to have bounds}}
z = &i; // ImplicitCastExpr _Ptr (UnaryOperator _Array_Ptr<int>)
x = b; // BinaryOperator (ImplicitCastExpr _Ptr (_Array_ptr)) \
// expected-error {{expression has no bounds, right-hand side of assignment expected to have bounds}} \
// expected-error {{expression has no bounds, cast to ptr<T> expects source to have bounds}}
array_ptr<int> ax = &a[i];
@ -861,12 +859,10 @@ void test_addrof_unchecked_scope(void) unchecked {
// implicit cast for _Ptr<T> requires source bounds
x = &a[i]; // BinaryOperator(ImplicitCastExpr _Ptr<int>(UnaryOperator int * prefix &))
y = &b[0]; // BinaryOperator(ImplicitCastExpr _Ptr<int>(UnaryOperator int * prefix &)) \
// expected-error {{expression has no bounds, right-hand side of assignment expected to have bounds}} \
// expected-error {{expression has no bounds, cast to ptr<T> expects source to have bounds}}
z = &i; // BinaryOperator(ImplicitCastExpr _Ptr<int>(UnaryOperator int * prefix &))
x = b; // BinaryOperator(ImplicitCastExpr()) \
// expected-error {{expression has no bounds, right-hand side of assignment expected to have bounds}} \
// expected-error {{expression has no bounds, cast to ptr<T> expects source to have bounds}}
// checkSingleAssignmentConstraints(int * -> _Array_ptr<int> implicit casting)

Просмотреть файл

@ -709,7 +709,7 @@ extern void g4(int y, _Bool p) {
// returns a new pointer type
//
extern int *h1(void) {
extern int *h1(void) : itype(ptr<int>) {
return 0;
}
@ -717,7 +717,7 @@ extern ptr<int> h2(void) {
return 0;
}
extern array_ptr<int> h3(void) {
extern array_ptr<int> h3(void) : count(0) {
return 0;
}
@ -805,7 +805,6 @@ extern void check_call(void) {
// Check return values
//
int *t1 = h1();
// TODO: h1 needs bounds-safe interface
ptr<int> t2 = h1();
array_ptr<int> t3 = h1(); // OK, provided that t3 has no bounds.
ptr<int> t4 = h2();