This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6d48a1a53fab: [flang][driver] Add support for -fopenmp and 
-fopenacc (authored by FarisRehman).

Changed prior to commit:
  https://reviews.llvm.org/D96032?vs=322347&id=322624#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96032/new/

https://reviews.llvm.org/D96032

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Flang.cpp
  flang/include/flang/Frontend/CompilerInstance.h
  flang/include/flang/Frontend/CompilerInvocation.h
  flang/include/flang/Frontend/FrontendOptions.h
  flang/lib/Frontend/CompilerInstance.cpp
  flang/lib/Frontend/CompilerInvocation.cpp
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Flang-Driver/driver-help-hidden.f90
  flang/test/Flang-Driver/driver-help.f90
  flang/test/Semantics/OpenACC/acc-atomic-validity.f90
  flang/test/Semantics/OpenACC/acc-branch.f90
  flang/test/Semantics/OpenACC/acc-cache-validity.f90
  flang/test/Semantics/OpenACC/acc-canonicalization-validity.f90
  flang/test/Semantics/OpenACC/acc-data.f90
  flang/test/Semantics/OpenACC/acc-declare-validity.f90
  flang/test/Semantics/OpenACC/acc-host-data.f90
  flang/test/Semantics/OpenACC/acc-init-validity.f90
  flang/test/Semantics/OpenACC/acc-kernels-loop.f90
  flang/test/Semantics/OpenACC/acc-kernels.f90
  flang/test/Semantics/OpenACC/acc-loop.f90
  flang/test/Semantics/OpenACC/acc-parallel-loop-validity.f90
  flang/test/Semantics/OpenACC/acc-parallel.f90
  flang/test/Semantics/OpenACC/acc-resolve01.f90
  flang/test/Semantics/OpenACC/acc-resolve02.f90
  flang/test/Semantics/OpenACC/acc-routine-validity.f90
  flang/test/Semantics/OpenACC/acc-serial-loop.f90
  flang/test/Semantics/OpenACC/acc-serial.f90
  flang/test/Semantics/OpenACC/acc-set-validity.f90
  flang/test/Semantics/OpenACC/acc-shutdown-validity.f90
  flang/test/Semantics/OpenACC/acc-update-validity.f90
  flang/test/Semantics/OpenACC/acc-wait-validity.f90
  flang/test/Semantics/omp-atomic.f90
  flang/test/Semantics/omp-combined-constructs.f90
  flang/test/Semantics/omp-copyin01.f90
  flang/test/Semantics/omp-copyin02.f90
  flang/test/Semantics/omp-copyin03.f90
  flang/test/Semantics/omp-copyin04.f90
  flang/test/Semantics/omp-copyin05.f90
  flang/test/Semantics/omp-declarative-directive.f90
  flang/test/Semantics/omp-default.f90
  flang/test/Semantics/omp-default02.f90
  flang/test/Semantics/omp-depend01.f90
  flang/test/Semantics/omp-depend02.f90
  flang/test/Semantics/omp-depend03.f90
  flang/test/Semantics/omp-device-constructs.f90
  flang/test/Semantics/omp-do-collapse-positivecases.f90
  flang/test/Semantics/omp-do-collapse.f90
  flang/test/Semantics/omp-do-cycle.f90
  flang/test/Semantics/omp-do-ordered-positivecases.f90
  flang/test/Semantics/omp-do-ordered.f90
  flang/test/Semantics/omp-do-schedule01.f90
  flang/test/Semantics/omp-do-schedule02.f90
  flang/test/Semantics/omp-do01.f90
  flang/test/Semantics/omp-do02.f90
  flang/test/Semantics/omp-do03.f90
  flang/test/Semantics/omp-do04.f90
  flang/test/Semantics/omp-do05.f90
  flang/test/Semantics/omp-do06.f90
  flang/test/Semantics/omp-do07.f90
  flang/test/Semantics/omp-do08.f90
  flang/test/Semantics/omp-do09.f90
  flang/test/Semantics/omp-do10.f90
  flang/test/Semantics/omp-flush01.f90
  flang/test/Semantics/omp-invalid-branch.f90
  flang/test/Semantics/omp-loop-association.f90
  flang/test/Semantics/omp-loop-simd01.f90
  flang/test/Semantics/omp-nested01.f90
  flang/test/Semantics/omp-no-dowhile-in-parallel.f90
  flang/test/Semantics/omp-parallel-private01.f90
  flang/test/Semantics/omp-parallel-private02.f90
  flang/test/Semantics/omp-parallel-private03.f90
  flang/test/Semantics/omp-parallel-private04.f90
  flang/test/Semantics/omp-parallel-shared01.f90
  flang/test/Semantics/omp-parallel-shared02.f90
  flang/test/Semantics/omp-parallel-shared03.f90
  flang/test/Semantics/omp-parallel-shared04.f90
  flang/test/Semantics/omp-parallel01.f90
  flang/test/Semantics/omp-parallel02.f90
  flang/test/Semantics/omp-private01.f90
  flang/test/Semantics/omp-private02.f90
  flang/test/Semantics/omp-private03.f90
  flang/test/Semantics/omp-resolve01.f90
  flang/test/Semantics/omp-resolve02.f90
  flang/test/Semantics/omp-resolve03.f90
  flang/test/Semantics/omp-resolve04.f90
  flang/test/Semantics/omp-resolve05.f90
  flang/test/Semantics/omp-sections01.f90
  flang/test/Semantics/omp-simd01.f90
  flang/test/Semantics/omp-simd02.f90
  flang/test/Semantics/omp-simd03.f90
  flang/test/Semantics/omp-single01.f90
  flang/test/Semantics/omp-single02.f90
  flang/test/Semantics/omp-task01.f90
  flang/test/Semantics/omp-taskloop-simd01.f90
  flang/test/Semantics/omp-taskloop01.f90
  flang/test/Semantics/omp-taskloop02.f90
  flang/test/Semantics/omp-taskloop03.f90
  flang/test/Semantics/omp-workshare01.f90
  flang/test/Semantics/omp-workshare02.f90
  flang/test/Semantics/omp-workshare03.f90
  flang/test/Semantics/omp-workshare04.f90
  flang/test/Semantics/omp-workshare05.f90

