
The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1. After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests - # RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there. # Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required. # Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1. # Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests. # If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's. # Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed. # To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py Reviewed By: saiislam, ABataev Differential Revision: https://reviews.llvm.org/D129635 (cherry picked from commit 9dd2999907dc791136a75238a6000f69bf67cf4e)
78 lines
5.1 KiB
C++
78 lines
5.1 KiB
C++
// RUN: %clang_cc1 -std=c++17 -fopenmp -fsyntax-only -verify %s
|
|
|
|
// This file tests the custom parsing logic for the OpenMP 5.1 attribute
|
|
// syntax. It does not test actual OpenMP directive syntax, just the attribute
|
|
// parsing bits.
|
|
|
|
// FIXME: the diagnostic here is a bit unsatisfying. We handle the custom omp
|
|
// attribute parsing logic when parsing the attribute argument list, and we
|
|
// only process an attribute argument list when we see an open paren after the
|
|
// attribute name. So this means we never hit the omp-specific parsing and
|
|
// instead handle this through the usual Sema attribute handling in
|
|
// SemaDeclAttr.cpp, which diagnoses this as an unknown attribute.
|
|
[[omp::directive]]; // expected-warning {{unknown attribute 'directive' ignored}}
|
|
[[omp::sequence]]; // expected-warning {{unknown attribute 'sequence' ignored}}
|
|
[[omp::unknown]]; // expected-warning {{unknown attribute 'unknown' ignored}}
|
|
|
|
[[omp::directive()]]; // expected-error {{expected an OpenMP directive}}
|
|
[[omp::sequence()]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
|
|
// Both sequence and directive require an argument list, test that we diagnose
|
|
// when the inner directive or sequence is missing its argument list.
|
|
[[omp::sequence(directive)]]; // expected-error {{expected '('}}
|
|
[[omp::sequence(sequence)]]; // expected-error {{expected '('}}
|
|
[[omp::sequence(omp::directive)]]; // expected-error {{expected '('}}
|
|
[[omp::sequence(omp::sequence)]]; // expected-error {{expected '('}}
|
|
|
|
// All of the diagnostics here come from the inner sequence and directive not
|
|
// being given an argument, but this tests that we can parse either with or
|
|
// without the 'omp::'.
|
|
[[omp::sequence(directive(), sequence())]]; // expected-error {{expected an OpenMP directive}} expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(omp::directive(), sequence())]]; // expected-error {{expected an OpenMP directive}} expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(directive(), omp::sequence())]]; // expected-error {{expected an OpenMP directive}} expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(omp::directive(), omp::sequence())]]; // expected-error {{expected an OpenMP directive}} expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
|
|
// Test that we properly diagnose missing parens within the inner arguments of
|
|
// a sequence attribute.
|
|
[[omp::sequence( // expected-note {{to match this '('}}
|
|
directive(
|
|
)]]; // expected-error {{expected ')'}} expected-error {{expected an OpenMP directive}}
|
|
[[omp::sequence( // expected-note {{to match this '('}}
|
|
sequence(
|
|
)]]; // expected-error {{expected ')'}} expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
|
|
// Test that we properly handle the using attribute syntax.
|
|
[[using omp: directive()]]; // expected-error {{expected an OpenMP directive}}
|
|
[[using omp: sequence()]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[using omp: sequence(omp::directive())]]; // expected-error {{expected an OpenMP directive}}
|
|
[[using omp: sequence(directive())]]; // expected-error {{expected an OpenMP directive}}
|
|
|
|
// Test that we give a sensible error on an unknown attribute in the omp
|
|
// namespace that has an argument list.
|
|
[[omp::unknown()]]; // expected-warning {{unknown attribute 'unknown' ignored}}
|
|
[[using omp: unknown()]]; // expected-warning {{unknown attribute 'unknown' ignored}}
|
|
|
|
// Test that unknown arguments to the omp::sequence are rejected, regardless of
|
|
// what level they're at.
|
|
[[omp::sequence(unknown)]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(sequence(unknown))]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(omp::unknown)]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
[[omp::sequence(sequence(omp::unknown))]]; // expected-error {{expected an OpenMP 'directive' or 'sequence' attribute argument}}
|
|
|
|
// FIXME: combining non-openmp attributes with openmp attributes has surprising
|
|
// results due to the replay of tokens. We properly parse the non-openmp
|
|
// attributes, but we also replay the OpenMP tokens. The attributes then get
|
|
// passed to the OpenMP parsing functions and it does not attach the attribute
|
|
// to the declaration statement AST node as you might expect. This means that
|
|
// the expected diagnostics are not issued. Thankfully, due to the positioning
|
|
// of OpenMP attributes and what they appertain to, this should not be a
|
|
// frequent issue (hopefully).
|
|
int x;
|
|
[[deprecated, omp::directive(threadprivate(x))]] int y; // FIXME-expected-note {{'y' has been explicitly marked deprecated here}}
|
|
[[omp::directive(threadprivate(x)), deprecated]] int z; // FIXME-expected-note {{'z' has been explicitly marked deprecated here}}
|
|
void test() {
|
|
x = 1;
|
|
y = 1; // FIXME-expected-warning {{warning: 'y' is deprecated}}
|
|
z = 1; // FIXME-expected-warning {{warning: 'z' is deprecated}}
|
|
}
|