Skip to content

Commit e830161

Browse files
Merge remote-tracking branch 'upstream/main' into gh-101657
2 parents 7573f57 + a5f759e commit e830161

File tree

54 files changed

+3229
-976
lines changed

Some content is hidden

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

54 files changed

+3229
-976
lines changed

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,10 @@ def err_omp_expected_colon : Error<"missing ':' in %0">;
16571657
def err_omp_missing_comma : Error< "missing ',' after %0">;
16581658
def err_omp_expected_context_selector
16591659
: Error<"expected valid context selector in %0">;
1660+
def err_omp_unknown_clause
1661+
: Error<"unknown clause '%0' in %1">;
1662+
def warn_omp_default_deprecated : Warning<"'default' clause for"
1663+
" 'metadirective' is deprecated; use 'otherwise' instead">, InGroup<Deprecated>;
16601664
def err_omp_requires_out_inout_depend_type : Error<
16611665
"reserved locator 'omp_all_memory' requires 'out' or 'inout' "
16621666
"dependency types">;

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,19 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
27592759
OpenMPClauseKind CKind = Tok.isAnnotation()
27602760
? OMPC_unknown
27612761
: getOpenMPClauseKind(PP.getSpelling(Tok));
2762+
// Check if the clause is unrecognized.
2763+
if (getLangOpts().OpenMP < 52 &&
2764+
(CKind == OMPC_unknown || CKind == OMPC_otherwise)) {
2765+
Diag(Tok, diag::err_omp_unknown_clause)
2766+
<< PP.getSpelling(Tok) << "metadirective";
2767+
}
2768+
if (getLangOpts().OpenMP >= 52 && CKind == OMPC_unknown) {
2769+
Diag(Tok, diag::err_omp_unknown_clause)
2770+
<< PP.getSpelling(Tok) << "metadirective";
2771+
}
2772+
if (CKind == OMPC_default && getLangOpts().OpenMP >= 52) {
2773+
Diag(Tok, diag::warn_omp_default_deprecated);
2774+
}
27622775
SourceLocation Loc = ConsumeToken();
27632776

