diff --git a/flang/include/flang/Frontend/CompilerInstance.h b/flang/include/flang/Frontend/CompilerInstance.h --- a/flang/include/flang/Frontend/CompilerInstance.h +++ b/flang/include/flang/Frontend/CompilerInstance.h @@ -58,7 +58,7 @@ /// @name Compiler Invocation /// { - CompilerInvocation &GetInvocation() { + CompilerInvocation &invocation() { assert(invocation_ && "Compiler instance has no invocation!"); return *invocation_; }; @@ -71,7 +71,7 @@ /// { /// Return the current allSources. - Fortran::parser::AllSources &GetAllSources() const { return *allSources_; } + Fortran::parser::AllSources &allSources() const { return *allSources_; } bool HasAllSources() const { return allSources_ != nullptr; } @@ -96,9 +96,9 @@ return invocation_->GetDiagnosticOpts(); } - FrontendOptions &GetFrontendOpts() { return invocation_->GetFrontendOpts(); } - const FrontendOptions &GetFrontendOpts() const { - return invocation_->GetFrontendOpts(); + FrontendOptions &frontendOpts() { return invocation_->frontendOpts(); } + const FrontendOptions &frontendOpts() const { + return invocation_->frontendOpts(); } /// } diff --git a/flang/include/flang/Frontend/CompilerInvocation.h b/flang/include/flang/Frontend/CompilerInvocation.h --- a/flang/include/flang/Frontend/CompilerInvocation.h +++ b/flang/include/flang/Frontend/CompilerInvocation.h @@ -46,8 +46,8 @@ public: CompilerInvocation() = default; - FrontendOptions &GetFrontendOpts() { return frontendOpts_; } - const FrontendOptions &GetFrontendOpts() const { return frontendOpts_; } + FrontendOptions &frontendOpts() { return frontendOpts_; } + const FrontendOptions &frontendOpts() const { return frontendOpts_; } /// Create a compiler invocation from a list of input options. /// \returns true on success. diff --git a/flang/include/flang/Frontend/FrontendAction.h b/flang/include/flang/Frontend/FrontendAction.h --- a/flang/include/flang/Frontend/FrontendAction.h +++ b/flang/include/flang/Frontend/FrontendAction.h @@ -48,31 +48,31 @@ /// @name Compiler Instance Access /// @{ - CompilerInstance &GetCompilerInstance() const { + CompilerInstance &instance() const { assert(instance_ && "Compiler instance not registered!"); return *instance_; } - void SetCompilerInstance(CompilerInstance *value) { instance_ = value; } + void set_instance(CompilerInstance *value) { instance_ = value; } /// @} /// @name Current File Information /// @{ - const FrontendInputFile &GetCurrentInput() const { return currentInput_; } + const FrontendInputFile ¤tInput() const { return currentInput_; } llvm::StringRef GetCurrentFile() const { assert(!currentInput_.IsEmpty() && "No current file!"); - return currentInput_.GetFile(); + return currentInput_.file(); } llvm::StringRef GetCurrentFileOrBufferName() const { assert(!currentInput_.IsEmpty() && "No current file!"); return currentInput_.IsFile() - ? currentInput_.GetFile() - : currentInput_.GetBuffer()->getBufferIdentifier(); + ? currentInput_.file() + : currentInput_.buffer()->getBufferIdentifier(); } - void SetCurrentInput(const FrontendInputFile ¤tInput); + void set_currentInput(const FrontendInputFile ¤tInput); /// @} /// @name Public Action Interface 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 @@ -91,18 +91,18 @@ FrontendInputFile(const llvm::MemoryBuffer *buffer, InputKind kind) : buffer_(buffer), kind_(kind) {} - InputKind GetKind() const { return kind_; } + InputKind kind() const { return kind_; } bool IsEmpty() const { return file_.empty() && buffer_ == nullptr; } bool IsFile() const { return !IsBuffer(); } bool IsBuffer() const { return buffer_ != nullptr; } - llvm::StringRef GetFile() const { + llvm::StringRef file() const { assert(IsFile()); return file_; } - const llvm::MemoryBuffer *GetBuffer() const { + const llvm::MemoryBuffer *buffer() const { assert(IsBuffer() && "Requested buffer_, but it is empty!"); return buffer_; } diff --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp --- a/flang/lib/Frontend/CompilerInstance.cpp +++ b/flang/lib/Frontend/CompilerInstance.cpp @@ -69,7 +69,7 @@ // Get the path of the output file std::string outputFilePath = - GetOutputFilePath(GetFrontendOpts().outputFile_, baseName, extension); + GetOutputFilePath(frontendOpts().outputFile_, baseName, extension); // Create the output file std::unique_ptr os = @@ -120,7 +120,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &act) { // Connect Input to a CompileInstance - for (const FrontendInputFile &fif : GetFrontendOpts().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 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -176,7 +176,7 @@ } // Parse the frontend args - ParseFrontendArgs(res.GetFrontendOpts(), args, diags); + ParseFrontendArgs(res.frontendOpts(), args, diags); return success; } 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 @@ -13,7 +13,7 @@ using namespace Fortran::frontend; -void FrontendAction::SetCurrentInput(const FrontendInputFile ¤tInput) { +void FrontendAction::set_currentInput(const FrontendInputFile ¤tInput) { this->currentInput_ = currentInput; } @@ -21,8 +21,8 @@ // Deallocate compiler instance, input and output descriptors static void BeginSourceFileCleanUp(FrontendAction &fa, CompilerInstance &ci) { ci.ClearOutputFiles(/*EraseFiles=*/true); - fa.SetCurrentInput(FrontendInputFile()); - fa.SetCompilerInstance(nullptr); + fa.set_currentInput(FrontendInputFile()); + fa.set_instance(nullptr); } bool FrontendAction::BeginSourceFile( @@ -31,8 +31,8 @@ FrontendInputFile input(realInput); assert(!instance_ && "Already processing a source file!"); assert(!realInput.IsEmpty() && "Unexpected empty filename!"); - SetCurrentInput(realInput); - SetCompilerInstance(&ci); + set_currentInput(realInput); + set_instance(&ci); if (!ci.HasAllSources()) { BeginSourceFileCleanUp(*this, ci); return false; @@ -41,7 +41,7 @@ } bool FrontendAction::ShouldEraseOutputFiles() { - return GetCompilerInstance().getDiagnostics().hasErrorOccurred(); + return instance().getDiagnostics().hasErrorOccurred(); } llvm::Error FrontendAction::Execute() { @@ -50,12 +50,12 @@ } void FrontendAction::EndSourceFile() { - CompilerInstance &ci = GetCompilerInstance(); + CompilerInstance &ci = instance(); // Cleanup the output streams, and erase the output files if instructed by the // FrontendAction. ci.ClearOutputFiles(/*EraseFiles=*/ShouldEraseOutputFiles()); - SetCompilerInstance(nullptr); - SetCurrentInput(FrontendInputFile()); + set_instance(nullptr); + set_currentInput(FrontendInputFile()); } diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -23,8 +23,8 @@ bool binaryMode = true; // Set/store input file info into CompilerInstance. - CompilerInstance &ci = GetCompilerInstance(); - Fortran::parser::AllSources &allSources{ci.GetAllSources()}; + CompilerInstance &ci = instance(); + Fortran::parser::AllSources &allSources{ci.allSources()}; const Fortran::parser::SourceFile *sf; sf = allSources.Open(path, error_stream); llvm::ArrayRef fileContent = sf->content(); 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,7 +24,7 @@ static std::unique_ptr CreateFrontendBaseAction( CompilerInstance &ci) { - ActionKind ak = ci.GetFrontendOpts().programAction_; + ActionKind ak = ci.frontendOpts().programAction_; switch (ak) { case InputOutputTest: return std::make_unique(); @@ -52,7 +52,7 @@ } bool ExecuteCompilerInvocation(CompilerInstance *flang) { // Honor -help. - if (flang->GetFrontendOpts().showHelp_) { + if (flang->frontendOpts().showHelp_) { clang::driver::getDriverOptTable().PrintHelp(llvm::outs(), "flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler", /*Include=*/clang::driver::options::FC1Option, @@ -62,7 +62,7 @@ } // Honor -version. - if (flang->GetFrontendOpts().showVersion_) { + if (flang->frontendOpts().showVersion_) { llvm::cl::PrintVersionMessage(); return true; } diff --git a/flang/tools/flang-driver/fc1_main.cpp b/flang/tools/flang-driver/fc1_main.cpp --- a/flang/tools/flang-driver/fc1_main.cpp +++ b/flang/tools/flang-driver/fc1_main.cpp @@ -46,7 +46,7 @@ new clang::DiagnosticOptions(); clang::DiagnosticsEngine diags(diagID, &*diagOpts, diagsBuffer); bool success = - CompilerInvocation::CreateFromArgs(flang->GetInvocation(), argv, diags); + CompilerInvocation::CreateFromArgs(flang->invocation(), argv, diags); diagsBuffer->FlushDiagnostics(flang->getDiagnostics()); diff --git a/flang/unittests/Frontend/CompilerInstanceTest.cpp b/flang/unittests/Frontend/CompilerInstanceTest.cpp --- a/flang/unittests/Frontend/CompilerInstanceTest.cpp +++ b/flang/unittests/Frontend/CompilerInstanceTest.cpp @@ -47,7 +47,7 @@ llvm::raw_string_ostream error_stream{buf}; CompilerInstance compInst; const Fortran::parser::SourceFile *sf = - compInst.GetAllSources().Open(testFilePath, error_stream); + compInst.allSources().Open(testFilePath, error_stream); // 3. Verify the content of the input file // This is just a sanity check to make sure that CompilerInstance is capable diff --git a/flang/unittests/Frontend/InputOutputTest.cpp b/flang/unittests/Frontend/InputOutputTest.cpp --- a/flang/unittests/Frontend/InputOutputTest.cpp +++ b/flang/unittests/Frontend/InputOutputTest.cpp @@ -45,9 +45,9 @@ CompilerInstance compInst; compInst.CreateDiagnostics(); auto invocation = std::make_shared(); - invocation->GetFrontendOpts().programAction_ = InputOutputTest; + invocation->frontendOpts().programAction_ = InputOutputTest; compInst.SetInvocation(std::move(invocation)); - compInst.GetFrontendOpts().inputs_.push_back( + compInst.frontendOpts().inputs_.push_back( FrontendInputFile(/*File=*/testFilePath, Language::Fortran)); // 3. Set-up the output stream. Using output buffer wrapped as an output