FLANG
Classes | List of all members
Fortran::frontend::CompilerInstance Class Reference

#include <flang/Frontend/CompilerInstance.h>

Public Member Functions

Compiler Invocation

{

CompilerInvocationgetInvocation ()
 
void setInvocation (std::shared_ptr< CompilerInvocation > value)
 Replace the current invocation.
 
File manager

}

{

Fortran::parser::AllSourcesgetAllSources () const
 Return the current allSources.
 
bool hasAllSources () const
 
parser::AllCookedSourcesgetAllCookedSources ()
 
Parser Operations

}

{

Fortran::parser::ParsinggetParsing () const
 Return parsing to be used by Actions.
 
Semantic analysis

}

{

Fortran::semantics::SemanticsContextgetSemanticsContext ()
 
const Fortran::semantics::SemanticsContextgetSemanticsContext () const
 
void setSemaOutputStream (llvm::raw_ostream &value)
 Replace the current stream for verbose output.
 
void setSemaOutputStream (std::unique_ptr< llvm::raw_ostream > value)
 Replace the current stream for verbose output.
 
llvm::raw_ostream & getSemaOutputStream ()
 Get the current stream for verbose output.
 
Fortran::semantics::SemanticsgetSemantics ()
 
const Fortran::semantics::SemanticsgetSemantics () const
 
void setSemantics (std::unique_ptr< Fortran::semantics::Semantics > sema)
 
void setRtTyTables (std::unique_ptr< Fortran::semantics::RuntimeDerivedTypeTables > tables)
 
Fortran::semantics::RuntimeDerivedTypeTablesgetRtTyTables ()
 
High-Level Operations

}

{

bool executeAction (FrontendAction &act)
 
Forwarding Methods

}

{

clang::DiagnosticOptions & getDiagnosticOpts ()
 
const clang::DiagnosticOptions & getDiagnosticOpts () const
 
FrontendOptionsgetFrontendOpts ()
 
const FrontendOptionsgetFrontendOpts () const
 
PreprocessorOptionspreprocessorOpts ()
 
const PreprocessorOptionspreprocessorOpts () const
 
Diagnostics Engine

}

{

bool hasDiagnostics () const
 
clang::DiagnosticsEngine & getDiagnostics () const
 Get the current diagnostics engine.
 
clang::DiagnosticConsumer & getDiagnosticClient () const
 
Output Files

{

{

void clearOutputFiles (bool eraseFiles)
 Clear the output file list.
 
std::unique_ptr< llvm::raw_pwrite_stream > createDefaultOutputFile (bool binary=true, llvm::StringRef baseInput="", llvm::StringRef extension="")
 
Target Machine

{

{

const llvm::TargetMachine & getTargetMachine () const
 Get the target machine.
 
llvm::TargetMachine & getTargetMachine ()
 
bool setUpTargetMachine ()
 Sets up LLVM's TargetMachine.
 
std::string getTargetFeatures ()
 Produces the string which represents target feature.
 
Output Stream Methods

}

{

void setOutputStream (std::unique_ptr< llvm::raw_pwrite_stream > outStream)
 
bool isOutputStreamNull ()
 
void writeOutputStream (const std::string &message)
 
llvm::raw_pwrite_stream & getOutputStream ()
 Get the user specified output stream.
 

Timing

{

bool isTimingEnabled () const
 
mlir::DefaultTimingManager & getTimingManager ()
 
const mlir::DefaultTimingManager & getTimingManager () const
 
mlir::TimingScope & getTimingScopeRoot ()
 
const mlir::TimingScope & getTimingScopeRoot () const
 
llvm::raw_ostream & getTimingStreamMLIR ()
 Get the timing stream for the MLIR pass manager.
 
llvm::raw_ostream & getTimingStreamLLVM ()
 Get the timing stream for the new LLVM pass manager.
 
llvm::raw_ostream & getTimingStreamCodeGen ()
 

Construction Utility Methods

}

{

void createDiagnostics (clang::DiagnosticConsumer *client=nullptr, bool shouldOwnClient=true)
 
static clang::IntrusiveRefCntPtr< clang::DiagnosticsEngine > createDiagnostics (clang::DiagnosticOptions *opts, clang::DiagnosticConsumer *client=nullptr, bool shouldOwnClient=true)
 

Detailed Description

Helper class for managing a single instance of the Flang compiler.

This class serves two purposes: (1) It manages the various objects which are necessary to run the compiler (2) It provides utility routines for constructing and manipulating the common Flang objects.

The compiler instance generally owns the instance of all the objects that it manages. However, clients can still share objects by manually setting the object and retaking ownership prior to destroying the CompilerInstance.

The compiler instance is intended to simplify clients, but not to lock them in to the compiler instance for everything. When possible, utility functions come in two forms; a short form that reuses the CompilerInstance objects, and a long form that takes explicit instances of any required objects.

Member Function Documentation

◆ createDefaultOutputFile()

std::unique_ptr< llvm::raw_pwrite_stream > CompilerInstance::createDefaultOutputFile ( bool  binary = true,
llvm::StringRef  baseInput = "",
llvm::StringRef  extension = "" 
)

Create the default output file (based on the invocation's options) and add it to the list of tracked output files. If the name of the output file is not provided, it will be derived from the input file.

Parameters
binaryThe mode to open the file in.
baseInputIf the invocation contains no output file name (i.e. outputFile in FrontendOptions is empty), the input path name to use for deriving the output path.
extensionThe extension to use for output names derived from baseInput.
Returns
Null on error, ostream for the output file otherwise

◆ createDiagnostics()

clang::IntrusiveRefCntPtr< clang::DiagnosticsEngine > CompilerInstance::createDiagnostics ( clang::DiagnosticOptions *  opts,
clang::DiagnosticConsumer *  client = nullptr,
bool  shouldOwnClient = true 
)
static

Create a DiagnosticsEngine object

If no diagnostic client is provided, this method creates a DiagnosticConsumer that is owned by the returned diagnostic object. If using directly the caller is responsible for releasing the returned DiagnosticsEngine's client eventually.

Parameters
opts- The diagnostic options; note that the created text diagnostic object contains a reference to these options.
client- If non-NULL, a diagnostic client that will be attached to (and optionally, depending on /p shouldOwnClient, owned by) the returned DiagnosticsEngine object.
Returns
The new object on success, or null on failure.

◆ executeAction()

bool CompilerInstance::executeAction ( FrontendAction act)

Execute the provided action against the compiler's CompilerInvocation object.

Parameters
act- The action to execute.
Returns
- True on success.

◆ getTimingStreamCodeGen()

llvm::raw_ostream & Fortran::frontend::CompilerInstance::getTimingStreamCodeGen ( )
inline

Get the timing stream fro the legacy LLVM pass manager. NOTE: If the codegen is updated to use the new pass manager, this should no longer be needed.


The documentation for this class was generated from the following files: