Skip to content

[Frontend][OpenMP] introduce OMP.h header file, use it instead of OMP… #84188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

kparzysz
Copy link
Contributor

@kparzysz kparzysz commented Mar 6, 2024

….h.inc

The consumers of OpenMP-related definitions include a TableGen-generated file OMP.h.inc. Having a separate OMP.h allows putting additional declarations in there that are not auto-generated.

This patch is NFC.

….h.inc

The consumers of OpenMP-related definitions include a TableGen-generated
file OMP.h.inc.  Having a separate OMP.h allows putting additional decla-
rations in there that are not auto-generated.

This patch is NFC.
@kparzysz kparzysz requested a review from skatrak March 6, 2024 15:43
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:openmp flang:semantics clang:openmp OpenMP related changes to Clang labels Mar 6, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2024

@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-semantics

Author: Krzysztof Parzyszek (kparzysz)

Changes

….h.inc

The consumers of OpenMP-related definitions include a TableGen-generated file OMP.h.inc. Having a separate OMP.h allows putting additional declarations in there that are not auto-generated.

This patch is NFC.


Full diff: https://github.com/llvm/llvm-project/pull/84188.diff

4 Files Affected:

  • (modified) flang/lib/Semantics/rewrite-directives.cpp (+1-1)
  • (added) llvm/include/llvm/Frontend/OpenMP/OMP.h (+18)
  • (modified) llvm/include/llvm/Frontend/OpenMP/OMPConstants.h (+1-2)
  • (modified) llvm/lib/Frontend/OpenMP/OMP.cpp (+1-1)
diff --git a/flang/lib/Semantics/rewrite-directives.cpp b/flang/lib/Semantics/rewrite-directives.cpp
index bab91d25308225..2c3c87f2546a35 100644
--- a/flang/lib/Semantics/rewrite-directives.cpp
+++ b/flang/lib/Semantics/rewrite-directives.cpp
@@ -11,7 +11,7 @@
 #include "flang/Parser/parse-tree.h"
 #include "flang/Semantics/semantics.h"
 #include "flang/Semantics/symbol.h"
-#include "llvm/Frontend/OpenMP/OMP.h.inc"
+#include "llvm/Frontend/OpenMP/OMP.h"
 #include <list>
 
 namespace Fortran::semantics {
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.h b/llvm/include/llvm/Frontend/OpenMP/OMP.h
new file mode 100644
index 00000000000000..a85cd9d344c6d7
--- /dev/null
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.h
@@ -0,0 +1,18 @@
+//===-- OMP.h - Core OpenMP definitions and declarations ---------- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the core set of OpenMP definitions and declarations.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_FRONTEND_OPENMP_OMP_H
+#define LLVM_FRONTEND_OPENMP_OMP_H
+
+#include "llvm/Frontend/OpenMP/OMP.h.inc"
+
+#endif // LLVM_FRONTEND_OPENMP_OMP_H
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
index f8812e7955b82d..1bfaf3718552e5 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
@@ -15,9 +15,8 @@
 #define LLVM_FRONTEND_OPENMP_OMPCONSTANTS_H
 
 #include "llvm/ADT/BitmaskEnum.h"
-
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Frontend/OpenMP/OMP.h.inc"
+#include "llvm/Frontend/OpenMP/OMP.h"
 
 namespace llvm {
 namespace omp {
diff --git a/llvm/lib/Frontend/OpenMP/OMP.cpp b/llvm/lib/Frontend/OpenMP/OMP.cpp
index eac5d4168c5ca4..4f2f95392648b3 100644
--- a/llvm/lib/Frontend/OpenMP/OMP.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMP.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Frontend/OpenMP/OMP.h.inc"
+#include "llvm/Frontend/OpenMP/OMP.h"
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.

@kparzysz kparzysz merged commit 141ebdd into llvm:main Mar 8, 2024
@kparzysz kparzysz deleted the users/kparzysz/omp-header branch March 8, 2024 13:21
@mjklemm
Copy link
Contributor

mjklemm commented Mar 9, 2024

Nit: Would it be possible to rename both files to not only have OMP in the basename? I know that it does not conflict with omp.h, which is the header file of the OpenMP API itself, but having a clearer name for OMP.h.inc and OMP.h would help avoid potential conflicts with omp.h on a case-insensitive file system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:openmp OpenMP related changes to Clang flang:openmp flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants