Skip to content

Commit 876ee11

Browse files
authored
[Bounds Safety][NFC] Add some missing coverage for -fexperimental-late-parse-attributes (#102236)
Previously we weren't properly checking that using `-fexperimental-late-parse-attributes` worked on source code that didn't need late parsing. For example we weren't testing that the attribute appearing in the type position generated the right AST with `-fexperimental-late-parse-attributes` off. This patch adds additional `RUN` lines to re-run the relevant test cases with `-fexperimental-late-parse-attributes` enabled. rdar://133325597
1 parent 3e71357 commit 876ee11

21 files changed

+37
-8
lines changed

clang/test/AST/attr-counted-by-or-null-struct-ptrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
2+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
23

34
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
45

clang/test/AST/attr-counted-by-struct-ptrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
2+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
23

34
#define __counted_by(f) __attribute__((counted_by(f)))
45

clang/test/AST/attr-sized-by-or-null-struct-ptrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
2+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
23

34
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))
45

clang/test/AST/attr-sized-by-struct-ptrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
2+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
23

34
#define __sized_by(f) __attribute__((sized_by(f)))
45

clang/test/Sema/attr-counted-by-bounds-safety-vlas.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -verify %s
2+
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -fexperimental-late-parse-attributes -verify %s
23
//
34
// This is a portion of the `attr-counted-by-vla.c` test but is checked
45
// under the semantics of `-fexperimental-bounds-safety` which has different

clang/test/Sema/attr-counted-by-or-null-last-field.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %clang_cc1 -fsyntax-only -verify %s
1+
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
2+
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes -verify=expected,late %s
23

34
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
45

@@ -82,7 +83,9 @@ struct found_outside_of_struct {
8283

8384
struct self_referrential {
8485
int bork;
85-
struct bar *self[] __counted_by_or_null(self); // expected-error {{use of undeclared identifier 'self'}}
86+
// immediate-error@+2{{use of undeclared identifier 'self'}}
87+
// late-error@+1{{'counted_by_or_null' only applies to pointers; did you mean to use 'counted_by'?}}
88+
struct bar *self[] __counted_by_or_null(self);
8689
};
8790

8891
struct non_int_count {

clang/test/Sema/attr-counted-by-or-null-struct-ptrs-sizeless-types.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// __SVInt8_t is specific to ARM64 so specify that in the target triple
22
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
3+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
34

45
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
56

clang/test/Sema/attr-counted-by-or-null-struct-ptrs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s
23

34
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
45
#define __counted_by(f) __attribute__((counted_by(f)))

clang/test/Sema/attr-counted-by-or-null-vla-sizeless-types.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// __SVInt8_t is specific to ARM64 so specify that in the target triple
22
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
3+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
34

45
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
56

clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// __SVInt8_t is specific to ARM64 so specify that in the target triple
22
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
3+
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
34

45
#define __counted_by(f) __attribute__((counted_by(f)))
56

0 commit comments

Comments
 (0)