Index: flang/test/Semantics/omp-workshare05.f90
===================================================================
--- flang/test/Semantics/omp-workshare05.f90
+++ flang/test/Semantics/omp-workshare05.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.4 workshare Construct
 ! Checks for OpenMP Parallel constructs enclosed in Workshare constructs
Index: flang/test/Semantics/omp-workshare04.f90
===================================================================
--- flang/test/Semantics/omp-workshare04.f90
+++ flang/test/Semantics/omp-workshare04.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.4 workshare Construct
 ! Checks for OpenMP Workshare construct
Index: flang/test/Semantics/omp-workshare03.f90
===================================================================
--- flang/test/Semantics/omp-workshare03.f90
+++ flang/test/Semantics/omp-workshare03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.4 workshare Construct
 ! All array assignments, scalar assignments, and masked array assignments
Index: flang/test/Semantics/omp-workshare02.f90
===================================================================
--- flang/test/Semantics/omp-workshare02.f90
+++ flang/test/Semantics/omp-workshare02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.4 workshare Construct
 ! The !omp workshare construct must not contain any user defined
Index: flang/test/Semantics/omp-workshare01.f90
===================================================================
--- flang/test/Semantics/omp-workshare01.f90
+++ flang/test/Semantics/omp-workshare01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.4 workshare Construct
 ! Invalid do construct inside !$omp workshare
Index: flang/test/Semantics/omp-taskloop03.f90
===================================================================
--- flang/test/Semantics/omp-taskloop03.f90
+++ flang/test/Semantics/omp-taskloop03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-taskloop02.f90
===================================================================
--- flang/test/Semantics/omp-taskloop02.f90
+++ flang/test/Semantics/omp-taskloop02.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.9.2 taskloop Construct
 ! Invalid entry to OpenMP structured block.
Index: flang/test/Semantics/omp-taskloop01.f90
===================================================================
--- flang/test/Semantics/omp-taskloop01.f90
+++ flang/test/Semantics/omp-taskloop01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.9.2 taskloop Construct
 
Index: flang/test/Semantics/omp-taskloop-simd01.f90
===================================================================
--- flang/test/Semantics/omp-taskloop-simd01.f90
+++ flang/test/Semantics/omp-taskloop-simd01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-task01.f90
===================================================================
--- flang/test/Semantics/omp-task01.f90
+++ flang/test/Semantics/omp-task01.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.9.1 task Construct
 ! Invalid entry to OpenMP structured block.
Index: flang/test/Semantics/omp-single02.f90
===================================================================
--- flang/test/Semantics/omp-single02.f90
+++ flang/test/Semantics/omp-single02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-single01.f90
===================================================================
--- flang/test/Semantics/omp-single01.f90
+++ flang/test/Semantics/omp-single01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-simd03.f90
===================================================================
--- flang/test/Semantics/omp-simd03.f90
+++ flang/test/Semantics/omp-simd03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-simd02.f90
===================================================================
--- flang/test/Semantics/omp-simd02.f90
+++ flang/test/Semantics/omp-simd02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! OpenMP Version 4.5
 ! 2.8.1 simd Construct
Index: flang/test/Semantics/omp-simd01.f90
===================================================================
--- flang/test/Semantics/omp-simd01.f90
+++ flang/test/Semantics/omp-simd01.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.8.1 simd Construct
 ! A program that branches into or out of a simd region is non-conforming.
Index: flang/test/Semantics/omp-sections01.f90
===================================================================
--- flang/test/Semantics/omp-sections01.f90
+++ flang/test/Semantics/omp-sections01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! OpenMP Version 4.5
 ! 2.7.2 sections Construct
Index: flang/test/Semantics/omp-resolve05.f90
===================================================================
--- flang/test/Semantics/omp-resolve05.f90
+++ flang/test/Semantics/omp-resolve05.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! 2.15.3 Data-Sharing Attribute Clauses
 ! 2.15.3.1 default Clause
Index: flang/test/Semantics/omp-resolve04.f90
===================================================================
--- flang/test/Semantics/omp-resolve04.f90
+++ flang/test/Semantics/omp-resolve04.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! 2.15.3 Data-Sharing Attribute Clauses
 ! A list item that specifies a given variable may not appear in more than