27642777
// Parse '('.
@@ -2785,6 +2798,13 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
27852798
return Directive;
27862799
}
27872800
}
2801+
if (CKind == OMPC_otherwise) {
2802+
// Check for 'otherwise' keyword.
2803+
if (Tok.is(tok::identifier) &&
2804+
Tok.getIdentifierInfo()->getName() == "otherwise") {
2805+
ConsumeToken(); // Consume 'otherwise'
2806+
}
2807+
}
27882808
// Skip Directive for now. We will parse directive in the second iteration
27892809
int paren = 0;
27902810
while (Tok.isNot(tok::r_paren) || paren != 0) {

clang/test/AST/ByteCode/libcxx/primitive-temporary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ using iter_value_t =
165165
int>::value_type;
166166
namespace ranges {
167167
struct Trans_NS___iter_move___fn {
168-
template <class _Ip> auto operator()(_Ip __i) const -> decltype(move(*(__i)));
168+
template <class _Ip> auto operator()(_Ip __i) const -> decltype(std::move(*(__i)));
169169
};
170170
inline namespace {
171171
auto iter_move = Trans_NS___iter_move___fn{};

clang/test/OpenMP/metadirective_messages.cpp

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,48 @@
22

33
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -verify -fopenmp-simd -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s
44

5+
// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -ferror-limit 100 -o - %s -Wuninitialized
6+
57
void foo() {
6-
#pragma omp metadirective // expected-error {{expected expression}}
7-
;
8-
#pragma omp metadirective when() // expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
9-
;
10-
#pragma omp metadirective when(device{}) // expected-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
11-
;
12-
#pragma omp metadirective when(device{arch(nvptx)}) // expected-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
13-
;
14-
#pragma omp metadirective when(device{arch(nvptx)}: ) default() // expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
15-
;
16-
#pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // expected-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
17-
;
18-
#pragma omp metadirective when(device = {arch(nvptx)} : parallel default() // expected-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
19-
;
20-
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) default(single) // expected-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
21-
;
8+
#if _OPENMP >= 202111
9+
#pragma omp metadirective // omp52-error {{expected expression}}
10+
;
11+
#pragma omp metadirective when() // omp52-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
12+
;
13+
#pragma omp metadirective when(device{}) // omp52-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
14+
;
15+
#pragma omp metadirective when(device{arch(nvptx)}) // omp52-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
16+
;
17+
#pragma omp metadirective when(device{arch(nvptx)}: ) otherwise() // omp52-warning {{expected '=' after the context set name "device"; '=' assumed}}
18+
;
19+
#pragma omp metadirective when(device = {arch(nvptx)} : ) otherwise(xyz) // omp52-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
20+
;
21+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel otherwise() // omp52-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
22+
;
23+
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) otherwise(single) // omp52-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
24+
;
25+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) default() // omp52-warning {{'default' clause for 'metadirective' is deprecated; use 'otherwise' instead}}
26+
;
27+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //omp52-error {{unknown clause 'xyz' in metadirective}}
28+
;
29+
#else
30+
#pragma omp metadirective // expected-error {{expected expression}}
31+
;
32+
#pragma omp metadirective when() // expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}} expected-warning {{expected identifier or string literal describing a context set; set skipped}} expected-note {{context set options are: 'construct' 'device' 'target_device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}}
33+
;
34+
#pragma omp metadirective when(device{}) // expected-warning {{expected '=' after the context set name "device"; '=' assumed}} expected-warning {{expected identifier or string literal describing a context selector; selector skipped}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}} expected-error {{expected valid context selector in when clause}} expected-error {{expected expression}}
35+
;
36+
#pragma omp metadirective when(device{arch(nvptx)}) // expected-error {{missing ':' in when clause}} expected-error {{expected expression}} expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
37+
;
38+
#pragma omp metadirective when(device{arch(nvptx)}: ) default() // expected-warning {{expected '=' after the context set name "device"; '=' assumed}}
39+
;
40+
#pragma omp metadirective when(device = {arch(nvptx)} : ) default(xyz) // expected-error {{expected an OpenMP directive}} expected-error {{use of undeclared identifier 'xyz'}}
41+
;
42+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel default() // expected-error {{expected ',' or ')' in 'when' clause}} expected-error {{expected expression}}
43+
;
44+
#pragma omp metadirective when(device = {isa("some-unsupported-feature")} : parallel) default(single) // expected-warning {{isa trait 'some-unsupported-feature' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further}}
45+
;
46+
#pragma omp metadirective when(device = {arch(nvptx)} : parallel) xyz() //expected-error {{unknown clause 'xyz' in metadirective}}
47+
;
48+
#endif
2249
}

