CppADCodeGen 2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
Loading...
Searching...
No Matches
CppAD::cg::ClangCompiler< Base > Class Template Reference

#include <clang_compiler.hpp>

Inheritance diagram for CppAD::cg::ClangCompiler< Base >:
Inheritance graph
Collaboration diagram for CppAD::cg::ClangCompiler< Base >:
Collaboration graph

Public Member Functions

 ClangCompiler (const std::string &clangPath="/usr/bin/clang")
 
 ClangCompiler (const ClangCompiler &orig)=delete
 
ClangCompileroperator= (const ClangCompiler &rhs)=delete
 
const std::string & getVersion ()
 
virtual const std::set< std::string > & getBitCodeFiles () const
 
virtual void generateLLVMBitCode (const std::map< std::string, std::string > &sources, JobTimer *timer=nullptr)
 
void buildDynamic (const std::string &library, JobTimer *timer=nullptr) override
 
void cleanup () override
 
std::string getCompilerPath () const
 
void setCompilerPath (const std::string &path)
 
const std::string & getTemporaryFolder () const override
 
void setTemporaryFolder (const std::string &tmpFolder) override
 
bool isSaveToDiskFirst () const override
 
void setSaveToDiskFirst (bool saveToDiskFirst) override
 
const std::string & getSourcesFolder () const override
 
void setSourcesFolder (const std::string &srcFolder) override
 
const std::set< std::string > & getObjectFiles () const override
 
const std::set< std::string > & getSourceFiles () const override
 
const std::vector< std::string > & getCompileFlags () const
 
void setCompileFlags (const std::vector< std::string > &compileFlags)
 
void addCompileFlag (const std::string &compileFlag)
 
const std::vector< std::string > & getLinkFlags () const
 
void setLinkFlags (const std::vector< std::string > &linkFlags)
 
void addLinkFlag (const std::string &linkFlag)
 
const std::vector< std::string > & getCompileLibFlags () const
 
void setCompileLibFlags (const std::vector< std::string > &compileLibFlags)
 
void addCompileLibFlag (const std::string &compileLibFlag)
 
bool isVerbose () const override
 
void setVerbose (bool verbose) override
 
void compileSources (const std::map< std::string, std::string > &sources, bool posIndepCode, JobTimer *timer=nullptr) override
 
virtual void compileSources (const std::map< std::string, std::string > &sources, bool posIndepCode, JobTimer *timer, const std::string &outputExtension, std::set< std::string > &outputFiles)
 

Static Public Member Functions

static std::vector< std::string > parseVersion (const std::string &version)
 

Protected Member Functions

void compileSource (const std::string &source, const std::string &output, bool posIndepCode) override
 
void compileFile (const std::string &path, const std::string &output, bool posIndepCode) override
 

Protected Attributes

std::set< std::string > _bcfiles
 
std::string _version
 
std::string _path
 
std::string _tmpFolder
 
std::string _sourcesFolder
 
std::set< std::string > _ofiles
 
std::set< std::string > _sfiles
 
std::vector< std::string > _compileFlags
 
std::vector< std::string > _compileLibFlags
 
std::vector< std::string > _linkFlags
 
bool _verbose
 
bool _saveToDiskFirst
 

Detailed Description

template<class Base>
class CppAD::cg::ClangCompiler< Base >

Clang compiler

Author
Joao Leal

Definition at line 28 of file clang_compiler.hpp.

Constructor & Destructor Documentation

◆ ClangCompiler()

template<class Base >
CppAD::cg::ClangCompiler< Base >::ClangCompiler ( const std::string &  clangPath = "/usr/bin/clang")
inline

Definition at line 34 of file clang_compiler.hpp.

◆ ~ClangCompiler()

template<class Base >
virtual CppAD::cg::ClangCompiler< Base >::~ClangCompiler ( )
inlinevirtual

Definition at line 136 of file clang_compiler.hpp.

Member Function Documentation

◆ addCompileFlag()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::addCompileFlag ( const std::string &  compileFlag)
inlineinherited

Definition at line 102 of file abstract_c_compiler.hpp.

◆ addCompileLibFlag()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::addCompileLibFlag ( const std::string &  compileLibFlag)
inlineinherited

Definition at line 126 of file abstract_c_compiler.hpp.

◆ addLinkFlag()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::addLinkFlag ( const std::string &  linkFlag)
inlineinherited

Definition at line 114 of file abstract_c_compiler.hpp.

◆ buildDynamic()

template<class Base >
void CppAD::cg::ClangCompiler< Base >::buildDynamic ( const std::string &  library,
JobTimer timer = nullptr 
)
inlineoverridevirtual

Creates a dynamic library from a set of object files

Parameters
librarythe path to the dynamic library to be created

Implements CppAD::cg::AbstractCCompiler< Base >.

Definition at line 89 of file clang_compiler.hpp.

◆ cleanup()

template<class Base >
void CppAD::cg::ClangCompiler< Base >::cleanup ( )
inlineoverridevirtual

Deletes the previously compiled object files and clears of files to include in a dynamic library

Reimplemented from CppAD::cg::AbstractCCompiler< Base >.