Index: flang/test/Semantics/omp-resolve03.f90
===================================================================
--- flang/test/Semantics/omp-resolve03.f90
+++ flang/test/Semantics/omp-resolve03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! 2.15.3 Although variables in common blocks can be accessed by use association
 ! or host association, common block names cannot. As a result, a common block
Index: flang/test/Semantics/omp-resolve02.f90
===================================================================
--- flang/test/Semantics/omp-resolve02.f90
+++ flang/test/Semantics/omp-resolve02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! Test the effect to name resolution from illegal clause
 
Index: flang/test/Semantics/omp-resolve01.f90
===================================================================
--- flang/test/Semantics/omp-resolve01.f90
+++ flang/test/Semantics/omp-resolve01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! 2.4 An array section designates a subset of the elements in an array. Although
 ! Substring shares similar syntax but cannot be treated as valid array section.
Index: flang/test/Semantics/omp-private03.f90
===================================================================
--- flang/test/Semantics/omp-private03.f90
+++ flang/test/Semantics/omp-private03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! Variables that appear in expressions for statement function definitions
 ! may not appear in private, firstprivate or lastprivate clauses.
Index: flang/test/Semantics/omp-private02.f90
===================================================================
--- flang/test/Semantics/omp-private02.f90
+++ flang/test/Semantics/omp-private02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 private Clause
 ! Variables that appear in namelist statements may not appear in a private clause.
Index: flang/test/Semantics/omp-private01.f90
===================================================================
--- flang/test/Semantics/omp-private01.f90
+++ flang/test/Semantics/omp-private01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 private Clause
 ! Pointers with the INTENT(IN) attribute may not appear in a private clause.
Index: flang/test/Semantics/omp-parallel02.f90
===================================================================
--- flang/test/Semantics/omp-parallel02.f90
+++ flang/test/Semantics/omp-parallel02.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.5 parallel construct.
 ! A program that branches into or out of a parallel region
Index: flang/test/Semantics/omp-parallel01.f90
===================================================================
--- flang/test/Semantics/omp-parallel01.f90
+++ flang/test/Semantics/omp-parallel01.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.5 parallel construct.
 ! A program that branches into or out of a parallel region
Index: flang/test/Semantics/omp-parallel-shared04.f90
===================================================================
--- flang/test/Semantics/omp-parallel-shared04.f90
+++ flang/test/Semantics/omp-parallel-shared04.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.2 parallel shared Clause
 program omp_parallel_shared
Index: flang/test/Semantics/omp-parallel-shared03.f90
===================================================================
--- flang/test/Semantics/omp-parallel-shared03.f90
+++ flang/test/Semantics/omp-parallel-shared03.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.2 parallel shared Clause
 program omp_parallel_shared
Index: flang/test/Semantics/omp-parallel-shared02.f90
===================================================================
--- flang/test/Semantics/omp-parallel-shared02.f90
+++ flang/test/Semantics/omp-parallel-shared02.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.2 parallel shared Clause
 program omp_parallel_shared
Index: flang/test/Semantics/omp-parallel-shared01.f90
===================================================================
--- flang/test/Semantics/omp-parallel-shared01.f90
+++ flang/test/Semantics/omp-parallel-shared01.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.2 parallel shared Clause
 program omp_parallel_shared
Index: flang/test/Semantics/omp-parallel-private04.f90
===================================================================
--- flang/test/Semantics/omp-parallel-private04.f90
+++ flang/test/Semantics/omp-parallel-private04.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 parallel private Clause
 program omp_parallel_private
Index: flang/test/Semantics/omp-parallel-private03.f90
===================================================================
--- flang/test/Semantics/omp-parallel-private03.f90
+++ flang/test/Semantics/omp-parallel-private03.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 parallel private Clause
 program omp_parallel_private
Index: flang/test/Semantics/omp-parallel-private02.f90
===================================================================
--- flang/test/Semantics/omp-parallel-private02.f90
+++ flang/test/Semantics/omp-parallel-private02.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 parallel private Clause
 program omp_parallel_private
Index: flang/test/Semantics/omp-parallel-private01.f90
===================================================================
--- flang/test/Semantics/omp-parallel-private01.f90
+++ flang/test/Semantics/omp-parallel-private01.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.3 parallel private Clause
 program omp_parallel_private
Index: flang/test/Semantics/omp-no-dowhile-in-parallel.f90
===================================================================
--- flang/test/Semantics/omp-no-dowhile-in-parallel.f90
+++ flang/test/Semantics/omp-no-dowhile-in-parallel.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 subroutine bug48308(x,i)
   real :: x(:)
Index: flang/test/Semantics/omp-nested01.f90
===================================================================
--- flang/test/Semantics/omp-nested01.f90
+++ flang/test/Semantics/omp-nested01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! Check OpenMP 2.17 Nesting of Regions
 
Index: flang/test/Semantics/omp-loop-simd01.f90
===================================================================
--- flang/test/Semantics/omp-loop-simd01.f90
+++ flang/test/Semantics/omp-loop-simd01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! OpenMP Version 4.5
 ! 2.8.3 Loop simd Construct
Index: flang/test/Semantics/omp-loop-association.f90
===================================================================
--- flang/test/Semantics/omp-loop-association.f90
+++ flang/test/Semantics/omp-loop-association.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! Check the association between OpenMPLoopConstruct and DoConstruct
 
