Skip to content

Commit dd9511d

Browse files
committed
[clang][Interp][NFC] Convert test case to verify=expected,both style
1 parent 7ec6e73 commit dd9511d

File tree

1 file changed

+39
-64
lines changed

1 file changed

+39
-64
lines changed

clang/test/AST/Interp/builtin-functions.cpp

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify
2-
// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify
3-
// RUN: %clang_cc1 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated
4-
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify
5-
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify
6-
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated
7-
// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify
8-
// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -verify=ref %s -Wno-constant-evaluated
1+
// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both
2+
// RUN: %clang_cc1 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify=expected,both
3+
// RUN: %clang_cc1 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated
4+
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both
5+
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter -triple i686 %s -verify=expected,both
6+
// RUN: %clang_cc1 -std=c++20 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated
7+
// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -fexperimental-new-constant-interpreter %s -verify=expected,both
8+
// RUN: %clang_cc1 -triple avr -std=c++20 -Wno-string-plus-int -verify=ref,both %s -Wno-constant-evaluated
99

1010

1111
namespace strcmp {
@@ -23,23 +23,17 @@ namespace strcmp {
2323
static_assert(__builtin_strcmp("abab\0banana", "abab") == 0, "");
2424
static_assert(__builtin_strcmp("abab", "abab\0banana") == 0, "");
2525
static_assert(__builtin_strcmp("abab\0banana", "abab\0canada") == 0, "");
26-
static_assert(__builtin_strcmp(0, "abab") == 0, ""); // expected-error {{not an integral constant}} \
27-
// expected-note {{dereferenced null}} \
28-
// expected-note {{in call to}} \
29-
// ref-error {{not an integral constant}} \
30-
// ref-note {{dereferenced null}}
31-
static_assert(__builtin_strcmp("abab", 0) == 0, ""); // expected-error {{not an integral constant}} \
32-
// expected-note {{dereferenced null}} \
33-
// expected-note {{in call to}} \
34-
// ref-error {{not an integral constant}} \
35-
// ref-note {{dereferenced null}}
26+
static_assert(__builtin_strcmp(0, "abab") == 0, ""); // both-error {{not an integral constant}} \
27+
// both-note {{dereferenced null}} \
28+
// expected-note {{in call to}}
29+
static_assert(__builtin_strcmp("abab", 0) == 0, ""); // both-error {{not an integral constant}} \
30+
// both-note {{dereferenced null}} \
31+
// expected-note {{in call to}}
3632

3733
static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar) == -1, "");
38-
static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar + 6) == 0, ""); // expected-error {{not an integral constant}} \
39-
// expected-note {{dereferenced one-past-the-end}} \
40-
// expected-note {{in call to}} \
41-
// ref-error {{not an integral constant}} \
42-
// ref-note {{dereferenced one-past-the-end}}
34+
static_assert(__builtin_strcmp(kFoobar, kFoobazfoobar + 6) == 0, ""); // both-error {{not an integral constant}} \
35+
// both-note {{dereferenced one-past-the-end}} \
36+
// expected-note {{in call to}}
4337
}
4438

4539
/// Copied from constant-expression-cxx11.cpp
@@ -69,41 +63,27 @@ constexpr const char *a = "foo\0quux";
6963
static_assert(check(b), "");
7064
static_assert(check(c), "");
7165

