clang 19.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 161 of file CompilerInvocation.h.

References generateCC1CommandLine().

Referenced by clang::CompilerInvocation::checkCC1RoundTrip(), clang::CompilerInvocation::CreateFromArgs(), generateCC1CommandLine(), getCC1CommandLine(), and getModuleContextHash().

◆ getAnalyzerOpts()

const AnalyzerOptions & clang::CompilerInvocationBase::getAnalyzerOpts ( ) const
inline

Definition at line 136 of file CompilerInvocation.h.

References AnalyzerOpts.

Referenced by generateCC1CommandLine().

◆ getAPINotesOpts()

const APINotesOptions & clang::CompilerInvocationBase::getAPINotesOpts ( ) const
inline

Definition at line 138 of file CompilerInvocation.h.

References APINotesOpts.

Referenced by generateCC1CommandLine().

◆ getCC1CommandLine()

std::vector< std::string > CompilerInvocationBase::getCC1CommandLine ( ) const

Generate cc1-compatible command line arguments from this instance, wrapping the result as a std::vector<std::string>.

This is a (less-efficient) wrapper over generateCC1CommandLine().

Definition at line 5037 of file CompilerInvocation.cpp.

References generateCC1CommandLine().

◆ getCodeGenOpts()

const CodeGenOptions & clang::CompilerInvocationBase::getCodeGenOpts ( ) const
inline

Definition at line 139 of file CompilerInvocation.h.

References CodeGenOpts.

Referenced by generateCC1CommandLine().

◆ getDependencyOutputOpts()

const DependencyOutputOptions & clang::CompilerInvocationBase::getDependencyOutputOpts ( ) const
inline

Definition at line 142 of file CompilerInvocation.h.

References DependencyOutputOpts.

Referenced by generateCC1CommandLine().

◆ getDiagnosticOpts()

const DiagnosticOptions & clang::CompilerInvocationBase::getDiagnosticOpts ( ) const
inline

Definition at line 133 of file CompilerInvocation.h.

References DiagnosticOpts.

Referenced by generateCC1CommandLine().

◆ getFileSystemOpts()

const FileSystemOptions & clang::CompilerInvocationBase::getFileSystemOpts ( ) const
inline

Definition at line 140 of file CompilerInvocation.h.

References FSOpts.

Referenced by generateCC1CommandLine().

◆ getFrontendOpts()

const FrontendOptions & clang::CompilerInvocationBase::getFrontendOpts ( ) const
inline

Definition at line 141 of file CompilerInvocation.h.

References FrontendOpts.

Referenced by generateCC1CommandLine().

◆ getHeaderSearchOpts()

const HeaderSearchOptions & clang::CompilerInvocationBase::getHeaderSearchOpts ( ) const
inline

Definition at line 134 of file CompilerInvocation.h.

References HSOpts.

Referenced by generateCC1CommandLine().

◆ getLangOpts()

const LangOptions & clang::CompilerInvocationBase::getLangOpts ( ) const
inline

Const getters.

Definition at line 131 of file CompilerInvocation.h.

References LangOpts.

Referenced by generateCC1CommandLine().

◆ getMigratorOpts()

const MigratorOptions & clang::CompilerInvocationBase::getMigratorOpts ( ) const
inline

Definition at line 137 of file CompilerInvocation.h.

References MigratorOpts.

Referenced by generateCC1CommandLine().

◆ getPreprocessorOpts()

const PreprocessorOptions & clang::CompilerInvocationBase::getPreprocessorOpts ( ) const
inline

Definition at line 135 of file CompilerInvocation.h.

References PPOpts.

Referenced by generateCC1CommandLine().

◆ getPreprocessorOutputOpts()

const PreprocessorOutputOptions & clang::CompilerInvocationBase::getPreprocessorOutputOpts ( ) const
inline

Definition at line 145 of file CompilerInvocation.h.

References PreprocessorOutputOpts.

Referenced by generateCC1CommandLine().

◆ getTargetOpts()

const TargetOptions & clang::CompilerInvocationBase::getTargetOpts ( ) const
inline

Definition at line 132 of file CompilerInvocation.h.

References TargetOpts.

Referenced by generateCC1CommandLine().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

CompilerInvocationBase & clang::CompilerInvocationBase::operator= ( const CompilerInvocationBase X)
protecteddelete

◆ shallow_copy_assign()

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

Member Data Documentation

◆ AnalyzerOpts

AnalyzerOptionsRef clang::CompilerInvocationBase::AnalyzerOpts
protected

◆ APINotesOpts

std::shared_ptr<APINotesOptions> clang::CompilerInvocationBase::APINotesOpts
protected

◆ CodeGenOpts

std::shared_ptr<CodeGenOptions> clang::CompilerInvocationBase::CodeGenOpts
protected

◆ DependencyOutputOpts

std::shared_ptr<DependencyOutputOptions> clang::CompilerInvocationBase::DependencyOutputOpts
protected

◆ DiagnosticOpts

IntrusiveRefCntPtr<DiagnosticOptions> clang::CompilerInvocationBase::DiagnosticOpts
protected

Options controlling the diagnostic engine.

Definition at line 83 of file CompilerInvocation.h.

Referenced by deep_copy_assign(), getDiagnosticOpts(), clang::CowCompilerInvocation::getMutDiagnosticOpts(), and shallow_copy_assign().

◆ FrontendOpts

std::shared_ptr<FrontendOptions> clang::CompilerInvocationBase::FrontendOpts
protected

◆ FSOpts

std::shared_ptr<FileSystemOptions> clang::CompilerInvocationBase::FSOpts
protected

◆ HSOpts

std::shared_ptr<HeaderSearchOptions> clang::CompilerInvocationBase::HSOpts
protected

◆ LangOpts

std::shared_ptr<LangOptions> clang::CompilerInvocationBase::LangOpts
protected

Options controlling the language variant.

Definition at line 77 of file CompilerInvocation.h.

Referenced by deep_copy_assign(), getLangOpts(), clang::CowCompilerInvocation::getMutLangOpts(), and shallow_copy_assign().

◆ MigratorOpts

std::shared_ptr<MigratorOptions> clang::CompilerInvocationBase::MigratorOpts
protected

◆ PPOpts

std::shared_ptr<PreprocessorOptions> clang::CompilerInvocationBase::PPOpts
protected

◆ PreprocessorOutputOpts

std::shared_ptr<PreprocessorOutputOptions> clang::CompilerInvocationBase::PreprocessorOutputOpts
protected

◆ TargetOpts

std::shared_ptr<TargetOptions> clang::CompilerInvocationBase::TargetOpts
protected

Options controlling the target.

Definition at line 80 of file CompilerInvocation.h.

Referenced by deep_copy_assign(), clang::CowCompilerInvocation::getMutTargetOpts(), getTargetOpts(), and shallow_copy_assign().


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