diff --git a/flang/include/flang/Frontend/FrontendOptions.h b/flang/include/flang/Frontend/FrontendOptions.h --- a/flang/include/flang/Frontend/FrontendOptions.h +++ b/flang/include/flang/Frontend/FrontendOptions.h @@ -20,8 +20,6 @@ namespace Fortran::frontend { enum ActionKind { - InvalidAction = 0, - /// -test-io mode InputOutputTest, @@ -244,7 +242,7 @@ std::string outputFile; /// The frontend action to perform. - frontend::ActionKind programAction; + frontend::ActionKind programAction = ParseSyntaxOnly; // The form to process files in, if specified. FortranForm fortranForm = FortranForm::Unknown; diff --git a/flang/include/flang/FrontendTool/Utils.h b/flang/include/flang/FrontendTool/Utils.h --- a/flang/include/flang/FrontendTool/Utils.h +++ b/flang/include/flang/FrontendTool/Utils.h @@ -17,13 +17,6 @@ namespace Fortran::frontend { class CompilerInstance; -class FrontendAction; - -/// Construct the FrontendAction of a compiler invocation based on the -/// options specified for the compiler invocation. -/// -/// \return - The created FrontendAction object -std::unique_ptr CreateFrontendAction(CompilerInstance &ci); /// ExecuteCompilerInvocation - Execute the given actions described by the /// compiler invocation object in the given compiler instance. diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -98,9 +98,6 @@ // Tweak the frontend configuration based on the frontend action static void setUpFrontendBasedOnAction(FrontendOptions &opts) { - assert(opts.programAction != Fortran::frontend::InvalidAction && - "Fortran frontend action not set!"); - if (opts.programAction == DebugDumpParsingLog) opts.instrumentedParse = true; diff --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp --- a/flang/lib/Frontend/FrontendAction.cpp +++ b/flang/lib/Frontend/FrontendAction.cpp @@ -11,7 +11,6 @@ #include "flang/Frontend/FrontendActions.h" #include "flang/Frontend/FrontendOptions.h" #include "flang/Frontend/FrontendPluginRegistry.h" -#include "flang/FrontendTool/Utils.h" #include "clang/Basic/DiagnosticFrontend.h" #include "llvm/Support/Errc.h" #include "llvm/Support/VirtualFileSystem.h" diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp --- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -24,11 +24,10 @@ namespace Fortran::frontend { -static std::unique_ptr CreateFrontendBaseAction( +static std::unique_ptr CreateFrontendAction( CompilerInstance &ci) { - ActionKind ak = ci.frontendOpts().programAction; - switch (ak) { + switch (ci.frontendOpts().programAction) { case InputOutputTest: return std::make_unique(); case PrintPreprocessedInput: @@ -90,25 +89,9 @@ ci.diagnostics().Report(diagID) << ci.frontendOpts().ActionName; return nullptr; } - default: - break; - // TODO: - // case ParserSyntaxOnly: - // case EmitLLVM: - // case EmitLLVMOnly: - // case EmitCodeGenOnly: - // (...) } - return 0; -} - -std::unique_ptr CreateFrontendAction(CompilerInstance &ci) { - // Create the underlying action. - std::unique_ptr act = CreateFrontendBaseAction(ci); - if (!act) - return nullptr; - return act; + llvm_unreachable("Invalid program action!"); } bool ExecuteCompilerInvocation(CompilerInstance *flang) {