-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Conversation
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.
@llvm/pr-subscribers-flang-driver Author: Tarun Prabhu (tarunprabhu) ChangesSome 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 Full diff: https://github.com/llvm/llvm-project/pull/85801.diff 3 Files Affected:
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
|
There was a problem hiding this 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.
I can switch the prefixes (back) to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
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.