[flang-commits] [flang] [flang] Move parser invocations into ParserActions (PR #130309)
via flang-commits
flang-commits at lists.llvm.org
Fri Mar 7 09:43:07 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff f22291c791c8063ef5125392ada3556dd3e62df5 1dab2b97db1e8e1bdc3832633d83252b73faf3e8 --extensions cpp,h -- flang/include/flang/Frontend/ParserActions.h flang/include/flang/Parser/options.h flang/lib/Frontend/ParserActions.cpp flang/include/flang/Frontend/CompilerInstance.h flang/include/flang/Frontend/CompilerInvocation.h flang/include/flang/Frontend/FrontendActions.h flang/include/flang/Parser/parsing.h flang/lib/Frontend/FrontendAction.cpp flang/lib/Frontend/FrontendActions.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/include/flang/Frontend/CompilerInstance.h b/flang/include/flang/Frontend/CompilerInstance.h
index d34c128d01..e37ef5e236 100644
--- a/flang/include/flang/Frontend/CompilerInstance.h
+++ b/flang/include/flang/Frontend/CompilerInstance.h
@@ -15,8 +15,8 @@
#include "flang/Frontend/CompilerInvocation.h"
#include "flang/Frontend/FrontendAction.h"
-#include "flang/Frontend/PreprocessorOptions.h"
#include "flang/Frontend/ParserActions.h"
+#include "flang/Frontend/PreprocessorOptions.h"
#include "flang/Semantics/runtime-type-info.h"
#include "flang/Semantics/semantics.h"
#include "flang/Support/StringOstream.h"
diff --git a/flang/include/flang/Frontend/ParserActions.h b/flang/include/flang/Frontend/ParserActions.h
index 9c76f2bc9b..32deb0fe13 100644
--- a/flang/include/flang/Frontend/ParserActions.h
+++ b/flang/include/flang/Frontend/ParserActions.h
@@ -16,22 +16,22 @@
#include <string>
namespace llvm {
- class raw_string_ostream;
- class raw_ostream;
- class StringRef;
+class raw_string_ostream;
+class raw_ostream;
+class StringRef;
} // namespace llvm
namespace Fortran::lower {
- class LoweringBridge;
+class LoweringBridge;
} // namespace Fortran::lower
namespace Fortran::parser {
- class Parsing;
- class AllCookedSources;
+class Parsing;
+class AllCookedSources;
} // namespace Fortran::parser
namespace lower::pft {
- class Program;
+class Program;
} // namespace lower::pft
//=== Frontend Parser helpers ===
@@ -39,9 +39,10 @@ namespace lower::pft {
namespace Fortran::frontend {
class CompilerInstance;
-Fortran::parser::AllCookedSources& getAllCooked(CompilerInstance &ci);
+Fortran::parser::AllCookedSources &getAllCooked(CompilerInstance &ci);
-void parseAndLowerTree(CompilerInstance &ci, Fortran::lower::LoweringBridge &lb);
+void parseAndLowerTree(CompilerInstance &ci,
+ Fortran::lower::LoweringBridge &lb);
void dumpTree(CompilerInstance &ci);
@@ -49,7 +50,9 @@ void dumpProvenance(CompilerInstance &ci);
void dumpPreFIRTree(CompilerInstance &ci);
-void formatOrDumpPrescanner(std::string &buf, llvm::raw_string_ostream &outForPP, CompilerInstance &ci);
+void formatOrDumpPrescanner(std::string &buf,
+ llvm::raw_string_ostream &outForPP,
+ CompilerInstance &ci);
void debugMeasureParseTree(CompilerInstance &ci, llvm::StringRef filename);
diff --git a/flang/include/flang/Parser/parsing.h b/flang/include/flang/Parser/parsing.h
index 3b4f5f5145..3365628dc4 100644
--- a/flang/include/flang/Parser/parsing.h
+++ b/flang/include/flang/Parser/parsing.h
@@ -11,9 +11,9 @@
#include "instrumented-parser.h"
#include "message.h"
+#include "options.h"
#include "parse-tree.h"
#include "provenance.h"
-#include "options.h"
#include "flang/Parser/preprocessor.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp
index 5813f776ef..ab77d143fa 100644
--- a/flang/lib/Frontend/FrontendAction.cpp
+++ b/flang/lib/Frontend/FrontendAction.cpp
@@ -15,9 +15,9 @@
#include "flang/Frontend/FrontendActions.h"
#include "flang/Frontend/FrontendOptions.h"
#include "flang/Frontend/FrontendPluginRegistry.h"
+#include "flang/Parser/parsing.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "llvm/Support/Errc.h"
-#include "flang/Parser/parsing.h"
#include "llvm/Support/VirtualFileSystem.h"
using namespace Fortran::frontend;
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 69d7cf6cc9..431165020b 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -311,8 +311,9 @@ bool CodeGenAction::beginSourceFileAction() {
*mlirCtx, ci.getSemanticsContext(), defKinds,
ci.getSemanticsContext().intrinsics(),
ci.getSemanticsContext().targetCharacteristics(),
- Fortran::frontend::getAllCooked(ci), ci.getInvocation().getTargetOpts().triple,
- kindMap, ci.getInvocation().getLoweringOpts(),
+ Fortran::frontend::getAllCooked(ci),
+ ci.getInvocation().getTargetOpts().triple, kindMap,
+ ci.getInvocation().getLoweringOpts(),
ci.getInvocation().getFrontendOpts().envDefaults,
ci.getInvocation().getFrontendOpts().features, targetMachine,
ci.getInvocation().getTargetOpts(), ci.getInvocation().getCodeGenOpts());
diff --git a/flang/lib/Frontend/ParserActions.cpp b/flang/lib/Frontend/ParserActions.cpp
index 48cacaa5be..78144c488c 100644
--- a/flang/lib/Frontend/ParserActions.cpp
+++ b/flang/lib/Frontend/ParserActions.cpp
@@ -12,19 +12,19 @@
#include "flang/Frontend/ParserActions.h"
#include "flang/Frontend/CompilerInstance.h"
+#include "flang/Lower/Bridge.h"
+#include "flang/Lower/PFTBuilder.h"
#include "flang/Parser/dump-parse-tree.h"
#include "flang/Parser/parsing.h"
-#include "flang/Parser/unparse.h"
-#include "flang/Parser/source.h"
#include "flang/Parser/provenance.h"
+#include "flang/Parser/source.h"
+#include "flang/Parser/unparse.h"
#include "flang/Semantics/unparse-with-symbols.h"
-#include "flang/Lower/Bridge.h"
-#include "flang/Lower/PFTBuilder.h"
#include "llvm/Support/raw_ostream.h"
namespace Fortran::frontend {
-Fortran::parser::AllCookedSources&
+Fortran::parser::AllCookedSources &
getAllCooked(Fortran::frontend::CompilerInstance &ci) {
return ci.getParsing().allCooked();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/130309
More information about the flang-commits
mailing list