compiler-rt/include/fuzzer/FuzzedDataProvider.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ template <typename T> T FuzzedDataProvider::ConsumeIntegral() {
203203
// be less than or equal to |max|.
204204
template <typename T>
205205
T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
206-
static_assert(std::is_integral<T>::value, "An integral type is required.");
206+
static_assert(std::is_integral_v<T>, "An integral type is required.");
207207
static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
208208

209209
if (min > max)
@@ -271,14 +271,14 @@ T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) {
271271
// Returns a floating point number in the range [0.0, 1.0]. If there's no
272272
// input data left, always returns 0.
273273
template <typename T> T FuzzedDataProvider::ConsumeProbability() {
274-
static_assert(std::is_floating_point<T>::value,
274+
static_assert(std::is_floating_point_v<T>,
275275
"A floating point type is required.");
276276

277277
// Use different integral types for different floating point types in order
278278
// to provide better density of the resulting values.
279279
using IntegralType =
280-
typename std::conditional<(sizeof(T) <= sizeof(uint32_t)), uint32_t,
281-
uint64_t>::type;
280+
typename std::conditional_t<(sizeof(T) <= sizeof(uint32_t)), uint32_t,
281+
uint64_t>;
282282

283283
T result = static_cast<T>(ConsumeIntegral<IntegralType>());
284284
result /= static_cast<T>(std::numeric_limits<IntegralType>::max());
@@ -294,7 +294,7 @@ inline bool FuzzedDataProvider::ConsumeBool() {
294294
// also contain |kMaxValue| aliased to its largest (inclusive) value. Such as:
295295
// enum class Foo { SomeValue, OtherValue, kMaxValue = OtherValue };
296296
template <typename T> T FuzzedDataProvider::ConsumeEnum() {
297-
static_assert(std::is_enum<T>::value, "|T| must be an enum type.");
297+
static_assert(std::is_enum_v<T>, "|T| must be an enum type.");
298298
return static_cast<T>(
299299
ConsumeIntegralInRange<uint32_t>(0, static_cast<uint32_t>(T::kMaxValue)));
300300
}

compiler-rt/lib/asan/tests/asan_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ void *ManyThreadsWorker(void *a) {
369369
return 0;
370370
}
371371

372-
#if !defined(__aarch64__) && !defined(__powerpc64__)
373-
// FIXME: Infinite loop in AArch64 (PR24389).
372+
#if !defined(__powerpc64__)
374373
// FIXME: Also occasional hang on powerpc. Maybe same problem as on AArch64?
375374
TEST(AddressSanitizer, ManyThreadsTest) {
376375
const size_t kNumThreads =

libcxx/utils/libcxx/test/dsl.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import os
1010
import pickle
1111
import platform
12-
import shlex
1312
import shutil
1413
import tempfile
1514

@@ -274,23 +273,41 @@ def hasAnyLocale(config, locales):
274273
%{exec} -- this means that the command may be executed on a remote host
275274
depending on the %{exec} substitution.
276275
"""
277-
program = """
276+
277+
# Convert the locale names into C string literals. We expect all currently
278+
# known locale names to be printable ASCII and not contain awkward
279+
# characters like \ or ", so this should be trivial.
280+
assert all(
281+
0x20 <= ord(ch) <= 0x7E and ch not in {'"', "\\"}
282+
for locale in locales
283+
for ch in locale
284+
)
285+
name_string_literals = ", ".join('"' + locale + '"' for locale in locales)
286+
287+
program = (
288+
"""
278289
#include <stddef.h>
279290
#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_LOCALIZATION
280291
int main(int, char**) { return 1; }
281292
#else
282293
#include <locale.h>
283-
int main(int argc, char** argv) {
284-
for (int i = 1; i < argc; i++) {
285-
if (::setlocale(LC_ALL, argv[i]) != NULL) {
294+
static const char *const test_locale_names[] = {
295+
"""
296+
+ name_string_literals
297+
+ """, nullptr,
298+
};
299+
int main() {
300+
for (size_t i = 0; test_locale_names[i]; i++) {
301+
if (::setlocale(LC_ALL, test_locale_names[i]) != NULL) {
286302
return 0;
287303
}
288304
}
289305
return 1;
290306
}
291307
#endif
292-
"""
293-
return programSucceeds(config, program, args=[shlex.quote(l) for l in locales])
308+
"""
309+
)
310+
return programSucceeds(config, program)
294311

295312

296313
@_memoizeExpensiveOperation(lambda c, flags="": (c.substitutions, c.environment, flags))

lldb/source/Plugins/Platform/AIX/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
add_definitions("-D_ALL_SOURCE")
2-
31
add_lldb_library(lldbPluginPlatformAIX PLUGIN
42
PlatformAIX.cpp
53

@@ -11,3 +9,5 @@ add_lldb_library(lldbPluginPlatformAIX PLUGIN
119
lldbTarget
1210
lldbPluginPlatformPOSIX
1311
)
12+
13+
target_compile_definitions(lldbPluginPlatformAIX PRIVATE "-D_ALL_SOURCE")

0 commit comments

Comments
 (0)