clang: include/clang/Frontend/CompilerInvocation.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H

10#define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H

11

24#include "llvm/ADT/IntrusiveRefCntPtr.h"

25#include "llvm/ADT/ArrayRef.h"

26#include

27#include

28

29namespace llvm {

30

31class Triple;

32

33namespace opt {

34

35class ArgList;

36

37}

38

39namespace vfs {

40

41class FileSystem;

42

43}

44

45}

46

48

49class DiagnosticsEngine;

50class HeaderSearchOptions;

51class PreprocessorOptions;

52class TargetOptions;

53

54

55

56std::unique_ptr

58

59

60

61

62

63

64

65

68 bool DefaultDiagColor = true);

69

70

71

72

73

75protected:

76

77 std::shared_ptr LangOpts;

78

79

81

82

84

85

86 std::shared_ptr HSOpts;

87

88

89 std::shared_ptr PPOpts;

90

91

93

95

96

98

99

101

102

103 std::shared_ptr FSOpts;

104

105

107

108

110

111

113

114

115

117

127

128public:

129

130

144 }

147 }

148

149

150

151

152 using StringAllocator = llvm::function_ref<const char *(const Twine &)>;

153

154

155

156

157

158

159

160

164

165 Args.push_back(Arg.isSingleStringLiteral()

166 ? Arg.getSingleStringRef().data()

167 : SA(Arg));

168 });

169 }

170

172

173

174

175

177

178

179

180

181

183

184private:

185

186 static void GenerateDiagnosticArgs(const DiagnosticOptions &Opts,

188 bool DefaultDiagColor);

189

190

191 static void GenerateLangArgs(const LangOptions &Opts,

194

195

196 static void GenerateCodeGenArgs(const CodeGenOptions &Opts,

198 const llvm::Triple &T,

199 const std::string &OutputFile,

201

202};

203

205

206

207

208

209

210

212public:

217 }

221 return *this;

222 }

224

227

228

229

230

231

245

246

247

248

262 }

265 }

266

267

268

269

275 }

278 }

280

281

282

283

284

285

286

287

288

289

290

291

292

296 const char *Argv0 = nullptr);

297

298

299

300

301

302

303

304

305

306 static std::string GetResourcesPath(const char *Argv0, void *MainAddr);

307

308

309

310

311

312

315 const llvm::Triple &Triple);

316

317

318

320

321

322

323

324

325

326

327

330 const char *Argv0 = nullptr);

331

332

333

335

336

337

339

340private:

344

345

346 static bool ParseLangArgs(LangOptions &Opts, llvm::opt::ArgList &Args,

348 std::vectorstd::string &Includes,

350

351

352 static bool ParseCodeGenArgs(CodeGenOptions &Opts, llvm::opt::ArgList &Args,

354 const llvm::Triple &T,

355 const std::string &OutputFile,

357};

358

359

361public:

366 }

370 return *this;

371 }

373

377 }

378

381

382

383

384

385

399

400};

401

402IntrusiveRefCntPtrllvm::vfs::FileSystem

404 DiagnosticsEngine &Diags);

405

407 const CompilerInvocation &CI, DiagnosticsEngine &Diags,

408 IntrusiveRefCntPtrllvm::vfs::FileSystem BaseFS);

409

410IntrusiveRefCntPtrllvm::vfs::FileSystem

412 DiagnosticsEngine &Diags,

413 IntrusiveRefCntPtrllvm::vfs::FileSystem BaseFS);

414

415}

416

417#endif

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.

~CompilerInvocationBase()=default

std::shared_ptr< MigratorOptions > MigratorOpts

std::shared_ptr< PreprocessorOutputOptions > PreprocessorOutputOpts

Options controlling preprocessed output.

std::shared_ptr< APINotesOptions > APINotesOpts

Options controlling API notes.

std::shared_ptr< TargetOptions > TargetOpts

Options controlling the target.

const FrontendOptions & getFrontendOpts() const

const CodeGenOptions & getCodeGenOpts() const

CompilerInvocationBase(CompilerInvocationBase &&X)=default

llvm::function_ref< const char *(const Twine &)> StringAllocator

Command line generation.