Index: flang/test/Semantics/omp-invalid-branch.f90
===================================================================
--- flang/test/Semantics/omp-invalid-branch.f90
+++ flang/test/Semantics/omp-invalid-branch.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! Check invalid branches into or out of OpenMP structured blocks.
 
Index: flang/test/Semantics/omp-flush01.f90
===================================================================
--- flang/test/Semantics/omp-flush01.f90
+++ flang/test/Semantics/omp-flush01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! 2.17.8 Flush construct [OpenMP 5.0]
 !        memory-order-clause ->
Index: flang/test/Semantics/omp-do10.f90
===================================================================
--- flang/test/Semantics/omp-do10.f90
+++ flang/test/Semantics/omp-do10.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do09.f90
===================================================================
--- flang/test/Semantics/omp-do09.f90
+++ flang/test/Semantics/omp-do09.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do08.f90
===================================================================
--- flang/test/Semantics/omp-do08.f90
+++ flang/test/Semantics/omp-do08.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do07.f90
===================================================================
--- flang/test/Semantics/omp-do07.f90
+++ flang/test/Semantics/omp-do07.f90
@@ -1,4 +1,4 @@
-! RUN: not %f18 -fparse-only -fopenmp %s 2>&1 | FileCheck %s
+! RUN: not %flang -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s
 ! OpenMP Version 4.5
 ! 2.7.1 Loop Construct
 ! No statement in the associated loops other than the DO statements
Index: flang/test/Semantics/omp-do06.f90
===================================================================
--- flang/test/Semantics/omp-do06.f90
+++ flang/test/Semantics/omp-do06.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL:*
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do05.f90
===================================================================
--- flang/test/Semantics/omp-do05.f90
+++ flang/test/Semantics/omp-do05.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Loop Construct restrictions on single directive.
 
Index: flang/test/Semantics/omp-do04.f90
===================================================================
--- flang/test/Semantics/omp-do04.f90
+++ flang/test/Semantics/omp-do04.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do03.f90
===================================================================
--- flang/test/Semantics/omp-do03.f90
+++ flang/test/Semantics/omp-do03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! OpenMP Version 4.5
 ! 2.7.1 Loop Construct
Index: flang/test/Semantics/omp-do02.f90
===================================================================
--- flang/test/Semantics/omp-do02.f90
+++ flang/test/Semantics/omp-do02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! XFAIL: *
 
 ! OpenMP Version 4.5
Index: flang/test/Semantics/omp-do01.f90
===================================================================
--- flang/test/Semantics/omp-do01.f90
+++ flang/test/Semantics/omp-do01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Loop Construct
 ! The loop iteration variable may not appear in a firstprivate directive.
Index: flang/test/Semantics/omp-do-schedule02.f90
===================================================================
--- flang/test/Semantics/omp-do-schedule02.f90
+++ flang/test/Semantics/omp-do-schedule02.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Schedule Clause
 program omp_doSchedule
Index: flang/test/Semantics/omp-do-schedule01.f90
===================================================================
--- flang/test/Semantics/omp-do-schedule01.f90
+++ flang/test/Semantics/omp-do-schedule01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Schedule Clause
 program omp_doSchedule
Index: flang/test/Semantics/omp-do-ordered.f90
===================================================================
--- flang/test/Semantics/omp-do-ordered.f90
+++ flang/test/Semantics/omp-do-ordered.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Ordered Clause
 
Index: flang/test/Semantics/omp-do-ordered-positivecases.f90
===================================================================
--- flang/test/Semantics/omp-do-ordered-positivecases.f90
+++ flang/test/Semantics/omp-do-ordered-positivecases.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Ordered Clause positive cases.
 
Index: flang/test/Semantics/omp-do-cycle.f90
===================================================================
--- flang/test/Semantics/omp-do-cycle.f90
+++ flang/test/Semantics/omp-do-cycle.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! Check for cycle statements leaving an OpenMP structured block
 
Index: flang/test/Semantics/omp-do-collapse.f90
===================================================================
--- flang/test/Semantics/omp-do-collapse.f90
+++ flang/test/Semantics/omp-do-collapse.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Collapse Clause
 program omp_doCollapse
Index: flang/test/Semantics/omp-do-collapse-positivecases.f90
===================================================================
--- flang/test/Semantics/omp-do-collapse-positivecases.f90
+++ flang/test/Semantics/omp-do-collapse-positivecases.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.7.1 Collapse Clause Positive cases
 
Index: flang/test/Semantics/omp-device-constructs.f90
===================================================================
--- flang/test/Semantics/omp-device-constructs.f90
+++ flang/test/Semantics/omp-device-constructs.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! Check OpenMP clause validity for the following directives:
 !     2.10 Device constructs
 program main
Index: flang/test/Semantics/omp-depend03.f90
===================================================================
--- flang/test/Semantics/omp-depend03.f90
+++ flang/test/Semantics/omp-depend03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.13.9 Depend Clause
 ! Coarrays are not supported in depend clause
Index: flang/test/Semantics/omp-depend02.f90
===================================================================
--- flang/test/Semantics/omp-depend02.f90
+++ flang/test/Semantics/omp-depend02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.13.9 Depend Clause
 ! A variable that is part of another variable
