[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-09 Thread Tom Eccles via llvm-branch-commits

https://github.com/tblah approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/139131
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz created 
https://github.com/llvm/llvm-project/pull/139131

The OpenMP version is stored in LangOptions in SemanticsContext. Use the 
fallback version where SemanticsContext is unavailable (mostly in case of debug 
dumps).

RFC: 
https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz updated 
https://github.com/llvm/llvm-project/pull/139131

>From 9566bf6fd60d2b4f1dac86f6646002b2541e6736 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek 
Date: Wed, 7 May 2025 15:32:28 -0500
Subject: [PATCH 1/2] [flang][OpenMP] Pass OpenMP version to
 getOpenMPDirectiveName

The OpenMP version is stored in LangOptions in SemanticsContext. Use the
fallback version where SemanticsContext is unavailable (mostly in case of
debug dumps).

RFC: 
https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507
---
 .../FlangOmpReport/FlangOmpReportVisitor.cpp  |  5 ++-
 flang/include/flang/Parser/dump-parse-tree.h  |  5 ++-
 flang/include/flang/Parser/unparse.h  |  7 
 .../flang/Semantics/unparse-with-symbols.h|  5 +++
 flang/lib/Frontend/ParserActions.cpp  |  3 +-
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 +-
 flang/lib/Lower/OpenMP/Decomposer.cpp |  3 +-
 flang/lib/Lower/OpenMP/OpenMP.cpp |  6 ++-
 flang/lib/Parser/openmp-parsers.cpp   |  3 +-
 flang/lib/Parser/parse-tree.cpp   |  5 ++-
 flang/lib/Parser/unparse.cpp  | 39 ---
 flang/lib/Semantics/check-omp-structure.cpp   | 18 -
 flang/lib/Semantics/mod-file.cpp  | 11 +++---
 flang/lib/Semantics/resolve-directives.cpp| 25 +++-
 flang/lib/Semantics/unparse-with-symbols.cpp  |  6 +--
 15 files changed, 93 insertions(+), 52 deletions(-)

diff --git a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp 
b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
index dbbf86a6c6151..bf66151d59950 100644
--- a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
+++ b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
@@ -267,8 +267,9 @@ void OpenMPCounterVisitor::Post(const 
OmpScheduleClause::Kind &c) {
   "type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";";
 }
 void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) {
-  clauseDetails +=
-  "name_modifier=" + llvm::omp::getOpenMPDirectiveName(c.v).str() + ";";
+  clauseDetails += "name_modifier=" +
+  llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() 
+
+  ";";
 }
 void OpenMPCounterVisitor::Post(const OmpClause &c) {
   PostClauseCommon(normalize_clause_name(c.source.ToString()));
diff --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index a3721bc8410ba..df9278697346f 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -17,6 +17,7 @@
 #include "flang/Common/idioms.h"
 #include "flang/Common/indirection.h"
 #include "flang/Support/Fortran.h"
+#include "llvm/Frontend/OpenMP/OMP.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -545,8 +546,8 @@ class ParseTreeDumper {
   NODE(parser, OmpBeginSectionsDirective)
   NODE(parser, OmpBlockDirective)
   static std::string GetNodeName(const llvm::omp::Directive &x) {
-return llvm::Twine(
-"llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
+return llvm::Twine("llvm::omp::Directive = ",
+llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion))
 .str();
   }
   NODE(parser, OmpClause)
diff --git a/flang/include/flang/Parser/unparse.h 
b/flang/include/flang/Parser/unparse.h
index 40094ecbc85e5..349597213d904 100644
--- a/flang/include/flang/Parser/unparse.h
+++ b/flang/include/flang/Parser/unparse.h
@@ -18,6 +18,10 @@ namespace llvm {
 class raw_ostream;
 }
 
+namespace Fortran::common {
+class LangOptions;
+}
+
 namespace Fortran::evaluate {
 struct GenericExprWrapper;
 struct GenericAssignmentWrapper;
@@ -47,14 +51,17 @@ struct AnalyzedObjectsAsFortran {
 // Converts parsed program (or fragment) to out as Fortran.
 template 
 void Unparse(llvm::raw_ostream &out, const A &root,
+const common::LangOptions &langOpts,
 Encoding encoding = Encoding::UTF_8, bool capitalizeKeywords = true,
 bool backslashEscapes = true, preStatementType *preStatement = nullptr,
 AnalyzedObjectsAsFortran * = nullptr);
 
 extern template void Unparse(llvm::raw_ostream &out, const Program &program,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 extern template void Unparse(llvm::raw_ostream &out, const Expr &expr,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 } // namespace Fortran::parser
diff --git a/flang/include/flang/Semantics/unparse-with-symbols.h 
b/flang/include/flang/Semantics/unparse-with-symbols.h
index 5e18b3fc3063d..702911bbab627 100644
--- a/flang/include/flang/Semantics/unparse-with-symbols.h
+++ b/flang/include/flang/Semantics/unparse-with-symbols.h
@@ -16,6 +16,10 @@ n

[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread via llvm-branch-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- 
flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp 
flang/include/flang/Parser/dump-parse-tree.h 
flang/include/flang/Parser/unparse.h 
flang/include/flang/Semantics/unparse-with-symbols.h 
flang/lib/Frontend/ParserActions.cpp flang/lib/Lower/OpenMP/ClauseProcessor.h 
flang/lib/Lower/OpenMP/Decomposer.cpp flang/lib/Lower/OpenMP/OpenMP.cpp 
flang/lib/Parser/openmp-parsers.cpp flang/lib/Parser/parse-tree.cpp 
flang/lib/Parser/unparse.cpp flang/lib/Semantics/check-omp-structure.cpp 
flang/lib/Semantics/mod-file.cpp flang/lib/Semantics/resolve-directives.cpp 
flang/lib/Semantics/unparse-with-symbols.cpp
``





View the diff from clang-format here.


``diff
diff --git a/flang/include/flang/Parser/unparse.h 
b/flang/include/flang/Parser/unparse.h
index 349597213..d796109ca 100644
--- a/flang/include/flang/Parser/unparse.h
+++ b/flang/include/flang/Parser/unparse.h
@@ -51,18 +51,18 @@ struct AnalyzedObjectsAsFortran {
 // Converts parsed program (or fragment) to out as Fortran.
 template 
 void Unparse(llvm::raw_ostream &out, const A &root,
-const common::LangOptions &langOpts,
-Encoding encoding = Encoding::UTF_8, bool capitalizeKeywords = true,
-bool backslashEscapes = true, preStatementType *preStatement = nullptr,
+const common::LangOptions &langOpts, Encoding encoding = Encoding::UTF_8,
+bool capitalizeKeywords = true, bool backslashEscapes = true,
+preStatementType *preStatement = nullptr,
 AnalyzedObjectsAsFortran * = nullptr);
 
 extern template void Unparse(llvm::raw_ostream &out, const Program &program,
-const common::LangOptions &langOpts,
-Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
+const common::LangOptions &langOpts, Encoding encoding,
+bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 extern template void Unparse(llvm::raw_ostream &out, const Expr &expr,
-const common::LangOptions &langOpts,
-Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
+const common::LangOptions &langOpts, Encoding encoding,
+bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 } // namespace Fortran::parser
 

``




https://github.com/llvm/llvm-project/pull/139131
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz updated 
https://github.com/llvm/llvm-project/pull/139131

>From 9566bf6fd60d2b4f1dac86f6646002b2541e6736 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek 
Date: Wed, 7 May 2025 15:32:28 -0500
Subject: [PATCH 1/4] [flang][OpenMP] Pass OpenMP version to
 getOpenMPDirectiveName

The OpenMP version is stored in LangOptions in SemanticsContext. Use the
fallback version where SemanticsContext is unavailable (mostly in case of
debug dumps).

RFC: 
https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507
---
 .../FlangOmpReport/FlangOmpReportVisitor.cpp  |  5 ++-
 flang/include/flang/Parser/dump-parse-tree.h  |  5 ++-
 flang/include/flang/Parser/unparse.h  |  7 
 .../flang/Semantics/unparse-with-symbols.h|  5 +++
 flang/lib/Frontend/ParserActions.cpp  |  3 +-
 flang/lib/Lower/OpenMP/ClauseProcessor.h  |  4 +-
 flang/lib/Lower/OpenMP/Decomposer.cpp |  3 +-
 flang/lib/Lower/OpenMP/OpenMP.cpp |  6 ++-
 flang/lib/Parser/openmp-parsers.cpp   |  3 +-
 flang/lib/Parser/parse-tree.cpp   |  5 ++-
 flang/lib/Parser/unparse.cpp  | 39 ---
 flang/lib/Semantics/check-omp-structure.cpp   | 18 -
 flang/lib/Semantics/mod-file.cpp  | 11 +++---
 flang/lib/Semantics/resolve-directives.cpp| 25 +++-
 flang/lib/Semantics/unparse-with-symbols.cpp  |  6 +--
 15 files changed, 93 insertions(+), 52 deletions(-)

diff --git a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp 
b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
index dbbf86a6c6151..bf66151d59950 100644
--- a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
+++ b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
@@ -267,8 +267,9 @@ void OpenMPCounterVisitor::Post(const 
OmpScheduleClause::Kind &c) {
   "type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";";
 }
 void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) {
-  clauseDetails +=
-  "name_modifier=" + llvm::omp::getOpenMPDirectiveName(c.v).str() + ";";
+  clauseDetails += "name_modifier=" +
+  llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() 
+
+  ";";
 }
 void OpenMPCounterVisitor::Post(const OmpClause &c) {
   PostClauseCommon(normalize_clause_name(c.source.ToString()));
diff --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index a3721bc8410ba..df9278697346f 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -17,6 +17,7 @@
 #include "flang/Common/idioms.h"
 #include "flang/Common/indirection.h"
 #include "flang/Support/Fortran.h"
+#include "llvm/Frontend/OpenMP/OMP.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -545,8 +546,8 @@ class ParseTreeDumper {
   NODE(parser, OmpBeginSectionsDirective)
   NODE(parser, OmpBlockDirective)
   static std::string GetNodeName(const llvm::omp::Directive &x) {
-return llvm::Twine(
-"llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
+return llvm::Twine("llvm::omp::Directive = ",
+llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion))
 .str();
   }
   NODE(parser, OmpClause)
diff --git a/flang/include/flang/Parser/unparse.h 
b/flang/include/flang/Parser/unparse.h
index 40094ecbc85e5..349597213d904 100644
--- a/flang/include/flang/Parser/unparse.h
+++ b/flang/include/flang/Parser/unparse.h
@@ -18,6 +18,10 @@ namespace llvm {
 class raw_ostream;
 }
 
+namespace Fortran::common {
+class LangOptions;
+}
+
 namespace Fortran::evaluate {
 struct GenericExprWrapper;
 struct GenericAssignmentWrapper;
@@ -47,14 +51,17 @@ struct AnalyzedObjectsAsFortran {
 // Converts parsed program (or fragment) to out as Fortran.
 template 
 void Unparse(llvm::raw_ostream &out, const A &root,
+const common::LangOptions &langOpts,
 Encoding encoding = Encoding::UTF_8, bool capitalizeKeywords = true,
 bool backslashEscapes = true, preStatementType *preStatement = nullptr,
 AnalyzedObjectsAsFortran * = nullptr);
 
 extern template void Unparse(llvm::raw_ostream &out, const Program &program,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 extern template void Unparse(llvm::raw_ostream &out, const Expr &expr,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 } // namespace Fortran::parser
diff --git a/flang/include/flang/Semantics/unparse-with-symbols.h 
b/flang/include/flang/Semantics/unparse-with-symbols.h
index 5e18b3fc3063d..702911bbab627 100644
--- a/flang/include/flang/Semantics/unparse-with-symbols.h
+++ b/flang/include/flang/Semantics/unparse-with-symbols.h
@@ -16,6 +16,10 @@ n

[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz updated 
https://github.com/llvm/llvm-project/pull/139131



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (PR #139131)

2025-05-08 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-flang-semantics

Author: Krzysztof Parzyszek (kparzysz)


Changes

The OpenMP version is stored in LangOptions in SemanticsContext. Use the 
fallback version where SemanticsContext is unavailable (mostly in case of debug 
dumps).

RFC: 
https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507

---

Patch is 24.47 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/139131.diff


15 Files Affected:

- (modified) flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp (+3-2) 
- (modified) flang/include/flang/Parser/dump-parse-tree.h (+3-2) 
- (modified) flang/include/flang/Parser/unparse.h (+7) 
- (modified) flang/include/flang/Semantics/unparse-with-symbols.h (+5) 
- (modified) flang/lib/Frontend/ParserActions.cpp (+2-1) 
- (modified) flang/lib/Lower/OpenMP/ClauseProcessor.h (+3-1) 
- (modified) flang/lib/Lower/OpenMP/Decomposer.cpp (+2-1) 
- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+4-2) 
- (modified) flang/lib/Parser/openmp-parsers.cpp (+2-1) 
- (modified) flang/lib/Parser/parse-tree.cpp (+4-1) 
- (modified) flang/lib/Parser/unparse.cpp (+24-15) 
- (modified) flang/lib/Semantics/check-omp-structure.cpp (+9-9) 
- (modified) flang/lib/Semantics/mod-file.cpp (+6-5) 
- (modified) flang/lib/Semantics/resolve-directives.cpp (+16-9) 
- (modified) flang/lib/Semantics/unparse-with-symbols.cpp (+3-3) 


``diff
diff --git a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp 
b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
index dbbf86a6c6151..bf66151d59950 100644
--- a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
+++ b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp
@@ -267,8 +267,9 @@ void OpenMPCounterVisitor::Post(const 
OmpScheduleClause::Kind &c) {
   "type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";";
 }
 void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) {
-  clauseDetails +=
-  "name_modifier=" + llvm::omp::getOpenMPDirectiveName(c.v).str() + ";";
+  clauseDetails += "name_modifier=" +
+  llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() 
+
+  ";";
 }
 void OpenMPCounterVisitor::Post(const OmpClause &c) {
   PostClauseCommon(normalize_clause_name(c.source.ToString()));
diff --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index a3721bc8410ba..df9278697346f 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -17,6 +17,7 @@
 #include "flang/Common/idioms.h"
 #include "flang/Common/indirection.h"
 #include "flang/Support/Fortran.h"
+#include "llvm/Frontend/OpenMP/OMP.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -545,8 +546,8 @@ class ParseTreeDumper {
   NODE(parser, OmpBeginSectionsDirective)
   NODE(parser, OmpBlockDirective)
   static std::string GetNodeName(const llvm::omp::Directive &x) {
-return llvm::Twine(
-"llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
+return llvm::Twine("llvm::omp::Directive = ",
+llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion))
 .str();
   }
   NODE(parser, OmpClause)
diff --git a/flang/include/flang/Parser/unparse.h 
b/flang/include/flang/Parser/unparse.h
index 40094ecbc85e5..349597213d904 100644
--- a/flang/include/flang/Parser/unparse.h
+++ b/flang/include/flang/Parser/unparse.h
@@ -18,6 +18,10 @@ namespace llvm {
 class raw_ostream;
 }
 
+namespace Fortran::common {
+class LangOptions;
+}
+
 namespace Fortran::evaluate {
 struct GenericExprWrapper;
 struct GenericAssignmentWrapper;
@@ -47,14 +51,17 @@ struct AnalyzedObjectsAsFortran {
 // Converts parsed program (or fragment) to out as Fortran.
 template 
 void Unparse(llvm::raw_ostream &out, const A &root,
+const common::LangOptions &langOpts,
 Encoding encoding = Encoding::UTF_8, bool capitalizeKeywords = true,
 bool backslashEscapes = true, preStatementType *preStatement = nullptr,
 AnalyzedObjectsAsFortran * = nullptr);
 
 extern template void Unparse(llvm::raw_ostream &out, const Program &program,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 extern template void Unparse(llvm::raw_ostream &out, const Expr &expr,
+const common::LangOptions &langOpts,
 Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
 preStatementType *preStatement, AnalyzedObjectsAsFortran *);
 } // namespace Fortran::parser
diff --git a/flang/include/flang/Semantics/unparse-with-symbols.h 
b/flang/include/flang/Semantics/unparse-with-symbols.h
index 5e18b3fc3063d..702911bbab627 100644
--- a/flang/include/flang/Semantics/unparse-with-symbols.h
+++ b/flang/include/flang/Semantics/unparse-with-symbols.h
@@ -16,6 +16,10 @@ namespace llvm {
 class raw_ostream;
 }
 
+names