Definition at line 124 of file clang_compiler.hpp.

Referenced by CppAD::cg::LlvmModelLibraryProcessor< Base >::create(), CppAD::cg::LlvmBaseModelLibraryProcessorImpl< Base >::create(), and CppAD::cg::LlvmBaseModelLibraryProcessor< Base >::createBitCode().

◆ compileFile()

template<class Base >
void CppAD::cg::ClangCompiler< Base >::compileFile ( const std::string &  path,
const std::string &  output,
bool  posIndepCode 
)
inlineoverrideprotectedvirtual

Compiles a single source file into an object file.

Parameters
paththe path to the source file
outputthe compiled output file name (the object file path)

Implements CppAD::cg::AbstractCCompiler< Base >.

Definition at line 179 of file clang_compiler.hpp.

◆ compileSource()

template<class Base >
void CppAD::cg::ClangCompiler< Base >::compileSource ( const std::string &  source,
const std::string &  output,
bool  posIndepCode 
)
inlineoverrideprotectedvirtual

Compiles a single source file into an output file (e.g. object file or bit code file)

Parameters
sourcethe content of the source file
outputthe compiled output file name (the object file path)

Implements CppAD::cg::AbstractCCompiler< Base >.

Definition at line 161 of file clang_compiler.hpp.

◆ compileSources() [1/2]

template<class Base >
virtual void CppAD::cg::AbstractCCompiler< Base >::compileSources ( const std::map< std::string, std::string > &  sources,
bool  posIndepCode,
JobTimer timer,
const std::string &  outputExtension,
std::set< std::string > &  outputFiles 
)
inlinevirtualinherited

Definition at line 152 of file abstract_c_compiler.hpp.

◆ compileSources() [2/2]

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::compileSources ( const std::map< std::string, std::string > &  sources,
bool  posIndepCode,
JobTimer timer = nullptr 
)
inlineoverridevirtualinherited

Compiles the provided C source code.

Parameters
librarythe path of the dynamic library to be created
sourcesmaps the names to the content of the source files
posIndepCodewhether or not to create position-independent code for dynamic linking

Implements CppAD::cg::CCompiler< Base >.

Definition at line 146 of file abstract_c_compiler.hpp.

Referenced by CppAD::cg::AbstractCCompiler< Base >::compileSources().

◆ generateLLVMBitCode()

template<class Base >
virtual void CppAD::cg::ClangCompiler< Base >::generateLLVMBitCode ( const std::map< std::string, std::string > &  sources,
JobTimer timer = nullptr 
)
inlinevirtual

Definition at line 72 of file clang_compiler.hpp.

◆ getBitCodeFiles()

template<class Base >
virtual const std::set< std::string > & CppAD::cg::ClangCompiler< Base >::getBitCodeFiles ( ) const
inlinevirtual

Definition at line 68 of file clang_compiler.hpp.

◆ getCompileFlags()

template<class Base >
const std::vector< std::string > & CppAD::cg::AbstractCCompiler< Base >::getCompileFlags ( ) const
inlineinherited

Definition at line 94 of file abstract_c_compiler.hpp.

◆ getCompileLibFlags()

template<class Base >
const std::vector< std::string > & CppAD::cg::AbstractCCompiler< Base >::getCompileLibFlags ( ) const
inlineinherited

Definition at line 118 of file abstract_c_compiler.hpp.

◆ getCompilerPath()

template<class Base >
std::string CppAD::cg::AbstractCCompiler< Base >::getCompilerPath ( ) const
inlineinherited

Definition at line 54 of file abstract_c_compiler.hpp.

◆ getLinkFlags()

template<class Base >
const std::vector< std::string > & CppAD::cg::AbstractCCompiler< Base >::getLinkFlags ( ) const
inlineinherited

Definition at line 106 of file abstract_c_compiler.hpp.

◆ getObjectFiles()

template<class Base >
const std::set< std::string > & CppAD::cg::AbstractCCompiler< Base >::getObjectFiles ( ) const
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 86 of file abstract_c_compiler.hpp.

◆ getSourceFiles()

template<class Base >
const std::set< std::string > & CppAD::cg::AbstractCCompiler< Base >::getSourceFiles ( ) const
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 90 of file abstract_c_compiler.hpp.

◆ getSourcesFolder()

template<class Base >
const std::string & CppAD::cg::AbstractCCompiler< Base >::getSourcesFolder ( ) const
inlineoverridevirtualinherited

Provides the path to a folder where the source files should be created when the option to save files to disk is active.

Returns
path to a folder.

Implements CppAD::cg::CCompiler< Base >.

Definition at line 78 of file abstract_c_compiler.hpp.

◆ getTemporaryFolder()

template<class Base >
const std::string & CppAD::cg::AbstractCCompiler< Base >::getTemporaryFolder ( ) const
inlineoverridevirtualinherited

Provides the path to a temporary folder that should not exist (it will be deleted after the dynamic library is created)

Returns
path to a temporary folder.

Implements CppAD::cg::CCompiler< Base >.

Definition at line 62 of file abstract_c_compiler.hpp.

◆ getVersion()

template<class Base >
const std::string & CppAD::cg::ClangCompiler< Base >::getVersion ( )
inline

