9 #ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H
10 #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
25 #include "llvm/ADT/ArrayRef.h"
49 class DiagnosticsEngine;
50 class HeaderSearchOptions;
51 class PreprocessorOptions;
56 std::unique_ptr<DiagnosticOptions>
68 bool DefaultDiagColor =
true);
86 std::shared_ptr<HeaderSearchOptions>
HSOpts;
89 std::shared_ptr<PreprocessorOptions>
PPOpts;
103 std::shared_ptr<FileSystemOptions>
FSOpts;
165 Args.push_back(Arg.isSingleStringLiteral()
166 ? Arg.getSingleStringRef().data()
188 bool DefaultDiagColor);
191 static void GenerateLangArgs(
const LangOptions &Opts,
198 const llvm::Triple &
T,
199 const std::string &OutputFile,
296 const char *Argv0 =
nullptr);
321 const char *Argv0 =
nullptr);
337 static bool ParseLangArgs(
LangOptions &Opts, llvm::opt::ArgList &Args,
339 std::vector<std::string> &Includes,
342 static void ParseFpAccuracyArgs(
LangOptions &Opts, llvm::opt::ArgList &Args,
346 static bool ParseCodeGenArgs(
CodeGenOptions &Opts, llvm::opt::ArgList &Args,
348 const llvm::Triple &
T,
349 const std::string &OutputFile,
396 IntrusiveRefCntPtr<llvm::vfs::FileSystem>
398 DiagnosticsEngine &Diags);
401 const CompilerInvocation &CI, DiagnosticsEngine &Diags,
402 IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
404 IntrusiveRefCntPtr<llvm::vfs::FileSystem>
406 DiagnosticsEngine &Diags,
407 IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
Defines the clang::FileSystemOptions interface.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
Tracks various options which control how API notes are found and handled.
Stores options for the analyzer from the command line.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
The base class of CompilerInvocation.
const MigratorOptions & getMigratorOpts() const
~CompilerInvocationBase()=default
const PreprocessorOptions & getPreprocessorOpts() const
std::shared_ptr< MigratorOptions > MigratorOpts
const AnalyzerOptions & getAnalyzerOpts() const
std::shared_ptr< PreprocessorOutputOptions > PreprocessorOutputOpts
Options controlling preprocessed output.
const PreprocessorOutputOptions & getPreprocessorOutputOpts() const
std::shared_ptr< APINotesOptions > APINotesOpts
Options controlling API notes.
const HeaderSearchOptions & getHeaderSearchOpts() const
std::shared_ptr< TargetOptions > TargetOpts
Options controlling the target.
const DiagnosticOptions & getDiagnosticOpts() const
CompilerInvocationBase(CompilerInvocationBase &&X)=default
llvm::function_ref< const char *(const Twine &)> StringAllocator
Command line generation.
std::shared_ptr< PreprocessorOptions > PPOpts
Options controlling the preprocessor (aside from #include handling).
const TargetOptions & getTargetOpts() const
const APINotesOptions & getAPINotesOpts() const
std::vector< std::string > getCC1CommandLine() const
Generate cc1-compatible command line arguments from this instance, wrapping the result as a std::vect...
CompilerInvocationBase(EmptyConstructor)
const DependencyOutputOptions & getDependencyOutputOpts() const
std::shared_ptr< FileSystemOptions > FSOpts
Options controlling file system operations.
const FrontendOptions & getFrontendOpts() const
void generateCC1CommandLine(llvm::SmallVectorImpl< const char * > &Args, StringAllocator SA) const
Generate cc1-compatible command line arguments from this instance.
const CodeGenOptions & getCodeGenOpts() const
CompilerInvocationBase & deep_copy_assign(const CompilerInvocationBase &X)
const LangOptions & getLangOpts() const
Const getters.
AnalyzerOptionsRef AnalyzerOpts
Options controlling the static analyzer.
IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
const FileSystemOptions & getFileSystemOpts() const
CompilerInvocationBase & shallow_copy_assign(const CompilerInvocationBase &X)
CompilerInvocationBase(const CompilerInvocationBase &X)=delete
std::shared_ptr< CodeGenOptions > CodeGenOpts
Options controlling IRgen and the backend.
std::shared_ptr< LangOptions > LangOpts
Options controlling the language variant.
std::shared_ptr< HeaderSearchOptions > HSOpts
Options controlling the #include directive.
CompilerInvocationBase & operator=(const CompilerInvocationBase &X)=delete
std::shared_ptr< FrontendOptions > FrontendOpts
Options controlling the frontend itself.
llvm::function_ref< void(const Twine &)> ArgumentConsumer
std::shared_ptr< DependencyOutputOptions > DependencyOutputOpts
Options controlling dependency output.
CompilerInvocationBase & operator=(CompilerInvocationBase &&X)=default
Helper class for holding the data necessary to invoke the compiler.
void clearImplicitModuleBuildOptions()
Disable implicit modules and canonicalize options that are only used by implicit modules.
PreprocessorOutputOptions & getPreprocessorOutputOpts()
AnalyzerOptions & getAnalyzerOpts()
static std::string GetResourcesPath(const char *Argv0, void *MainAddr)
Get the directory where the compiler headers reside, relative to the compiler binary (found by the pa...
static bool CreateFromArgs(CompilerInvocation &Res, ArrayRef< const char * > CommandLineArgs, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Create a compiler invocation from a list of input options.
std::shared_ptr< TargetOptions > TargetOpts
Options controlling the target.
MigratorOptions & getMigratorOpts()
PreprocessorOptions & getPreprocessorOpts()
APINotesOptions & getAPINotesOpts()
CodeGenOptions & getCodeGenOpts()
DiagnosticOptions & getDiagnosticOpts()
static bool checkCC1RoundTrip(ArrayRef< const char * > Args, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Check that Args can be parsed and re-serialized without change, emiting diagnostics for any differenc...
CompilerInvocation()=default
void resetNonModularOptions()
Reset all of the options that are not considered when building a module.
FileSystemOptions & getFileSystemOpts()
std::string getModuleHash() const
Retrieve a module hash string that is suitable for uniquely identifying the conditions under which th...
CompilerInvocation(const CompilerInvocation &X)
std::shared_ptr< PreprocessorOptions > getPreprocessorOptsPtr()
IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
CompilerInvocation(CompilerInvocation &&)=default
TargetOptions & getTargetOpts()
LangOptions & getLangOpts()
Mutable getters.
CompilerInvocation & operator=(const CompilerInvocation &X)
HeaderSearchOptions & getHeaderSearchOpts()
std::shared_ptr< LangOptions > getLangOptsPtr()
std::shared_ptr< LangOptions > LangOpts
Base class internals.
std::shared_ptr< HeaderSearchOptions > getHeaderSearchOptsPtr()
DependencyOutputOptions & getDependencyOutputOpts()
~CompilerInvocation()=default
FrontendOptions & getFrontendOpts()
Same as CompilerInvocation, but with copy-on-write optimization.
FrontendOptions & getMutFrontendOpts()
LangOptions & getMutLangOpts()
Mutable getters.
~CowCompilerInvocation()=default
HeaderSearchOptions & getMutHeaderSearchOpts()
MigratorOptions & getMutMigratorOpts()
CowCompilerInvocation(CowCompilerInvocation &&)=default
CowCompilerInvocation & operator=(const CowCompilerInvocation &X)
PreprocessorOptions & getMutPreprocessorOpts()
APINotesOptions & getMutAPINotesOpts()
PreprocessorOutputOptions & getMutPreprocessorOutputOpts()
CodeGenOptions & getMutCodeGenOpts()
TargetOptions & getMutTargetOpts()
FileSystemOptions & getMutFileSystemOpts()
AnalyzerOptions & getMutAnalyzerOpts()
CowCompilerInvocation(const CompilerInvocation &X)
DiagnosticOptions & getMutDiagnosticOpts()
CowCompilerInvocation(const CowCompilerInvocation &X)
DependencyOutputOptions & getMutDependencyOutputOpts()
CowCompilerInvocation()=default
CowCompilerInvocation(CompilerInvocation &&X)
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
Options for controlling the compiler diagnostics engine.
Concrete class used by the front-end to report problems and issues.
Keeps track of options that affect how file operations are performed.
FrontendOptions - Options for controlling the behavior of the frontend.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
PreprocessorOutputOptions - Options for controlling the C preprocessor output (e.g....
Options for controlling the target.
The JSON file list parser is used to communicate input to InstallAPI.
IntrusiveRefCntPtr< llvm::vfs::FileSystem > createVFSFromOverlayFiles(ArrayRef< std::string > VFSOverlayFiles, DiagnosticsEngine &Diags, IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS)
std::unique_ptr< DiagnosticOptions > CreateAndPopulateDiagOpts(ArrayRef< const char * > Argv)
IntrusiveRefCntPtr< llvm::vfs::FileSystem > createVFSFromCompilerInvocation(const CompilerInvocation &CI, DiagnosticsEngine &Diags)
const FunctionProtoType * T
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags=nullptr, bool DefaultDiagColor=true)
Fill out Opts based on the options given in Args.
Diagnostic wrappers for TextAPI types for error reporting.
Dummy tag type whose instance can be passed into the constructor to prevent creation of the reference...