72-
constexpr int over1 = __builtin_strlen(a + 9); // expected-error {{constant expression}} \
73-
// expected-note {{one-past-the-end}} \
74-
// expected-note {{in call to}} \
75-
// ref-error {{constant expression}} \
76-
// ref-note {{one-past-the-end}}
77-
constexpr int over2 = __builtin_strlen(b + 9); // expected-error {{constant expression}} \
78-
// expected-note {{one-past-the-end}} \
79-
// expected-note {{in call to}} \
80-
// ref-error {{constant expression}} \
81-
// ref-note {{one-past-the-end}}
82-
constexpr int over3 = __builtin_strlen(c + 9); // expected-error {{constant expression}} \
83-
// expected-note {{one-past-the-end}} \
84-
// expected-note {{in call to}} \
85-
// ref-error {{constant expression}} \
86-
// ref-note {{one-past-the-end}}
87-
88-
constexpr int under1 = __builtin_strlen(a - 1); // expected-error {{constant expression}} \
89-
// expected-note {{cannot refer to element -1}} \
90-
// ref-error {{constant expression}} \
91-
// ref-note {{cannot refer to element -1}}
92-
constexpr int under2 = __builtin_strlen(b - 1); // expected-error {{constant expression}} \
93-
// expected-note {{cannot refer to element -1}} \
94-
// ref-error {{constant expression}} \
95-
// ref-note {{cannot refer to element -1}}
96-
constexpr int under3 = __builtin_strlen(c - 1); // expected-error {{constant expression}} \
97-
// expected-note {{cannot refer to element -1}} \
98-
// ref-error {{constant expression}} \
99-
// ref-note {{cannot refer to element -1}}
66+
constexpr int over1 = __builtin_strlen(a + 9); // both-error {{constant expression}} \
67+
// both-note {{one-past-the-end}} \
68+
// expected-note {{in call to}}
69+
constexpr int over2 = __builtin_strlen(b + 9); // both-error {{constant expression}} \
70+
// both-note {{one-past-the-end}} \
71+
// expected-note {{in call to}}
72+
constexpr int over3 = __builtin_strlen(c + 9); // both-error {{constant expression}} \
73+
// both-note {{one-past-the-end}} \
74+
// expected-note {{in call to}}
75+
76+
constexpr int under1 = __builtin_strlen(a - 1); // both-error {{constant expression}} \
77+
// both-note {{cannot refer to element -1}}
78+
constexpr int under2 = __builtin_strlen(b - 1); // both-error {{constant expression}} \
79+
// both-note {{cannot refer to element -1}}
80+
constexpr int under3 = __builtin_strlen(c - 1); // both-error {{constant expression}} \
81+
// both-note {{cannot refer to element -1}}
10082

10183
constexpr char d[] = { 'f', 'o', 'o' }; // no nul terminator.
102-
constexpr int bad = __builtin_strlen(d); // expected-error {{constant expression}} \
103-
// expected-note {{one-past-the-end}} \
104-
// expected-note {{in call to}} \
105-
// ref-error {{constant expression}} \
106-
// ref-note {{one-past-the-end}}
84+
constexpr int bad = __builtin_strlen(d); // both-error {{constant expression}} \
85+
// both-note {{one-past-the-end}} \
86+
// expected-note {{in call to}}
10787
}
10888

10989
namespace nan {
@@ -115,8 +95,7 @@ namespace nan {
11595
// expected-error@-2 {{must be initialized by a constant expression}}
11696
#endif
11797

118-
constexpr double NaN3 = __builtin_nan("foo"); // expected-error {{must be initialized by a constant expression}} \
119-
// ref-error {{must be initialized by a constant expression}}
98+
constexpr double NaN3 = __builtin_nan("foo"); // both-error {{must be initialized by a constant expression}}
12099
constexpr float NaN4 = __builtin_nanf("");
121100
//constexpr long double NaN5 = __builtin_nanf128("");
122101

@@ -126,8 +105,7 @@ namespace nan {
126105

127106
/// FIXME: Current interpreter misses diagnostics.
128107
constexpr char f2[] = {'0', 'x', 'A', 'E'}; /// No trailing 0 byte.
129-
constexpr double NaN7 = __builtin_nan(f2); // ref-error {{must be initialized by a constant expression}} \
130-
// expected-error {{must be initialized by a constant expression}} \
108+
constexpr double NaN7 = __builtin_nan(f2); // both-error {{must be initialized by a constant expression}} \
131109
// expected-note {{read of dereferenced one-past-the-end pointer}} \
132110
// expected-note {{in call to}}
133111
static_assert(!__builtin_issignaling(__builtin_nan("")), "");
@@ -370,9 +348,6 @@ namespace EhReturnDataRegno {
370348
case __builtin_eh_return_data_regno(0): // constant foldable.
371349
break;
372350
}
373-
374-
__builtin_eh_return_data_regno(X); // expected-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}} \
375-
// ref-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}}
376-
351+
__builtin_eh_return_data_regno(X); // both-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}}
377352
}
378353
}

0 commit comments

Comments
 (0)