Skip to content

Commit e41a93a

Browse files
committed
1 parent e75e248 commit e41a93a

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def warn_drv_unsupported_option_for_processor : Warning<
143143
def warn_drv_unsupported_openmp_library : Warning<
144144
"the library '%0=%1' is not supported, OpenMP will not be enabled">,
145145
InGroup<OptionIgnored>;
146-
def warn_openmp_experimental : Warning<
147-
"OpenMP support in flang is still experimental">,
146+
def warn_openmp_incomplete : Warning<
147+
"OpenMP support for version %0 in flang is still incomplete">,
148148
InGroup<ExperimentalOption>;
149149

150150
def err_drv_invalid_thread_model_for_target : Error<

clang/lib/Driver/ToolChains/Flang.cpp

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

1212
#include "clang/Basic/CodeGenOptions.h"
1313
#include "clang/Driver/CommonArgs.h"
14+
#include "clang/Driver/OptionUtils.h"
1415
#include "clang/Driver/Options.h"
1516
#include "llvm/Frontend/Debug/Options.h"
1617
#include "llvm/Support/Path.h"
@@ -772,6 +773,13 @@ static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
772773
}
773774
}
774775

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+
775783
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
776784
const InputInfo &Output, const InputInfoList &Inputs,
777785
const ArgList &Args, const char *LinkingOutput) const {
@@ -906,9 +914,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
906914

907915
if (Args.hasArg(options::OPT_fopenmp_force_usm))
908916
CmdArgs.push_back("-fopenmp-force-usm");
909-
// TODO: OpenMP support isn't "done" yet, so for now we warn that it
910-
// is experimental.
911-
D.Diag(diag::warn_openmp_experimental);
917+
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+
}
912925

913926
// FIXME: Clang supports a whole bunch more flags here.
914927
break;

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 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL
77+
! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL
7878
!
79-
! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support in flang is still experimental
79+
! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support for version 4.0 in flang is still incomplete

0 commit comments

Comments
 (0)