const FileSystemOptions & getFileSystemOpts() const

std::shared_ptr< PreprocessorOptions > PPOpts

Options controlling the preprocessor (aside from #include handling).

const PreprocessorOutputOptions & getPreprocessorOutputOpts() 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)

std::shared_ptr< FileSystemOptions > FSOpts

Options controlling file system operations.

const AnalyzerOptions & getAnalyzerOpts() const

const MigratorOptions & getMigratorOpts() const

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

Generate cc1-compatible command line arguments from this instance.

CompilerInvocationBase & deep_copy_assign(const CompilerInvocationBase &X)

const DependencyOutputOptions & getDependencyOutputOpts() const

AnalyzerOptionsRef AnalyzerOpts

Options controlling the static analyzer.

IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts

Options controlling the diagnostic engine.

CompilerInvocationBase & shallow_copy_assign(const CompilerInvocationBase &X)

CompilerInvocationBase(const CompilerInvocationBase &X)=delete

const TargetOptions & getTargetOpts() const

CompilerInvocationBase & operator=(CompilerInvocationBase &&X)=default

std::shared_ptr< CodeGenOptions > CodeGenOpts

Options controlling IRgen and the backend.

CompilerInvocationBase & operator=(const CompilerInvocationBase &X)=delete

std::shared_ptr< LangOptions > LangOpts

Options controlling the language variant.

const APINotesOptions & getAPINotesOpts() const

const HeaderSearchOptions & getHeaderSearchOpts() const

std::shared_ptr< HeaderSearchOptions > HSOpts

Options controlling the #include directive.

const PreprocessorOptions & getPreprocessorOpts() const

const DiagnosticOptions & getDiagnosticOpts() const

const LangOptions & getLangOpts() const

Const getters.

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.

Helper class for holding the data necessary to invoke the compiler.

PreprocessorOptions & getPreprocessorOpts()

void clearImplicitModuleBuildOptions()

Disable implicit modules and canonicalize options that are only used by implicit modules.

MigratorOptions & getMigratorOpts()

AnalyzerOptions & getAnalyzerOpts()

APINotesOptions & getAPINotesOpts()

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.

std::shared_ptr< HeaderSearchOptions > getHeaderSearchOptsPtr()

LangOptions & getLangOpts()

Mutable getters.

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...

DependencyOutputOptions & getDependencyOutputOpts()

CompilerInvocation()=default

void resetNonModularOptions()

Reset all of the options that are not considered when building a module.

FrontendOptions & getFrontendOpts()

std::string getModuleHash() const

Retrieve a module hash string that is suitable for uniquely identifying the conditions under which th...

CompilerInvocation(const CompilerInvocation &X)

FileSystemOptions & getFileSystemOpts()

IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts

Options controlling the diagnostic engine.

CompilerInvocation(CompilerInvocation &&)=default

CompilerInvocation & operator=(const CompilerInvocation &X)

std::shared_ptr< LangOptions > getLangOptsPtr()

static void setDefaultPointerAuthOptions(PointerAuthOptions &Opts, const LangOptions &LangOpts, const llvm::Triple &Triple)

Populate Opts with the default set of pointer authentication-related options given LangOpts and Tripl...

CodeGenOptions & getCodeGenOpts()

std::shared_ptr< LangOptions > LangOpts

Base class internals.

TargetOptions & getTargetOpts()

HeaderSearchOptions & getHeaderSearchOpts()

DiagnosticOptions & getDiagnosticOpts()

PreprocessorOutputOptions & getPreprocessorOutputOpts()

~CompilerInvocation()=default

std::shared_ptr< PreprocessorOptions > getPreprocessorOptsPtr()

Same as CompilerInvocation, but with copy-on-write optimization.

FrontendOptions & getMutFrontendOpts()

LangOptions & getMutLangOpts()

Mutable getters.

~CowCompilerInvocation()=default

HeaderSearchOptions & getMutHeaderSearchOpts()

MigratorOptions & getMutMigratorOpts()

CowCompilerInvocation(CowCompilerInvocation &&)=default

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 & operator=(const CowCompilerInvocation &X)

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.

The kind of a file that we've been handed as an input.

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...