[Frontend][OpenMP] Add 6.1 as a valid OpenMP version (#153628)
Co-authored-by: Michael Klemm <michael.klemm@amd.com>
This commit is contained in:
parent
2497864e09
commit
ae75884130
@ -1187,6 +1187,7 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
|
||||
llvm::Triple t(res.getTargetOpts().triple);
|
||||
|
||||
constexpr unsigned newestFullySupported = 31;
|
||||
constexpr unsigned latestFinalized = 60;
|
||||
// By default OpenMP is set to the most recent fully supported version
|
||||
res.getLangOpts().OpenMPVersion = newestFullySupported;
|
||||
res.getFrontendOpts().features.Enable(
|
||||
@ -1209,12 +1210,26 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
|
||||
diags.Report(diagID) << value << arg->getAsString(args) << versions.str();
|
||||
};
|
||||
|
||||
auto reportFutureVersion = [&](llvm::StringRef value) {
|
||||
const unsigned diagID = diags.getCustomDiagID(
|
||||
clang::DiagnosticsEngine::Warning,
|
||||
"The specification for OpenMP version %0 is still under development; "
|
||||
"the syntax and semantics of new features may be subject to change");
|
||||
std::string buffer;
|
||||
llvm::raw_string_ostream versions(buffer);
|
||||
llvm::interleaveComma(ompVersions, versions);
|
||||
|
||||
diags.Report(diagID) << value;
|
||||
};
|
||||
|
||||
llvm::StringRef value = arg->getValue();
|
||||
if (!value.getAsInteger(/*radix=*/10, version)) {
|
||||
if (llvm::is_contained(ompVersions, version)) {
|
||||
res.getLangOpts().OpenMPVersion = version;
|
||||
|
||||
if (version > newestFullySupported)
|
||||
if (version > latestFinalized)
|
||||
reportFutureVersion(value);
|
||||
else if (version > newestFullySupported)
|
||||
diags.Report(clang::diag::warn_openmp_incomplete) << version;
|
||||
} else if (llvm::is_contained(oldVersions, version)) {
|
||||
const unsigned diagID =
|
||||
|
@ -22,4 +22,8 @@
|
||||
|
||||
!RUN: not %flang -c -fopenmp -fopenmp-version=29 %s 2>&1 | FileCheck --check-prefix=ERR-BAD %s
|
||||
|
||||
!ERR-BAD: error: '29' is not a valid OpenMP version in '-fopenmp-version=29', valid versions are 31, 40, 45, 50, 51, 52, 60
|
||||
!ERR-BAD: error: '29' is not a valid OpenMP version in '-fopenmp-version=29', valid versions are 31, 40, 45, 50, 51, 52, 60, 61
|
||||
|
||||
!RUN: %flang -c -fopenmp -fopenmp-version=61 %s 2>&1 | FileCheck --check-prefix=FUTURE %s
|
||||
|
||||
!FUTURE: The specification for OpenMP version 61 is still under development; the syntax and semantics of new features may be subject to change
|
||||
|
@ -190,7 +190,7 @@ bool isCombinedConstruct(Directive D) {
|
||||
}
|
||||
|
||||
ArrayRef<unsigned> getOpenMPVersions() {
|
||||
static unsigned Versions[]{31, 40, 45, 50, 51, 52, 60};
|
||||
static unsigned Versions[]{31, 40, 45, 50, 51, 52, 60, 61};
|
||||
return Versions;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user