[flang-commits] [flang] 23d4c4f - [flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Mon Aug 2 03:09:02 PDT 2021


Author: Andrzej Warzynski
Date: 2021-08-02T10:08:31Z
New Revision: 23d4c4f3fb12e127a5f07a7082f33b02082bb3f5

URL: https://github.com/llvm/llvm-project/commit/23d4c4f3fb12e127a5f07a7082f33b02082bb3f5
DIFF: https://github.com/llvm/llvm-project/commit/23d4c4f3fb12e127a5f07a7082f33b02082bb3f5.diff

LOG: [flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`

As all member variables in `FrontendOptions` and `PreprocessorOptions`
are public, we should be naming them as `variable` rather than
`variable_` [1]. This patch fixes that.

Also, `FrontendOptions` & `PreprocessorOptions` are re-defined as a
structs rather than classes (all fields are meant to be public).

[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#naming

Differential Revision: https://reviews.llvm.org/D107062

Added: 
    

Modified: 
    flang/docs/FlangDriver.md
    flang/include/flang/Frontend/CompilerInstance.h
    flang/include/flang/Frontend/FrontendOptions.h
    flang/include/flang/Frontend/PreprocessorOptions.h
    flang/lib/Frontend/CompilerInstance.cpp
    flang/lib/Frontend/CompilerInvocation.cpp
    flang/lib/Frontend/FrontendAction.cpp
    flang/lib/Frontend/FrontendActions.cpp
    flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    flang/unittests/Frontend/FrontendActionTest.cpp

Removed: 
    


################################################################################
diff  --git a/flang/docs/FlangDriver.md b/flang/docs/FlangDriver.md
index 514cf47d2568..b5f38aab53fa 100644
--- a/flang/docs/FlangDriver.md
+++ b/flang/docs/FlangDriver.md
@@ -211,7 +211,7 @@ add, you will have to add a dedicated entry in that enum (e.g.
 `ParseFrontendArgs` function in the `CompilerInvocation.cpp` file, e.g.:
 ```cpp
     case clang::driver::options::OPT_fsyntax_only:
-      opts.programAction_ = ParseSyntaxOnly;
+      opts.programAction = ParseSyntaxOnly;
       break;
 ```
 Note that this simply sets the program/frontend action within the frontend

diff  --git a/flang/include/flang/Frontend/CompilerInstance.h b/flang/include/flang/Frontend/CompilerInstance.h
index 79a05c0ddbbe..956fe144ac9e 100644
--- a/flang/include/flang/Frontend/CompilerInstance.h
+++ b/flang/include/flang/Frontend/CompilerInstance.h
@@ -179,7 +179,7 @@ class CompilerInstance {
   ///
   /// \param binary     The mode to open the file in.
   /// \param baseInput  If the invocation contains no output file name (i.e.
-  ///                   outputFile_ in FrontendOptions is empty), the input path
+  ///                   outputFile in FrontendOptions is empty), the input path
   ///                   name to use for deriving the output path.
   /// \param extension  The extension to use for output names derived from
   ///                   \p baseInput.

diff  --git a/flang/include/flang/Frontend/FrontendOptions.h b/flang/include/flang/Frontend/FrontendOptions.h
index a40e37125ded..5f910febd4b6 100644
--- a/flang/include/flang/Frontend/FrontendOptions.h
+++ b/flang/include/flang/Frontend/FrontendOptions.h
@@ -199,21 +199,24 @@ class FrontendInputFile {
 };
 
 /// FrontendOptions - Options for controlling the behavior of the frontend.
-class FrontendOptions {
-public:
+struct FrontendOptions {
+  FrontendOptions()
+      : showHelp(false), showVersion(false), instrumentedParse(false),
+        needProvenanceRangeToCharBlockMappings(false) {}
+
   /// Show the -help text.
-  unsigned showHelp_ : 1;
+  unsigned showHelp : 1;
 
   /// Show the -version text.
-  unsigned showVersion_ : 1;
+  unsigned showVersion : 1;
 
   /// Instrument the parse to get a more verbose log
-  unsigned instrumentedParse_ : 1;
+  unsigned instrumentedParse : 1;
 
   /// Enable Provenance to character-stream mapping. Allows e.g. IDEs to find
   /// symbols based on source-code location. This is not needed in regular
   /// compilation.
-  unsigned needProvenanceRangeToCharBlockMappings_ : 1;
+  unsigned needProvenanceRangeToCharBlockMappings : 1;
 
   /// Input values from `-fget-definition`
   struct GetDefinitionVals {
@@ -221,38 +224,33 @@ class FrontendOptions {
     unsigned startColumn;
     unsigned endColumn;
   };
-  GetDefinitionVals getDefVals_;
+  GetDefinitionVals getDefVals;
 
   /// The input files and their types.
-  std::vector<FrontendInputFile> inputs_;
+  std::vector<FrontendInputFile> inputs;
 
   /// The output file, if any.
-  std::string outputFile_;
+  std::string outputFile;
 
   /// The frontend action to perform.
-  frontend::ActionKind programAction_;
+  frontend::ActionKind programAction;
 
   // The form to process files in, if specified.
-  FortranForm fortranForm_ = FortranForm::Unknown;
+  FortranForm fortranForm = FortranForm::Unknown;
 
   // The column after which characters are ignored in fixed form lines in the
   // source file.
-  int fixedFormColumns_ = 72;
+  int fixedFormColumns = 72;
 
   /// The input kind, either specified via -x argument or deduced from the input
   /// file name.
-  InputKind dashX_;
+  InputKind dashX;
 
   // Language features
-  common::LanguageFeatureControl features_;
+  common::LanguageFeatureControl features;
 
   // Source file encoding
-  Fortran::parser::Encoding encoding_{Fortran::parser::Encoding::UTF_8};
-
-public:
-  FrontendOptions()
-      : showHelp_(false), showVersion_(false), instrumentedParse_(false),
-        needProvenanceRangeToCharBlockMappings_(false) {}
+  Fortran::parser::Encoding encoding{Fortran::parser::Encoding::UTF_8};
 
   // Return the appropriate input kind for a file extension. For example,
   /// "*.f" would return Language::Fortran.

diff  --git a/flang/include/flang/Frontend/PreprocessorOptions.h b/flang/include/flang/Frontend/PreprocessorOptions.h
index 0973a9a6357f..41fc6b76f044 100644
--- a/flang/include/flang/Frontend/PreprocessorOptions.h
+++ b/flang/include/flang/Frontend/PreprocessorOptions.h
@@ -31,9 +31,11 @@ enum class PPMacrosFlag : uint8_t {
 
 /// This class is used for passing the various options used
 /// in preprocessor initialization to the parser options.
-class PreprocessorOptions {
-public:
+struct PreprocessorOptions {
+  PreprocessorOptions() {}
+
   std::vector<std::pair<std::string, /*isUndef*/ bool>> macros;
+
   // Search directories specified by the user with -I
   // TODO: When adding support for more options related to search paths,
   // consider collecting them in a separate aggregate. For now we keep it here
@@ -42,7 +44,7 @@ class PreprocessorOptions {
   // Search directories specified by the user with -fintrinsic-modules-path
   std::vector<std::string> searchDirectoriesFromIntrModPath;
 
-  PPMacrosFlag macrosFlag_ = PPMacrosFlag::Unknown;
+  PPMacrosFlag macrosFlag = PPMacrosFlag::Unknown;
 
   // -P: Suppress #line directives in -E output
   bool noLineDirectives{false};
@@ -50,9 +52,6 @@ class PreprocessorOptions {
   // -fno-reformat: Emit cooked character stream as -E output
   bool noReformat{false};
 
-public:
-  PreprocessorOptions() {}
-
   void addMacroDef(llvm::StringRef name) {
     macros.emplace_back(std::string(name), false);
   }

diff  --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp
index c3e538911d41..4c6a87542065 100644
--- a/flang/lib/Frontend/CompilerInstance.cpp
+++ b/flang/lib/Frontend/CompilerInstance.cpp
@@ -89,7 +89,7 @@ CompilerInstance::CreateDefaultOutputFile(
 
   // Get the path of the output file
   std::string outputFilePath =
-      GetOutputFilePath(frontendOpts().outputFile_, baseName, extension);
+      GetOutputFilePath(frontendOpts().outputFile, baseName, extension);
 
   // Create the output file
   std::unique_ptr<llvm::raw_pwrite_stream> os =
@@ -150,7 +150,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &act) {
   invoc.setSemanticsOpts(*this->allCookedSources_);
 
   // Run the frontend action `act` for every input file.
-  for (const FrontendInputFile &fif : frontendOpts().inputs_) {
+  for (const FrontendInputFile &fif : frontendOpts().inputs) {
     if (act.BeginSourceFile(*this, fif)) {
       if (llvm::Error err = act.Execute()) {
         consumeError(std::move(err));

diff  --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index bd79b0170e63..fb0a21e03a82 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -89,15 +89,15 @@ bool Fortran::frontend::ParseDiagnosticArgs(clang::DiagnosticOptions &opts,
 
 // Tweak the frontend configuration based on the frontend action
 static void setUpFrontendBasedOnAction(FrontendOptions &opts) {
-  assert(opts.programAction_ != Fortran::frontend::InvalidAction &&
+  assert(opts.programAction != Fortran::frontend::InvalidAction &&
       "Fortran frontend action not set!");
 
-  if (opts.programAction_ == DebugDumpParsingLog)
-    opts.instrumentedParse_ = true;
+  if (opts.programAction == DebugDumpParsingLog)
+    opts.instrumentedParse = true;
 
-  if (opts.programAction_ == DebugDumpProvenance ||
-      opts.programAction_ == Fortran::frontend::GetDefinition)
-    opts.needProvenanceRangeToCharBlockMappings_ = true;
+  if (opts.programAction == DebugDumpProvenance ||
+      opts.programAction == Fortran::frontend::GetDefinition)
+    opts.needProvenanceRangeToCharBlockMappings = true;
 }
 
 static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
@@ -105,7 +105,7 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
   unsigned numErrorsBefore = diags.getNumErrors();
 
   // By default the frontend driver creates a ParseSyntaxOnly action.
-  opts.programAction_ = ParseSyntaxOnly;
+  opts.programAction = ParseSyntaxOnly;
 
   // Identify the action (i.e. opts.ProgramAction)
   if (const llvm::opt::Arg *a =
@@ -115,58 +115,58 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
       llvm_unreachable("Invalid option in group!");
     }
     case clang::driver::options::OPT_test_io:
-      opts.programAction_ = InputOutputTest;
+      opts.programAction = InputOutputTest;
       break;
     case clang::driver::options::OPT_E:
-      opts.programAction_ = PrintPreprocessedInput;
+      opts.programAction = PrintPreprocessedInput;
       break;
     case clang::driver::options::OPT_fsyntax_only:
-      opts.programAction_ = ParseSyntaxOnly;
+      opts.programAction = ParseSyntaxOnly;
       break;
     case clang::driver::options::OPT_emit_obj:
-      opts.programAction_ = EmitObj;
+      opts.programAction = EmitObj;
       break;
     case clang::driver::options::OPT_fdebug_unparse:
-      opts.programAction_ = DebugUnparse;
+      opts.programAction = DebugUnparse;
       break;
     case clang::driver::options::OPT_fdebug_unparse_no_sema:
-      opts.programAction_ = DebugUnparseNoSema;
+      opts.programAction = DebugUnparseNoSema;
       break;
     case clang::driver::options::OPT_fdebug_unparse_with_symbols:
-      opts.programAction_ = DebugUnparseWithSymbols;
+      opts.programAction = DebugUnparseWithSymbols;
       break;
     case clang::driver::options::OPT_fdebug_dump_symbols:
-      opts.programAction_ = DebugDumpSymbols;
+      opts.programAction = DebugDumpSymbols;
       break;
     case clang::driver::options::OPT_fdebug_dump_parse_tree:
-      opts.programAction_ = DebugDumpParseTree;
+      opts.programAction = DebugDumpParseTree;
       break;
     case clang::driver::options::OPT_fdebug_dump_all:
-      opts.programAction_ = DebugDumpAll;
+      opts.programAction = DebugDumpAll;
       break;
     case clang::driver::options::OPT_fdebug_dump_parse_tree_no_sema:
-      opts.programAction_ = DebugDumpParseTreeNoSema;
+      opts.programAction = DebugDumpParseTreeNoSema;
       break;
     case clang::driver::options::OPT_fdebug_dump_provenance:
-      opts.programAction_ = DebugDumpProvenance;
+      opts.programAction = DebugDumpProvenance;
       break;
     case clang::driver::options::OPT_fdebug_dump_parsing_log:
-      opts.programAction_ = DebugDumpParsingLog;
+      opts.programAction = DebugDumpParsingLog;
       break;
     case clang::driver::options::OPT_fdebug_measure_parse_tree:
-      opts.programAction_ = DebugMeasureParseTree;
+      opts.programAction = DebugMeasureParseTree;
       break;
     case clang::driver::options::OPT_fdebug_pre_fir_tree:
-      opts.programAction_ = DebugPreFIRTree;
+      opts.programAction = DebugPreFIRTree;
       break;
     case clang::driver::options::OPT_fget_symbols_sources:
-      opts.programAction_ = GetSymbolsSources;
+      opts.programAction = GetSymbolsSources;
       break;
     case clang::driver::options::OPT_fget_definition:
-      opts.programAction_ = GetDefinition;
+      opts.programAction = GetDefinition;
       break;
     case clang::driver::options::OPT_init_only:
-      opts.programAction_ = InitOnly;
+      opts.programAction = InitOnly;
       break;
 
       // TODO:
@@ -193,15 +193,15 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
           break;
         }
       }
-      opts.getDefVals_.line = optVals[0];
-      opts.getDefVals_.startColumn = optVals[1];
-      opts.getDefVals_.endColumn = optVals[2];
+      opts.getDefVals.line = optVals[0];
+      opts.getDefVals.startColumn = optVals[1];
+      opts.getDefVals.endColumn = optVals[2];
     }
   }
 
-  opts.outputFile_ = args.getLastArgValue(clang::driver::options::OPT_o);
-  opts.showHelp_ = args.hasArg(clang::driver::options::OPT_help);
-  opts.showVersion_ = args.hasArg(clang::driver::options::OPT_version);
+  opts.outputFile = args.getLastArgValue(clang::driver::options::OPT_o);
+  opts.showHelp = args.hasArg(clang::driver::options::OPT_help);
+  opts.showVersion = args.hasArg(clang::driver::options::OPT_version);
 
   // Get the input kind (from the value passed via `-x`)
   InputKind dashX(Language::Unknown);
@@ -227,7 +227,7 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
   // Collect the input files and save them in our instance of FrontendOptions.
   std::vector<std::string> inputs =
       args.getAllArgValues(clang::driver::options::OPT_INPUT);
-  opts.inputs_.clear();
+  opts.inputs.clear();
   if (inputs.empty())
     // '-' is the default input if none is given.
     inputs.push_back("-");
@@ -242,19 +242,19 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
         dashX = ik;
     }
 
-    opts.inputs_.emplace_back(std::move(inputs[i]), ik);
+    opts.inputs.emplace_back(std::move(inputs[i]), ik);
   }
 
-  // Set fortranForm_ based on options -ffree-form and -ffixed-form.
+  // Set fortranForm based on options -ffree-form and -ffixed-form.
   if (const auto *arg = args.getLastArg(clang::driver::options::OPT_ffixed_form,
           clang::driver::options::OPT_ffree_form)) {
-    opts.fortranForm_ =
+    opts.fortranForm =
         arg->getOption().matches(clang::driver::options::OPT_ffixed_form)
         ? FortranForm::FixedForm
         : FortranForm::FreeForm;
   }
 
-  // Set fixedFormColumns_ based on -ffixed-line-length=<value>
+  // Set fixedFormColumns based on -ffixed-line-length=<value>
   if (const auto *arg =
           args.getLastArg(clang::driver::options::OPT_ffixed_line_length_EQ)) {
     llvm::StringRef argValue = llvm::StringRef(arg->getValue());
@@ -268,53 +268,52 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
       diags.Report(clang::diag::err_drv_negative_columns)
           << arg->getOption().getName() << arg->getValue();
     } else if (columns == 0) {
-      opts.fixedFormColumns_ = 1000000;
+      opts.fixedFormColumns = 1000000;
     } else if (columns < 7) {
       diags.Report(clang::diag::err_drv_small_columns)
           << arg->getOption().getName() << arg->getValue() << "7";
     } else {
-      opts.fixedFormColumns_ = columns;
+      opts.fixedFormColumns = columns;
     }
   }
 
   if (const llvm::opt::Arg *arg =
           args.getLastArg(clang::driver::options::OPT_fimplicit_none,
               clang::driver::options::OPT_fno_implicit_none)) {
-    opts.features_.Enable(
+    opts.features.Enable(
         Fortran::common::LanguageFeature::ImplicitNoneTypeAlways,
         arg->getOption().matches(clang::driver::options::OPT_fimplicit_none));
   }
   if (const llvm::opt::Arg *arg =
           args.getLastArg(clang::driver::options::OPT_fbackslash,
               clang::driver::options::OPT_fno_backslash)) {
-    opts.features_.Enable(Fortran::common::LanguageFeature::BackslashEscapes,
+    opts.features.Enable(Fortran::common::LanguageFeature::BackslashEscapes,
         arg->getOption().matches(clang::driver::options::OPT_fbackslash));
   }
   if (const llvm::opt::Arg *arg =
           args.getLastArg(clang::driver::options::OPT_flogical_abbreviations,
               clang::driver::options::OPT_fno_logical_abbreviations)) {
-    opts.features_.Enable(
-        Fortran::common::LanguageFeature::LogicalAbbreviations,
+    opts.features.Enable(Fortran::common::LanguageFeature::LogicalAbbreviations,
         arg->getOption().matches(
             clang::driver::options::OPT_flogical_abbreviations));
   }
   if (const llvm::opt::Arg *arg =
           args.getLastArg(clang::driver::options::OPT_fxor_operator,
               clang::driver::options::OPT_fno_xor_operator)) {
-    opts.features_.Enable(Fortran::common::LanguageFeature::XOROperator,
+    opts.features.Enable(Fortran::common::LanguageFeature::XOROperator,
         arg->getOption().matches(clang::driver::options::OPT_fxor_operator));
   }
   if (args.hasArg(
           clang::driver::options::OPT_falternative_parameter_statement)) {
-    opts.features_.Enable(Fortran::common::LanguageFeature::OldStyleParameter);
+    opts.features.Enable(Fortran::common::LanguageFeature::OldStyleParameter);
   }
   if (const llvm::opt::Arg *arg =
           args.getLastArg(clang::driver::options::OPT_finput_charset_EQ)) {
     llvm::StringRef argValue = arg->getValue();
     if (argValue == "utf-8") {
-      opts.encoding_ = Fortran::parser::Encoding::UTF_8;
+      opts.encoding = Fortran::parser::Encoding::UTF_8;
     } else if (argValue == "latin-1") {
-      opts.encoding_ = Fortran::parser::Encoding::LATIN_1;
+      opts.encoding = Fortran::parser::Encoding::LATIN_1;
     } else {
       diags.Report(clang::diag::err_drv_invalid_value)
           << arg->getAsString(args) << argValue;
@@ -322,7 +321,7 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
   }
 
   setUpFrontendBasedOnAction(opts);
-  opts.dashX_ = dashX;
+  opts.dashX = dashX;
 
   return diags.getNumErrors() == numErrorsBefore;
 }
@@ -367,7 +366,7 @@ static void parsePreprocessorArgs(
   // -cpp/-nocpp
   if (const auto *currentArg = args.getLastArg(
           clang::driver::options::OPT_cpp, clang::driver::options::OPT_nocpp))
-    opts.macrosFlag_ =
+    opts.macrosFlag =
         (currentArg->getOption().matches(clang::driver::options::OPT_cpp))
         ? PPMacrosFlag::Include
         : PPMacrosFlag::Exclude;
@@ -473,11 +472,11 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
 
   // -fopenmp and -fopenacc
   if (args.hasArg(clang::driver::options::OPT_fopenacc)) {
-    res.frontendOpts().features_.Enable(
+    res.frontendOpts().features.Enable(
         Fortran::common::LanguageFeature::OpenACC);
   }
   if (args.hasArg(clang::driver::options::OPT_fopenmp)) {
-    res.frontendOpts().features_.Enable(
+    res.frontendOpts().features.Enable(
         Fortran::common::LanguageFeature::OpenMP);
   }
 
@@ -601,11 +600,11 @@ void CompilerInvocation::setDefaultPredefinitions() {
       "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
 
   // Add predefinitions based on extensions enabled
-  if (frontendOptions.features_.IsEnabled(
+  if (frontendOptions.features.IsEnabled(
           Fortran::common::LanguageFeature::OpenACC)) {
     fortranOptions.predefinitions.emplace_back("_OPENACC", "202011");
   }
-  if (frontendOptions.features_.IsEnabled(
+  if (frontendOptions.features.IsEnabled(
           Fortran::common::LanguageFeature::OpenMP)) {
     fortranOptions.predefinitions.emplace_back("_OPENMP", "201511");
   }
@@ -617,14 +616,14 @@ void CompilerInvocation::setFortranOpts() {
   const auto &preprocessorOptions = preprocessorOpts();
   auto &moduleDirJ = moduleDir();
 
-  if (frontendOptions.fortranForm_ != FortranForm::Unknown) {
+  if (frontendOptions.fortranForm != FortranForm::Unknown) {
     fortranOptions.isFixedForm =
-        frontendOptions.fortranForm_ == FortranForm::FixedForm;
+        frontendOptions.fortranForm == FortranForm::FixedForm;
   }
-  fortranOptions.fixedFormColumns = frontendOptions.fixedFormColumns_;
+  fortranOptions.fixedFormColumns = frontendOptions.fixedFormColumns;
 
-  fortranOptions.features = frontendOptions.features_;
-  fortranOptions.encoding = frontendOptions.encoding_;
+  fortranOptions.features = frontendOptions.features;
+  fortranOptions.encoding = frontendOptions.encoding;
 
   // Adding search directories specified by -I
   fortranOptions.searchDirectories.insert(
@@ -646,10 +645,10 @@ void CompilerInvocation::setFortranOpts() {
   if (moduleDirJ.compare(".") != 0)
     fortranOptions.searchDirectories.emplace_back(moduleDirJ);
 
-  if (frontendOptions.instrumentedParse_)
+  if (frontendOptions.instrumentedParse)
     fortranOptions.instrumentedParse = true;
 
-  if (frontendOptions.needProvenanceRangeToCharBlockMappings_)
+  if (frontendOptions.needProvenanceRangeToCharBlockMappings)
     fortranOptions.needProvenanceRangeToCharBlockMappings = true;
 
   if (enableConformanceChecks()) {

diff  --git a/flang/lib/Frontend/FrontendAction.cpp b/flang/lib/Frontend/FrontendAction.cpp
index 23e4ca3f3306..24efcc7cdc7f 100644
--- a/flang/lib/Frontend/FrontendAction.cpp
+++ b/flang/lib/Frontend/FrontendAction.cpp
@@ -73,8 +73,8 @@ bool FrontendAction::BeginSourceFile(
   //  * `-cpp/-nocpp`, or
   //  * the file extension (if the user didn't express any preference)
   // to decide whether to include them or not.
-  if ((invoc.preprocessorOpts().macrosFlag_ == PPMacrosFlag::Include) ||
-      (invoc.preprocessorOpts().macrosFlag_ == PPMacrosFlag::Unknown &&
+  if ((invoc.preprocessorOpts().macrosFlag == PPMacrosFlag::Include) ||
+      (invoc.preprocessorOpts().macrosFlag == PPMacrosFlag::Unknown &&
           currentInput().MustBePreprocessed())) {
     invoc.setDefaultPredefinitions();
     invoc.collectMacroDefinitions();
@@ -82,7 +82,7 @@ bool FrontendAction::BeginSourceFile(
 
   // Decide between fixed and free form (if the user didn't express any
   // preference, use the file extension to decide)
-  if (invoc.frontendOpts().fortranForm_ == FortranForm::Unknown) {
+  if (invoc.frontendOpts().fortranForm == FortranForm::Unknown) {
     invoc.fortranOpts().isFixedForm = currentInput().IsFixedForm();
   }
 

diff  --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 9ec751bec2be..c1c9a105956b 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -74,7 +74,7 @@ bool PrescanAndParseAction::BeginSourceFileAction(CompilerInstance &c1) {
 
   Fortran::parser::Options parserOptions = ci.invocation().fortranOpts();
 
-  if (ci.invocation().frontendOpts().fortranForm_ == FortranForm::Unknown) {
+  if (ci.invocation().frontendOpts().fortranForm == FortranForm::Unknown) {
     // Switch between fixed and free form format based on the input file
     // extension.
     //
@@ -437,7 +437,7 @@ void GetDefinitionAction::ExecuteAction() {
   unsigned diagID = ci.diagnostics().getCustomDiagID(
       clang::DiagnosticsEngine::Error, "Symbol not found");
 
-  auto gdv = ci.invocation().frontendOpts().getDefVals_;
+  auto gdv = ci.invocation().frontendOpts().getDefVals;
   auto charBlock{cs.GetCharBlockFromLineAndColumns(
       gdv.line, gdv.startColumn, gdv.endColumn)};
   if (!charBlock) {

diff  --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 9c3b13b6070d..a17b6b5079e9 100644
--- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -24,7 +24,7 @@ namespace Fortran::frontend {
 static std::unique_ptr<FrontendAction> CreateFrontendBaseAction(
     CompilerInstance &ci) {
 
-  ActionKind ak = ci.frontendOpts().programAction_;
+  ActionKind ak = ci.frontendOpts().programAction;
   switch (ak) {
   case InputOutputTest:
     return std::make_unique<InputOutputTestAction>();
@@ -84,7 +84,7 @@ std::unique_ptr<FrontendAction> CreateFrontendAction(CompilerInstance &ci) {
 }
 bool ExecuteCompilerInvocation(CompilerInstance *flang) {
   // Honor -help.
-  if (flang->frontendOpts().showHelp_) {
+  if (flang->frontendOpts().showHelp) {
     clang::driver::getDriverOptTable().printHelp(llvm::outs(),
         "flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler",
         /*Include=*/clang::driver::options::FC1Option,
@@ -94,7 +94,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *flang) {
   }
 
   // Honor -version.
-  if (flang->frontendOpts().showVersion_) {
+  if (flang->frontendOpts().showVersion) {
     llvm::cl::PrintVersionMessage();
     return true;
   }

diff  --git a/flang/unittests/Frontend/FrontendActionTest.cpp b/flang/unittests/Frontend/FrontendActionTest.cpp
index b706637a6c92..249392eb2288 100644
--- a/flang/unittests/Frontend/FrontendActionTest.cpp
+++ b/flang/unittests/Frontend/FrontendActionTest.cpp
@@ -62,7 +62,7 @@ class FrontendActionTest : public ::testing::Test {
     invocation_ = std::make_shared<CompilerInvocation>();
 
     compInst_.set_invocation(std::move(invocation_));
-    compInst_.frontendOpts().inputs_.push_back(
+    compInst_.frontendOpts().inputs.push_back(
         FrontendInputFile(inputFilePath_, Language::Fortran));
   }
 
@@ -86,7 +86,7 @@ TEST_F(FrontendActionTest, TestInputOutput) {
   inputFileOs_.reset();
 
   // Set-up the action kind.
-  compInst_.invocation().frontendOpts().programAction_ = InputOutputTest;
+  compInst_.invocation().frontendOpts().programAction = InputOutputTest;
 
   // Set-up the output stream. Using output buffer wrapped as an output
   // stream, as opposed to an actual file (or a file descriptor).
@@ -115,7 +115,7 @@ TEST_F(FrontendActionTest, PrintPreprocessedInput) {
   inputFileOs_.reset();
 
   // Set-up the action kind.
-  compInst_.invocation().frontendOpts().programAction_ = PrintPreprocessedInput;
+  compInst_.invocation().frontendOpts().programAction = PrintPreprocessedInput;
   compInst_.invocation().preprocessorOpts().noReformat = true;
 
   // Set-up the output stream. We are using output buffer wrapped as an output
@@ -142,7 +142,7 @@ TEST_F(FrontendActionTest, ParseSyntaxOnly) {
   inputFileOs_.reset();
 
   // Set-up the action kind.
-  compInst_.invocation().frontendOpts().programAction_ = ParseSyntaxOnly;
+  compInst_.invocation().frontendOpts().programAction = ParseSyntaxOnly;
 
   // Set-up the output stream for the semantic diagnostics.
   llvm::SmallVector<char, 256> outputDiagBuffer;


        


More information about the flang-commits mailing list