Definition at line 46 of file clang_compiler.hpp.

◆ isSaveToDiskFirst()

template<class Base >
bool CppAD::cg::AbstractCCompiler< Base >::isSaveToDiskFirst ( ) const
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 70 of file abstract_c_compiler.hpp.

◆ isVerbose()

template<class Base >
bool CppAD::cg::AbstractCCompiler< Base >::isVerbose ( ) const
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 130 of file abstract_c_compiler.hpp.

◆ parseVersion()

template<class Base >
static std::vector< std::string > CppAD::cg::ClangCompiler< Base >::parseVersion ( const std::string &  version)
inlinestatic

Definition at line 140 of file clang_compiler.hpp.

◆ setCompileFlags()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setCompileFlags ( const std::vector< std::string > &  compileFlags)
inlineinherited

Definition at line 98 of file abstract_c_compiler.hpp.

◆ setCompileLibFlags()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setCompileLibFlags ( const std::vector< std::string > &  compileLibFlags)
inlineinherited

Definition at line 122 of file abstract_c_compiler.hpp.

◆ setCompilerPath()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setCompilerPath ( const std::string &  path)
inlineinherited

Definition at line 58 of file abstract_c_compiler.hpp.

◆ setLinkFlags()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setLinkFlags ( const std::vector< std::string > &  linkFlags)
inlineinherited

Definition at line 110 of file abstract_c_compiler.hpp.

◆ setSaveToDiskFirst()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setSaveToDiskFirst ( bool  saveToDiskFirst)
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 74 of file abstract_c_compiler.hpp.

◆ setSourcesFolder()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setSourcesFolder ( const std::string &  srcFolder)
inlineoverridevirtualinherited

Defines the path to a folder where the source files should be created when the option to save files to disk is active.

Parameters
srcFolderpath to the folder.

Implements CppAD::cg::CCompiler< Base >.

Definition at line 82 of file abstract_c_compiler.hpp.

◆ setTemporaryFolder()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setTemporaryFolder ( const std::string &  tmpFolder)
inlineoverridevirtualinherited

Defines the path to a temporary folder that should not exist (it will be deleted after the dynamic library is created)

Parameters
tmpFolderpath to a temporary folder.

Implements CppAD::cg::CCompiler< Base >.

Definition at line 66 of file abstract_c_compiler.hpp.

◆ setVerbose()

template<class Base >
void CppAD::cg::AbstractCCompiler< Base >::setVerbose ( bool  verbose)
inlineoverridevirtualinherited

Implements CppAD::cg::CCompiler< Base >.

Definition at line 134 of file abstract_c_compiler.hpp.

Member Data Documentation

◆ _bcfiles

template<class Base >
std::set<std::string> CppAD::cg::ClangCompiler< Base >::_bcfiles
protected

Definition at line 30 of file clang_compiler.hpp.

◆ _compileFlags

template<class Base >
std::vector<std::string> CppAD::cg::AbstractCCompiler< Base >::_compileFlags
protectedinherited

Definition at line 36 of file abstract_c_compiler.hpp.

◆ _compileLibFlags

template<class Base >
std::vector<std::string> CppAD::cg::AbstractCCompiler< Base >::_compileLibFlags
protectedinherited

Definition at line 37 of file abstract_c_compiler.hpp.

◆ _linkFlags

template<class Base >
std::vector<std::string> CppAD::cg::AbstractCCompiler< Base >::_linkFlags
protectedinherited

Definition at line 38 of file abstract_c_compiler.hpp.

◆ _ofiles

template<class Base >
std::set<std::string> CppAD::cg::AbstractCCompiler< Base >::_ofiles
protectedinherited

Definition at line 34 of file abstract_c_compiler.hpp.

◆ _path

template<class Base >
std::string CppAD::cg::AbstractCCompiler< Base >::_path
protectedinherited

Definition at line 31 of file abstract_c_compiler.hpp.

◆ _saveToDiskFirst

template<class Base >
bool CppAD::cg::AbstractCCompiler< Base >::_saveToDiskFirst
protectedinherited

Definition at line 40 of file abstract_c_compiler.hpp.

◆ _sfiles

template<class Base >
std::set<std::string> CppAD::cg::AbstractCCompiler< Base >::_sfiles
protectedinherited

Definition at line 35 of file abstract_c_compiler.hpp.

◆ _sourcesFolder

template<class Base >
std::string CppAD::cg::AbstractCCompiler< Base >::_sourcesFolder
protectedinherited

Definition at line 33 of file abstract_c_compiler.hpp.

◆ _tmpFolder

template<class Base >
std::string CppAD::cg::AbstractCCompiler< Base >::_tmpFolder
protectedinherited

Definition at line 32 of file abstract_c_compiler.hpp.

◆ _verbose

template<class Base >
bool CppAD::cg::AbstractCCompiler< Base >::_verbose
protectedinherited

Definition at line 39 of file abstract_c_compiler.hpp.

◆ _version

template<class Base >
std::string CppAD::cg::ClangCompiler< Base >::_version
protected

Definition at line 31 of file clang_compiler.hpp.


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