[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
This commit is contained in:
Dan Liew
2024-08-08 09:57:47 -07:00
committed by GitHub
parent 3e7135750c
commit 876ee11eee
21 changed files with 37 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s
#define __sized_by(f) __attribute__((sized_by(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -verify %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -fexperimental-late-parse-attributes -verify %s
//
// This is a portion of the `attr-counted-by-vla.c` test but is checked
// under the semantics of `-fexperimental-bounds-safety` which has different

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes -verify=expected,late %s
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
@@ -82,7 +83,9 @@ struct found_outside_of_struct {
struct self_referrential {
int bork;
struct bar *self[] __counted_by_or_null(self); // expected-error {{use of undeclared identifier 'self'}}
// immediate-error@+2{{use of undeclared identifier 'self'}}
// late-error@+1{{'counted_by_or_null' only applies to pointers; did you mean to use 'counted_by'?}}
struct bar *self[] __counted_by_or_null(self);
};
struct non_int_count {

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes %s -verify
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple arm64-apple-darwin -fexperimental-late-parse-attributes -fsyntax-only -verify %s
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes %s -verify=expected,late
#define __counted_by(f) __attribute__((counted_by(f)))
@@ -80,7 +81,9 @@ struct found_outside_of_struct {
struct self_referrential {
int bork;
struct bar *self[] __counted_by(self); // expected-error {{use of undeclared identifier 'self'}}
// immediate-error@+2{{use of undeclared identifier 'self'}}
// late-error@+1{{'counted_by' requires a non-boolean integer type argument}}
struct bar *self[] __counted_by(self);
};
struct non_int_count {

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify=expected,late %s
#define __sized_by(f) __attribute__((sized_by(f)))
@@ -82,7 +83,9 @@ struct found_outside_of_struct {
struct self_referrential {
int bork;
struct bar *self[] __sized_by(self); // expected-error {{use of undeclared identifier 'self'}}
// immediate-error@+2{{use of undeclared identifier 'self'}}
// late-error@+1{{'sized_by' only applies to pointers; did you mean to use 'counted_by'?}}
struct bar *self[] __sized_by(self);
};
struct non_int_size {

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes -verify=expected,late %s
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))
@@ -82,7 +83,9 @@ struct found_outside_of_struct {
struct self_referrential {
int bork;
struct bar *self[] __sized_by_or_null(self); // expected-error {{use of undeclared identifier 'self'}}
// immediate-error@+2{{use of undeclared identifier 'self'}}
// late-error@+1{{'sized_by_or_null' only applies to pointers; did you mean to use 'counted_by'?}}
struct bar *self[] __sized_by_or_null(self);
};
struct non_int_size {

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __sized_by(f) __attribute__((sized_by(f)))

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s
#define __sized_by(f) __attribute__((sized_by(f)))
#define __counted_by(f) __attribute__((counted_by(f)))

View File

@@ -1,5 +1,6 @@
// __SVInt8_t is specific to ARM64 so specify that in the target triple
// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes -triple arm64-apple-darwin -fsyntax-only -verify %s
#define __sized_by(f) __attribute__((sized_by(f)))