Skip to content

Commit ebd2980

Browse files
committed
Move warning to frontend driver
1 parent 5af1bfb commit ebd2980

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "clang/Basic/CodeGenOptions.h"
1313
#include "clang/Driver/CommonArgs.h"
14-
#include "clang/Driver/OptionUtils.h"
1514
#include "clang/Driver/Options.h"
1615
#include "llvm/Frontend/Debug/Options.h"
1716
#include "llvm/Support/Path.h"
@@ -773,13 +772,6 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
773772
}
774773
}
775774

776-
static std::string OpenMPVersionToString(int Version) {
777-
int Major = Version / 10;
778-
int Minor = Version % 10;
779-
780-
return llvm::Twine{Major}.concat(".").concat(llvm::Twine{Minor}).str();
781-
}
782-
783775
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
784776
const InputInfo &Output, const InputInfoList &Inputs,
785777
const ArgList &Args, const char *LinkingOutput) const {
@@ -915,14 +907,6 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
915907
if (Args.hasArg(options::OPT_fopenmp_force_usm))
916908
CmdArgs.push_back("-fopenmp-force-usm");
917909

918-
// TODO: OpenMP support for newer versions of the standard is incomplete.
919-
if (int Version =
920-
getLastArgIntValue(Args, options::OPT_fopenmp_version_EQ, 0)) {
921-
if (Version >= 40)
922-
D.Diag(diag::warn_openmp_incomplete)
923-
<< OpenMPVersionToString(Version);
924-
}
925-
926910
// FIXME: Clang supports a whole bunch more flags here.
927911
break;
928912
default:

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,8 +1138,9 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
11381138
unsigned numErrorsBefore = diags.getNumErrors();
11391139
llvm::Triple t(res.getTargetOpts().triple);
11401140

1141-
// By default OpenMP is set to 3.1 version
1142-
res.getLangOpts().OpenMPVersion = 31;
1141+
constexpr unsigned newestFullySupported = 31;
1142+
// By default OpenMP is set to the most recent fully supported version
1143+
res.getLangOpts().OpenMPVersion = newestFullySupported;
11431144
res.getFrontendOpts().features.Enable(
11441145
Fortran::common::LanguageFeature::OpenMP);
11451146
if (auto *arg =
@@ -1164,6 +1165,9 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
11641165
if (!value.getAsInteger(/*radix=*/10, version)) {
11651166
if (llvm::is_contained(ompVersions, version)) {
11661167
res.getLangOpts().OpenMPVersion = version;
1168+
1169+
if (version > newestFullySupported)
1170+
diags.Report(clang::diag::warn_openmp_incomplete) << version;
11671171
} else if (llvm::is_contained(oldVersions, version)) {
11681172
const unsigned diagID =
11691173
diags.getCustomDiagID(clang::DiagnosticsEngine::Warning,

flang/test/Driver/fopenmp.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@
7474
! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}"
7575
! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}"
7676
!
77-
! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPLETE
77+
! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPLETE
7878
!
79-
! CHECK-INCOMPLETE: flang{{.*}}: warning: OpenMP support for version 4.0 in flang is still incomplete
79+
! CHECK-INCOMPLETE: warning: OpenMP support for version 40 in flang is still incomplete

0 commit comments

Comments
 (0)