Index: flang/test/Semantics/omp-depend01.f90
===================================================================
--- flang/test/Semantics/omp-depend01.f90
+++ flang/test/Semantics/omp-depend01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.13.9 Depend Clause
 ! List items used in depend clauses cannot be zero-length array sections.
Index: flang/test/Semantics/omp-default02.f90
===================================================================
--- flang/test/Semantics/omp-default02.f90
+++ flang/test/Semantics/omp-default02.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.1 default Clause - a positive test case.
 
Index: flang/test/Semantics/omp-default.f90
===================================================================
--- flang/test/Semantics/omp-default.f90
+++ flang/test/Semantics/omp-default.f90
@@ -1,4 +1,4 @@
-!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+!RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.3.1 default Clause
 program omp_default
Index: flang/test/Semantics/omp-declarative-directive.f90
===================================================================
--- flang/test/Semantics/omp-declarative-directive.f90
+++ flang/test/Semantics/omp-declarative-directive.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 ! Check OpenMP declarative directives
 
Index: flang/test/Semantics/omp-copyin05.f90
===================================================================
--- flang/test/Semantics/omp-copyin05.f90
+++ flang/test/Semantics/omp-copyin05.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.4.1 copyin Clause
 ! A common block name that appears in a copyin clause must be declared to be
Index: flang/test/Semantics/omp-copyin04.f90
===================================================================
--- flang/test/Semantics/omp-copyin04.f90
+++ flang/test/Semantics/omp-copyin04.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.4.1 copyin Clause
 ! A list item that appears in a copyin clause must be threadprivate
Index: flang/test/Semantics/omp-copyin03.f90
===================================================================
--- flang/test/Semantics/omp-copyin03.f90
+++ flang/test/Semantics/omp-copyin03.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.4.1 copyin Clause
 ! A list item that appears in a copyin clause must be threadprivate.
Index: flang/test/Semantics/omp-copyin02.f90
===================================================================
--- flang/test/Semantics/omp-copyin02.f90
+++ flang/test/Semantics/omp-copyin02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.4.1 copyin Clause
 ! A common block name that appears in a copyin clause must be declared to be
Index: flang/test/Semantics/omp-copyin01.f90
===================================================================
--- flang/test/Semantics/omp-copyin01.f90
+++ flang/test/Semantics/omp-copyin01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 ! OpenMP Version 4.5
 ! 2.15.4.1 copyin Clause
 ! A list item that appears in a copyin clause must be threadprivate
Index: flang/test/Semantics/omp-combined-constructs.f90
===================================================================
--- flang/test/Semantics/omp-combined-constructs.f90
+++ flang/test/Semantics/omp-combined-constructs.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 
 program main
   implicit none
Index: flang/test/Semantics/omp-atomic.f90
===================================================================
--- flang/test/Semantics/omp-atomic.f90
+++ flang/test/Semantics/omp-atomic.f90
@@ -1,4 +1,4 @@
-! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! RUN: %S/test_errors.sh %s %t %flang -fopenmp
 use omp_lib
 ! Check OpenMP 2.13.6 atomic Construct
 
Index: flang/test/Semantics/OpenACC/acc-wait-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-wait-validity.f90
+++ flang/test/Semantics/OpenACC/acc-wait-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.16.13 Wait
Index: flang/test/Semantics/OpenACC/acc-update-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-update-validity.f90
+++ flang/test/Semantics/OpenACC/acc-update-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.14.4 Update
Index: flang/test/Semantics/OpenACC/acc-shutdown-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-shutdown-validity.f90
+++ flang/test/Semantics/OpenACC/acc-shutdown-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.14.2 Shutdown
Index: flang/test/Semantics/OpenACC/acc-set-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-set-validity.f90
+++ flang/test/Semantics/OpenACC/acc-set-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.14.3 Set
Index: flang/test/Semantics/OpenACC/acc-serial.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-serial.f90
+++ flang/test/Semantics/OpenACC/acc-serial.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.5.2 Serial
Index: flang/test/Semantics/OpenACC/acc-serial-loop.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-serial-loop.f90
+++ flang/test/Semantics/OpenACC/acc-serial-loop.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.11 Serial Loop
Index: flang/test/Semantics/OpenACC/acc-routine-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-routine-validity.f90
+++ flang/test/Semantics/OpenACC/acc-routine-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.15.1 routine
Index: flang/test/Semantics/OpenACC/acc-resolve02.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-resolve02.f90
+++ flang/test/Semantics/OpenACC/acc-resolve02.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 subroutine compute()
   integer :: a(3), c, i
Index: flang/test/Semantics/OpenACC/acc-resolve01.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-resolve01.f90
+++ flang/test/Semantics/OpenACC/acc-resolve01.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Data-Mapping Attribute Clauses
 ! 2.15.14 default Clause
