Skip to content
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

[flang][NFC] Fix header guards #85801

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

tarunprabhu
Copy link
Contributor

Some header guards conflicted with clang. Fix a few others to follow the convention in the rest of the headers in flang.

Specifically the header guard in flang/Frontend/CodeGenOptions.h conflicted with that clang. I took the liberty of fixing a few others to make them consistent with the convention used in the rest of the repo.

Some header guards conficted with clang i.e. a clang header file had exactly
the same guard. Fix a few others to follow the convention in the rest of the
headers.
@llvmbot llvmbot added flang:driver flang Flang issues not falling into any other category labels Mar 19, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 19, 2024

@llvm/pr-subscribers-flang-driver

Author: Tarun Prabhu (tarunprabhu)

Changes

Some header guards conflicted with clang. Fix a few others to follow the convention in the rest of the headers in flang.

Specifically the header guard in flang/Frontend/CodeGenOptions.h conflicted with that clang. I took the liberty of fixing a few others to make them consistent with the convention used in the rest of the repo.


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

3 Files Affected:

  • (modified) flang/include/flang/Common/Version.h (+3-3)
  • (modified) flang/include/flang/Frontend/CodeGenOptions.h (+3-3)
  • (modified) flang/include/flang/Frontend/LangOptions.h (+3-3)
diff --git a/flang/include/flang/Common/Version.h b/flang/include/flang/Common/Version.h
index b1bd2416a61840..3257d4a4f64593 100644
--- a/flang/include/flang/Common/Version.h
+++ b/flang/include/flang/Common/Version.h
@@ -12,8 +12,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_FLANG_COMMON_VERSION_H
-#define LLVM_FLANG_COMMON_VERSION_H
+#ifndef FORTRAN_COMMON_VERSION_H
+#define FORTRAN_COMMON_VERSION_H
 
 #include "flang/Version.inc"
 #include "llvm/ADT/StringRef.h"
@@ -53,4 +53,4 @@ std::string getFlangFullVersion();
 std::string getFlangToolFullVersion(llvm::StringRef ToolName);
 } // namespace Fortran::common
 
-#endif // LLVM_FLANG_COMMON_VERSION_H
+#endif // FORTRAN_COMMON_VERSION_H
diff --git a/flang/include/flang/Frontend/CodeGenOptions.h b/flang/include/flang/Frontend/CodeGenOptions.h
index 0c318e4023af43..b0bbace82c0493 100644
--- a/flang/include/flang/Frontend/CodeGenOptions.h
+++ b/flang/include/flang/Frontend/CodeGenOptions.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H
-#define LLVM_CLANG_BASIC_CODEGENOPTIONS_H
+#ifndef FORTRAN_FRONTEND_CODEGENOPTIONS_H
+#define FORTRAN_FRONTEND_CODEGENOPTIONS_H
 
 #include "llvm/Frontend/Debug/Options.h"
 #include "llvm/Frontend/Driver/CodeGenOptions.h"
@@ -141,4 +141,4 @@ class CodeGenOptions : public CodeGenOptionsBase {
 
 } // end namespace Fortran::frontend
 
-#endif
+#endif // FORTRAN_FRONTEND_CODEGENOPTIONS_H
diff --git a/flang/include/flang/Frontend/LangOptions.h b/flang/include/flang/Frontend/LangOptions.h
index 7adf2eec9ca3dc..7ab2195818863d 100644
--- a/flang/include/flang/Frontend/LangOptions.h
+++ b/flang/include/flang/Frontend/LangOptions.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_FLANG_FRONTEND_LANGOPTIONS_H
-#define LLVM_FLANG_FRONTEND_LANGOPTIONS_H
+#ifndef FORTRAN_FRONTEND_LANGOPTIONS_H
+#define FORTRAN_FRONTEND_LANGOPTIONS_H
 
 #include <string>
 
@@ -63,4 +63,4 @@ class LangOptions : public LangOptionsBase {
 
 } // end namespace Fortran::frontend
 
-#endif
+#endif // FORTRAN_FRONTEND_LANGOPTIONS_H

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

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

Thanks for spotting this and cleaning up.

Personally, I think LLVM_FLANG is a better prefix because it is more specific and looks a bit more like the path to the file. But I don't feel strongly about it.

@tarunprabhu
Copy link
Contributor Author

I can switch the prefixes (back) to LLVM_FLANG_, but those would be the only instances of LLVM_FLANG_ in the whole repo. Everything else uses FORTRAN_ and that is also consistent with the namespace in use. I'll let others chime in and edit the patch accordingly.

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@tarunprabhu tarunprabhu merged commit d9f0d9a into llvm:main Mar 21, 2024
7 checks passed
@tarunprabhu tarunprabhu deleted the fix-header-guards branch March 21, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants