clang 24.0.0git
clang::CompilerInvocationBase Class Reference

The base class of CompilerInvocation. More...

#include "clang/Frontend/CompilerInvocation.h"

Inheritance diagram for clang::CompilerInvocationBase:
[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...
struct  ShallowConstructor
 Tag for the shallow-copy constructor below. More...

Public Member Functions

const LangOptions & getLangOpts () const
 Const getters.
const TargetOptions & getTargetOpts () const
const DiagnosticOptions & getDiagnosticOpts () const
const HeaderSearchOptions & getHeaderSearchOpts () const
const PreprocessorOptions & getPreprocessorOpts () const
const AnalyzerOptions & getAnalyzerOpts () const
const MigratorOptions & getMigratorOpts () const
const APINotesOptions & getAPINotesOpts () const
const CodeGenOptions & getCodeGenOpts () const
const FileSystemOptions & getFileSystemOpts () const
const FrontendOptions & getFrontendOpts () const
const DependencyOutputOptions & getDependencyOutputOpts () const
const PreprocessorOutputOptions & getPreprocessorOutputOpts () const
const ssaf::SSAFOptions & getSSAFOpts () const

Protected Member Functions

 CompilerInvocationBase ()
 CompilerInvocationBase (EmptyConstructor)
 CompilerInvocationBase (const CompilerInvocationBase &X)=delete
 CompilerInvocationBase (CompilerInvocationBase &&X)=default
CompilerInvocationBase & operator= (const CompilerInvocationBase &X)=delete
CompilerInvocationBase & deep_copy_assign (const CompilerInvocationBase &X)
CompilerInvocationBase & shallow_copy_assign (const CompilerInvocationBase &X)
CompilerInvocationBase & operator= (CompilerInvocationBase &&X)=default
 ~CompilerInvocationBase ()=default

Protected Attributes

std::shared_ptr< LangOptions > LangOpts
 Options controlling the language variant.
std::shared_ptr< TargetOptions > TargetOpts
 Options controlling the target.
std::shared_ptr< DiagnosticOptions > DiagnosticOpts
 Options controlling the diagnostic engine.
std::shared_ptr< HeaderSearchOptions > HSOpts
 Options controlling the #include directive.
std::shared_ptr< PreprocessorOptions > PPOpts
 Options controlling the preprocessor (aside from #include handling).
std::shared_ptr< AnalyzerOptions > AnalyzerOpts
 Options controlling the static analyzer.
std::shared_ptr< MigratorOptions > MigratorOpts
std::shared_ptr< APINotesOptions > APINotesOpts
 Options controlling API notes.
std::shared_ptr< CodeGenOptions > CodeGenOpts
 Options controlling IRgen and the backend.
std::shared_ptr< FileSystemOptions > FSOpts
 Options controlling file system operations.
std::shared_ptr< FrontendOptions > FrontendOpts
 Options controlling the frontend itself.
std::shared_ptr< DependencyOutputOptions > DependencyOutputOpts
 Options controlling dependency output.
std::shared_ptr< PreprocessorOutputOptions > PreprocessorOutputOpts
 Options controlling preprocessed output.
std::shared_ptr< ssaf::SSAFOptions > SSAFOpts
 Options controlling the Scalable Static Analysis Framework (SSAF).
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 80 of file CompilerInvocation.h.

Member Typedef Documentation

◆ ArgumentConsumer

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

Definition at line 184 of file CompilerInvocation.h.

◆ StringAllocator

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

Command line generation.

Definition at line 165 of file CompilerInvocation.h.

Constructor & Destructor Documentation

◆ CompilerInvocationBase() [1/4]

◆ CompilerInvocationBase() [2/4]

clang::CompilerInvocationBase::CompilerInvocationBase ( EmptyConstructor )
inlineprotected

Definition at line 131 of file CompilerInvocation.h.

◆ CompilerInvocationBase() [3/4]

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

References CompilerInvocationBase(), and X.

◆ CompilerInvocationBase() [4/4]

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

References CompilerInvocationBase(), and X.

◆ ~CompilerInvocationBase()

clang::CompilerInvocationBase::~CompilerInvocationBase ( )
protecteddefault

Member Function Documentation

◆ deep_copy_assign()

◆ generateCC1CommandLine() [1/2]

◆ 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 174 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

◆ getAPINotesOpts()

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

◆ 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 5527 of file CompilerInvocation.cpp.

References generateCC1CommandLine().

Referenced by clang::dependencies::CompilerInstanceWithContext::applyAndReport(), and clang::dependencies::CompilerInstanceWithContext::computeDependencies().

◆ getCodeGenOpts()

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

◆ getDependencyOutputOpts()

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

◆ getDiagnosticOpts()

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

◆ getFileSystemOpts()

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

◆ getFrontendOpts()

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

◆ getHeaderSearchOpts()

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

◆ getLangOpts()

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

Const getters.

Definition at line 143 of file CompilerInvocation.h.

References LangOpts.

Referenced by generateCC1CommandLine(), and clang::CompilerInvocation::~CompilerInvocation().

◆ getMigratorOpts()

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

◆ getPreprocessorOpts()

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

◆ getPreprocessorOutputOpts()

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

◆ getSSAFOpts()

const ssaf::SSAFOptions & clang::CompilerInvocationBase::getSSAFOpts ( ) const
inline

◆ getTargetOpts()

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

◆ operator=() [1/2]

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

References CompilerInvocationBase(), and X.

◆ operator=() [2/2]

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

◆ shallow_copy_assign()

Member Data Documentation

◆ AnalyzerOpts

std::shared_ptr<AnalyzerOptions> clang::CompilerInvocationBase::AnalyzerOpts
protected

◆ APINotesOpts

◆ CodeGenOpts

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

◆ DependencyOutputOpts

◆ DiagnosticOpts

std::shared_ptr<DiagnosticOptions> clang::CompilerInvocationBase::DiagnosticOpts
protected

◆ FrontendOpts

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

◆ FSOpts

◆ HSOpts

◆ LangOpts

◆ MigratorOpts

◆ PPOpts

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

◆ PreprocessorOutputOpts

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

◆ SSAFOpts

std::shared_ptr<ssaf::SSAFOptions> clang::CompilerInvocationBase::SSAFOpts
protected

Options controlling the Scalable Static Analysis Framework (SSAF).

Definition at line 121 of file CompilerInvocation.h.

Referenced by CompilerInvocationBase(), deep_copy_assign(), clang::CowCompilerInvocation::getMutSSAFOpts(), clang::CompilerInvocation::getSSAFOpts(), getSSAFOpts(), and shallow_copy_assign().

◆ TargetOpts

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

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