Index: flang/test/Semantics/OpenACC/acc-parallel.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-parallel.f90
+++ flang/test/Semantics/OpenACC/acc-parallel.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.5.1 Parallel
Index: flang/test/Semantics/OpenACC/acc-parallel-loop-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-parallel-loop-validity.f90
+++ flang/test/Semantics/OpenACC/acc-parallel-loop-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.11 Parallel Loop
Index: flang/test/Semantics/OpenACC/acc-loop.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-loop.f90
+++ flang/test/Semantics/OpenACC/acc-loop.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.9 Loop
Index: flang/test/Semantics/OpenACC/acc-kernels.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-kernels.f90
+++ flang/test/Semantics/OpenACC/acc-kernels.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.5.3 Kernels
Index: flang/test/Semantics/OpenACC/acc-kernels-loop.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-kernels-loop.f90
+++ flang/test/Semantics/OpenACC/acc-kernels-loop.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.11 Kernels Loop
Index: flang/test/Semantics/OpenACC/acc-init-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-init-validity.f90
+++ flang/test/Semantics/OpenACC/acc-init-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.14.1 Init
Index: flang/test/Semantics/OpenACC/acc-host-data.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-host-data.f90
+++ flang/test/Semantics/OpenACC/acc-host-data.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.8 host_data
Index: flang/test/Semantics/OpenACC/acc-declare-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-declare-validity.f90
+++ flang/test/Semantics/OpenACC/acc-declare-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.13 Declare
Index: flang/test/Semantics/OpenACC/acc-data.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-data.f90
+++ flang/test/Semantics/OpenACC/acc-data.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.6.5 Data
Index: flang/test/Semantics/OpenACC/acc-canonicalization-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-canonicalization-validity.f90
+++ flang/test/Semantics/OpenACC/acc-canonicalization-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC canonalization validity for the construct defined below:
 !   2.9 Loop
Index: flang/test/Semantics/OpenACC/acc-cache-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-cache-validity.f90
+++ flang/test/Semantics/OpenACC/acc-cache-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.10 Cache
Index: flang/test/Semantics/OpenACC/acc-branch.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-branch.f90
+++ flang/test/Semantics/OpenACC/acc-branch.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC restruction in branch in and out of some construct
 !
Index: flang/test/Semantics/OpenACC/acc-atomic-validity.f90
===================================================================
--- flang/test/Semantics/OpenACC/acc-atomic-validity.f90
+++ flang/test/Semantics/OpenACC/acc-atomic-validity.f90
@@ -1,4 +1,4 @@
-! RUN: %S/../test_errors.sh %s %t %f18 -fopenacc
+! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
 
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.12 Atomic
Index: flang/test/Flang-Driver/driver-help.f90
===================================================================
--- flang/test/Flang-Driver/driver-help.f90
+++ flang/test/Flang-Driver/driver-help.f90
@@ -28,6 +28,8 @@
 ! HELP-NEXT: Use <value> as character line width in fixed mode
 ! HELP-NEXT: -ffree-form            Process source files in free form
 ! HELP-NEXT: -fno-color-diagnostics Disable colors in diagnostics
+! HELP-NEXT: -fopenacc              Enable OpenACC
+! HELP-NEXT: -fopenmp               Parse OpenMP pragmas and generate parallel code.
 ! HELP-NEXT: -help                  Display available options
 ! HELP-NEXT: -I <dir>               Add directory to the end of the list of include search paths
 ! HELP-NEXT: -module-dir <dir>      Put MODULE files in <dir>
@@ -48,6 +50,8 @@
 ! HELP-FC1-NEXT: -ffixed-line-length=<value>
 ! HELP-FC1-NEXT: Use <value> as character line width in fixed mode
 ! HELP-FC1-NEXT: -ffree-form            Process source files in free form
+! HELP-FC1-NEXT: -fopenacc              Enable OpenACC
+! HELP-FC1-NEXT: -fopenmp               Parse OpenMP pragmas and generate parallel code.
 ! HELP-FC1-NEXT: -help                  Display available options
 ! HELP-FC1-NEXT: -I <dir>               Add directory to the end of the list of include search paths
 ! HELP-FC1-NEXT: -module-dir <dir>      Put MODULE files in <dir>
Index: flang/test/Flang-Driver/driver-help-hidden.f90
===================================================================
--- flang/test/Flang-Driver/driver-help-hidden.f90
+++ flang/test/Flang-Driver/driver-help-hidden.f90
@@ -28,6 +28,8 @@
 ! CHECK-NEXT: Use <value> as character line width in fixed mode
 ! CHECK-NEXT: -ffree-form            Process source files in free form
 ! CHECK-NEXT: -fno-color-diagnostics Disable colors in diagnostics
+! CHECK-NEXT: -fopenacc              Enable OpenACC
+! CHECK-NEXT: -fopenmp               Parse OpenMP pragmas and generate parallel code.
 ! CHECK-NEXT: -help     Display available options
 ! CHECK-NEXT: -I <dir>               Add directory to the end of the list of include search paths
 ! CHECK-NEXT: -module-dir <dir>      Put MODULE files in <dir>
Index: flang/lib/Frontend/FrontendActions.cpp
===================================================================
--- flang/lib/Frontend/FrontendActions.cpp
+++ flang/lib/Frontend/FrontendActions.cpp
@@ -133,8 +133,8 @@
   auto &parseTree{*ci.parsing().parseTree()};
 
   // Prepare semantics
-  Fortran::semantics::Semantics semantics{
-      ci.semanticsContext(), parseTree, ci.parsing().cooked().AsCharBlock()};
+  Fortran::semantics::Semantics semantics{ci.invocation().semanticsContext(),
+      parseTree, ci.parsing().cooked().AsCharBlock()};
 
   // Run semantic checks
   semantics.Perform();
