clang 20.0.0git
Classes | Protected Member Functions | Protected Attributes | List of all members
clang::CompilerInvocationBase Class Reference

The base class of CompilerInvocation. More...

#include "clang/Frontend/CompilerInvocation.h"

Inheritance diagram for clang::CompilerInvocationBase:
Inheritance graph
[legend]

Classes

struct  EmptyConstructor
 Dummy tag type whose instance can be passed into the constructor to prevent creation of the reference-counted option objects. More...
 

Public Member Functions

const LangOptionsgetLangOpts () const
 Const getters.
 
const TargetOptionsgetTargetOpts () const
 
const DiagnosticOptionsgetDiagnosticOpts () const
 
const HeaderSearchOptionsgetHeaderSearchOpts () const
 
const PreprocessorOptionsgetPreprocessorOpts () const
 
const AnalyzerOptionsgetAnalyzerOpts () const
 
const MigratorOptionsgetMigratorOpts () const
 
const APINotesOptionsgetAPINotesOpts () const
 
const CodeGenOptionsgetCodeGenOpts () const
 
const FileSystemOptionsgetFileSystemOpts () const
 
const FrontendOptionsgetFrontendOpts () const
 
const DependencyOutputOptionsgetDependencyOutputOpts () const
 
const PreprocessorOutputOptionsgetPreprocessorOutputOpts () const
 

Protected Member Functions

 CompilerInvocationBase ()
 
 CompilerInvocationBase (EmptyConstructor)
 
 CompilerInvocationBase (const CompilerInvocationBase &X)=delete
 
 CompilerInvocationBase (CompilerInvocationBase &&X)=default
 
CompilerInvocationBaseoperator= (const CompilerInvocationBase &X)=delete
 
CompilerInvocationBasedeep_copy_assign (const CompilerInvocationBase &X)
 
CompilerInvocationBaseshallow_copy_assign (const CompilerInvocationBase &X)
 
CompilerInvocationBaseoperator= (CompilerInvocationBase &&X)=default
 
 ~CompilerInvocationBase ()=default
 

Protected Attributes

std::shared_ptr< LangOptionsLangOpts
 Options controlling the language variant.
 
std::shared_ptr< TargetOptionsTargetOpts
 Options controlling the target.
 
IntrusiveRefCntPtr< DiagnosticOptionsDiagnosticOpts
 Options controlling the diagnostic engine.
 
std::shared_ptr< HeaderSearchOptionsHSOpts
 Options controlling the #include directive.
 
std::shared_ptr< PreprocessorOptionsPPOpts
 Options controlling the preprocessor (aside from #include handling).
 
AnalyzerOptionsRef AnalyzerOpts
 Options controlling the static analyzer.
 
std::shared_ptr< MigratorOptionsMigratorOpts
 
std::shared_ptr< APINotesOptionsAPINotesOpts
 Options controlling API notes.
 
std::shared_ptr< CodeGenOptionsCodeGenOpts
 Options controlling IRgen and the backend.
 
std::shared_ptr< FileSystemOptionsFSOpts
 Options controlling file system operations.
 
std::shared_ptr< FrontendOptionsFrontendOpts
 Options controlling the frontend itself.
 
std::shared_ptr< DependencyOutputOptionsDependencyOutputOpts
 Options controlling dependency output.
 
std::shared_ptr< PreprocessorOutputOptionsPreprocessorOutputOpts
 Options controlling preprocessed output.
 
using StringAllocator = llvm::function_ref< const char *(const Twine &)>
 Command line generation.
 
using ArgumentConsumer = llvm::function_ref< void(const Twine &)>
 
void generateCC1CommandLine (llvm::SmallVectorImpl< const char * > &Args, StringAllocator SA) const
 Generate cc1-compatible command line arguments from this instance.
 
void generateCC1CommandLine (ArgumentConsumer Consumer) const
 Generate cc1-compatible command line arguments from this instance.
 
std::vector< std::string > getCC1CommandLine () const
 Generate cc1-compatible command line arguments from this instance, wrapping the result as a std::vector<std::string>.
 

Detailed Description

The base class of CompilerInvocation.

It keeps individual option objects behind reference-counted pointers, which is useful for clients that want to keep select option objects alive (even after CompilerInvocation gets destroyed) without making a copy.

Definition at line 74 of file CompilerInvocation.h.

Member Typedef Documentation

◆ ArgumentConsumer

using clang::CompilerInvocationBase::ArgumentConsumer = llvm::function_ref<void(const Twine &)>

Definition at line 171 of file CompilerInvocation.h.

◆ StringAllocator

using clang::CompilerInvocationBase::StringAllocator = llvm::function_ref<const char *(const Twine &)>

Command line generation.

Definition at line 152 of file CompilerInvocation.h.

Constructor & Destructor Documentation

◆ CompilerInvocationBase() [1/4]

CompilerInvocationBase::CompilerInvocationBase ( )
protected

Definition at line 139 of file CompilerInvocation.cpp.

◆ CompilerInvocationBase() [2/4]

clang::CompilerInvocationBase::CompilerInvocationBase ( EmptyConstructor  )
inlineprotected

Definition at line 119 of file CompilerInvocation.h.

◆ CompilerInvocationBase() [3/4]

clang::CompilerInvocationBase::CompilerInvocationBase ( const CompilerInvocationBase X)
protecteddelete

◆ CompilerInvocationBase() [4/4]

clang::CompilerInvocationBase::CompilerInvocationBase ( CompilerInvocationBase &&  X)
protecteddefault

◆ ~CompilerInvocationBase()

clang::CompilerInvocationBase::~CompilerInvocationBase ( )
protecteddefault

Member Function Documentation

◆ deep_copy_assign()

CompilerInvocationBase & CompilerInvocationBase::deep_copy_assign ( const CompilerInvocationBase X)
protected

◆ generateCC1CommandLine() [1/2]

void CompilerInvocationBase::generateCC1CommandLine ( ArgumentConsumer  Consumer) const

◆ generateCC1CommandLine() [2/2]

void clang::CompilerInvocationBase::generateCC1CommandLine ( llvm::SmallVectorImpl< const char * > &  Args,
StringAllocator  SA 
) const
inline

Generate cc1-compatible command line arguments from this instance.

Parameters
[out]Args- The generated arguments. Note that the caller is responsible for inserting the path to the clang executable and "-cc1" if desired.
SA- A function that given a Twine can allocate storage for a given command line argument and return a pointer to the newly allocated string. The returned pointer is what gets appended to Args.

Definition at line