Index: flang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- flang/lib/Frontend/CompilerInvocation.cpp
+++ flang/lib/Frontend/CompilerInvocation.cpp
@@ -7,7 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "flang/Frontend/CompilerInvocation.h"
+#include "flang/Common/Fortran-features.h"
 #include "flang/Frontend/PreprocessorOptions.h"
+#include "flang/Semantics/semantics.h"
 #include "flang/Version.inc"
 #include "clang/Basic/AllDiagnostics.h"
 #include "clang/Basic/DiagnosticDriver.h"
@@ -21,6 +23,7 @@
 #include "llvm/Option/OptTable.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/raw_ostream.h"
+#include <memory>
 
 using namespace Fortran::frontend;
 
@@ -196,6 +199,14 @@
       opts.fixedFormColumns_ = columns;
     }
   }
+
+  // Extensions
+  if (args.hasArg(clang::driver::options::OPT_fopenacc)) {
+    opts.features_.Enable(Fortran::common::LanguageFeature::OpenACC);
+  }
+  if (args.hasArg(clang::driver::options::OPT_fopenmp)) {
+    opts.features_.Enable(Fortran::common::LanguageFeature::OpenMP);
+  }
   return dashX;
 }
 
@@ -322,6 +333,7 @@
   // TODO: When expanding this list of standard predefinitions, consider
   // creating a dedicated API for this. Also at some point we will need to
   // differentiate between different targets.
+  // TODO: Move to setDefaultPredefinitions
   fortranOptions.predefinitions.emplace_back("__flang__", "1");
   fortranOptions.predefinitions.emplace_back(
       "__flang_major__", FLANG_VERSION_MAJOR_STRING);
@@ -331,6 +343,21 @@
       "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
 }
 
+void CompilerInvocation::setDefaultPredefinitions() {
+  auto &fortranOptions = fortranOpts();
+  const auto &frontendOptions = frontendOpts();
+
+  // Add predefinitions based on extensions enabled
+  if (frontendOptions.features_.IsEnabled(
+          Fortran::common::LanguageFeature::OpenACC)) {
+    fortranOptions.predefinitions.emplace_back("_OPENACC", "202011");
+  }
+  if (frontendOptions.features_.IsEnabled(
+          Fortran::common::LanguageFeature::OpenMP)) {
+    fortranOptions.predefinitions.emplace_back("_OPENMP", "201511");
+  }
+}
+
 void CompilerInvocation::setFortranOpts() {
   auto &fortranOptions = fortranOpts();
   const auto &frontendOptions = frontendOpts();
@@ -343,6 +370,8 @@
   }
   fortranOptions.fixedFormColumns = frontendOptions.fixedFormColumns_;
 
+  fortranOptions.features = frontendOptions.features_;
+
   collectMacroDefinitions(preprocessorOptions, fortranOptions);
 
   fortranOptions.searchDirectories.insert(
@@ -357,10 +386,14 @@
 }
 
 void CompilerInvocation::setSemanticsOpts(
-    Fortran::semantics::SemanticsContext &semaCtxt) {
-  auto &fortranOptions = fortranOpts();
+    Fortran::parser::AllCookedSources &allCookedSources) {
+  const auto &fortranOptions = fortranOpts();
+
+  semanticsContext_ = std::make_unique<semantics::SemanticsContext>(
+      *(new Fortran::common::IntrinsicTypeDefaultKinds()),
+      fortranOptions.features, allCookedSources);
+
   auto &moduleDirJ = moduleDir();
-  semaCtxt.set_moduleDirectory(moduleDirJ)
+  semanticsContext_->set_moduleDirectory(moduleDirJ)
       .set_searchDirectories(fortranOptions.searchDirectories);
-  return;
 }
Index: flang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- flang/lib/Frontend/CompilerInstance.cpp
+++ flang/lib/Frontend/CompilerInstance.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "flang/Frontend/CompilerInstance.h"
+#include "flang/Common/Fortran-features.h"
 #include "flang/Frontend/CompilerInvocation.h"
 #include "flang/Frontend/TextDiagnosticPrinter.h"
 #include "flang/Parser/parsing.h"
@@ -24,10 +25,7 @@
     : invocation_(new CompilerInvocation()),
       allSources_(new Fortran::parser::AllSources()),
       allCookedSources_(new Fortran::parser::AllCookedSources(*allSources_)),
-      parsing_(new Fortran::parser::Parsing(*allCookedSources_)),
-      semanticsContext_(new Fortran::semantics::SemanticsContext(
-          *(new Fortran::common::IntrinsicTypeDefaultKinds()),
-          *(new common::LanguageFeatureControl()), *allCookedSources_)) {
+      parsing_(new Fortran::parser::Parsing(*allCookedSources_)) {
   // TODO: This is a good default during development, but ultimately we should
   // give the user the opportunity to specify this.
   allSources_->set_encoding(Fortran::parser::Encoding::UTF_8);
@@ -144,10 +142,11 @@
 
   // Set some sane defaults for the frontend.
   invoc.SetDefaultFortranOpts();
+  invoc.setDefaultPredefinitions();
   // Update the fortran options based on user-based input.
   invoc.setFortranOpts();
-  // Set semantic options
-  invoc.setSemanticsOpts(this->semanticsContext());
+  // Create the semantics context and set semantic options.
+  invoc.setSemanticsOpts(*this->allCookedSources_);
 
   // Run the frontend action `act` for every input file.
   for (const FrontendInputFile &fif : frontendOpts().inputs_) {
Index: flang/include/flang/Frontend/FrontendOptions.h
===================================================================
--- flang/include/flang/Frontend/FrontendOptions.h
+++ flang/include/flang/Frontend/FrontendOptions.h
@@ -8,6 +8,7 @@
 #ifndef LLVM_FLANG_FRONTEND_FRONTENDOPTIONS_H
 #define LLVM_FLANG_FRONTEND_FRONTENDOPTIONS_H
 
+#include "flang/Common/Fortran-features.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/MemoryBuffer.h"
 
@@ -178,6 +179,9 @@
   // source file.
   int fixedFormColumns_ = 72;
 
+  // Language features
+  common::LanguageFeatureControl features_;
+
 public:
   FrontendOptions() : showHelp_(false), showVersion_(false) {}
 
Index: flang/include/flang/Frontend/CompilerInvocation.h
===================================================================
--- flang/include/flang/Frontend/CompilerInvocation.h
+++ flang/include/flang/Frontend/CompilerInvocation.h
@@ -61,6 +61,9 @@
   // of options.
   Fortran::parser::Options parserOpts_;
 
+  // Semantics context
+  std::unique_ptr<Fortran::semantics::SemanticsContext> semanticsContext_;
+
   /// Semantic options
   // TODO: Merge with or translate to frontendOpts_. We shouldn't need two sets
   // of options.
@@ -75,6 +78,13 @@
   Fortran::parser::Options &fortranOpts() { return parserOpts_; }
   const Fortran::parser::Options &fortranOpts() const { return parserOpts_; }
 
+  Fortran::semantics::SemanticsContext &semanticsContext() {
+    return *semanticsContext_;
+  }
+  const Fortran::semantics::SemanticsContext &semanticsContext() const {
+    return *semanticsContext_;
+  }
+
   std::string &moduleDir() { return moduleDir_; }
   const std::string &moduleDir() const { return moduleDir_; }
 
@@ -93,12 +103,15 @@
   // compiler driver options in libclangDriver.
   void SetDefaultFortranOpts();
 
+  /// Set the default predefinitions.
+  void setDefaultPredefinitions();
+
   /// Set the Fortran options to user-specified values.
   /// These values are found in the preprocessor options.
   void setFortranOpts();
 
   /// Set the Semantic Options
-  void setSemanticsOpts(Fortran::semantics::SemanticsContext &);
+  void setSemanticsOpts(Fortran::parser::AllCookedSources &);
 };
 
 } // end namespace Fortran::frontend
Index: flang/include/flang/Frontend/CompilerInstance.h
===================================================================
--- flang/include/flang/Frontend/CompilerInstance.h
+++ flang/include/flang/Frontend/CompilerInstance.h
@@ -30,8 +30,6 @@
 
   std::shared_ptr<Fortran::parser::Parsing> parsing_;
 
-  std::unique_ptr<Fortran::semantics::SemanticsContext> semanticsContext_;
-
   /// The stream for diagnostics from Semantics
   llvm::raw_ostream *semaOutputStream_ = &llvm::errs();
 
@@ -102,9 +100,6 @@
   /// }
   /// @name Semantic analysis
   /// {
-  Fortran::semantics::SemanticsContext &semanticsContext() const {
-    return *semanticsContext_;
-  }
 
   /// Replace the current stream for verbose output.
   void set_semaOutputStream(llvm::raw_ostream &Value);
Index: clang/lib/Driver/ToolChains/Flang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Flang.cpp
+++ clang/lib/Driver/ToolChains/Flang.cpp
@@ -22,7 +22,8 @@
 void Flang::AddFortranDialectOptions(const ArgList &Args,
                                      ArgStringList &CmdArgs) const {
   Args.AddAllArgs(CmdArgs, {options::OPT_ffixed_form, options::OPT_ffree_form,
-                            options::OPT_ffixed_line_length_EQ});
+                            options::OPT_ffixed_line_length_EQ,
+                            options::OPT_fopenmp, options::OPT_fopenacc});
 }
 
 void Flang::AddPreprocessingOptions(const ArgList &Args,
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2157,7 +2157,7 @@
 
 def fobjc_sender_dependent_dispatch : Flag<["-"], "fobjc-sender-dependent-dispatch">, Group<f_Group>;
 def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group<f_Group>;
-def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>,
+def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, FlangOption, FC1Option]>,
   HelpText<"Parse OpenMP pragmas and generate parallel code.">;
 def fno_openmp : Flag<["-"], "fno-openmp">, Group<f_Group>, Flags<[NoArgumentUnused]>;
 def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>;
@@ -4232,6 +4232,8 @@
   DocBrief<[{Set column after which characters are ignored in typical fixed-form lines in the source
 file}]>;
 def ffixed_line_length_VALUE : Joined<["-"], "ffixed-line-length-">, Group<f_Group>, Alias<ffixed_line_length_EQ>;
+def fopenacc : Flag<["-"], "fopenacc">, Group<f_Group>,
+  HelpText<"Enable OpenACC">;
 
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to