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

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H

10#define LLVM_CLANG_FRONTEND_FRONTENDOPTIONS_H

11

17#include "llvm/ADT/StringRef.h"

18#include "llvm/Support/Compiler.h"

19#include "llvm/Support/MemoryBuffer.h"

20#include

21#include

22#include

23#include

24#include

25#include

26

27namespace llvm {

28

29class MemoryBuffer;

30

31}

32

34

35namespace frontend {

36

38

40

41

43

44

46

47

49

50

52

53

55

56

58

59

61

62

64

65

67

68

70

71

73

74

76

77

79

80

82

83

85

86

88

89

91

92

94

95

96

98

99

101

102

104

105

107

108

110

111

113

114

116

117

119

120

122

123

125

126

128

129

131

132

134

135

137

138

140

141

143

144

146

147

149

150

153

154}

155

156

158public:

159

165

166

167

168

175

176private:

178 LLVM_PREFERRED_TYPE(Format)

179 unsigned Fmt : 3;

180 LLVM_PREFERRED_TYPE(bool)

181 unsigned Preprocessed : 1;

183 unsigned HeaderUnit : 3;

184 LLVM_PREFERRED_TYPE(bool)

185 unsigned IsHeader : 1;

186

187public:

190 bool HD = false)

191 : Lang(L), Fmt(F), Preprocessed(PP), HeaderUnit(HU), IsHeader(HD) {}

192

197 }

199 bool isHeader() const { return IsHeader; }

201

202

204

205

208 }

209

213 }

214

218 }

219

223 }

224

228 }

229};

230

231

233

234 std::string File;

235

236

237

238

239 std::optionalllvm::MemoryBufferRef Buffer;

240

241

243

244

245 bool IsSystem = false;

246

247public:

250 : File(File.str()), Kind(Kind), IsSystem(IsSystem) {}

252 bool IsSystem = false)

253 : Buffer(Buffer), Kind(Kind), IsSystem(IsSystem) {}

254

256 bool isSystem() const { return IsSystem; }

257

258 bool isEmpty() const { return File.empty() && Buffer == std::nullopt; }

260 bool isBuffer() const { return Buffer != std::nullopt; }

262 bool isHeader() const { return Kind.isHeader(); }

264 return Kind.getHeaderUnitKind();

265 }

266

270 }

271

274 return *Buffer;

275 }

276};

277

278

280public:

281

282 LLVM_PREFERRED_TYPE(bool)

284

285

286

287 LLVM_PREFERRED_TYPE(bool)

289

290

291 LLVM_PREFERRED_TYPE(bool)

293

294

295 LLVM_PREFERRED_TYPE(bool)

297

298 LLVM_PREFERRED_TYPE(bool)

300

301

302 LLVM_PREFERRED_TYPE(bool)

304

305

306 LLVM_PREFERRED_TYPE(bool)

308

309

310 LLVM_PREFERRED_TYPE(bool)

312

313

314 LLVM_PREFERRED_TYPE(bool)

316

317

318 LLVM_PREFERRED_TYPE(bool)

320

321

322 LLVM_PREFERRED_TYPE(bool)

324

325

326 LLVM_PREFERRED_TYPE(bool)

328

329

330 LLVM_PREFERRED_TYPE(bool)

332

333

334 LLVM_PREFERRED_TYPE(bool)

336

337

338

339 LLVM_PREFERRED_TYPE(bool)

341

342

343 LLVM_PREFERRED_TYPE(bool)

345

346

347 LLVM_PREFERRED_TYPE(bool)

349

350

351 LLVM_PREFERRED_TYPE(bool)

353

354

355 LLVM_PREFERRED_TYPE(bool)

357

358

359 LLVM_PREFERRED_TYPE(bool)

361

362

363 LLVM_PREFERRED_TYPE(bool)

365

366

367 LLVM_PREFERRED_TYPE(bool)

369

370

371 LLVM_PREFERRED_TYPE(bool)

373

374

375 LLVM_PREFERRED_TYPE(bool)

377

378

379 LLVM_PREFERRED_TYPE(bool)

381

382

383 LLVM_PREFERRED_TYPE(bool)

385

386

387 LLVM_PREFERRED_TYPE(bool)

389

390

391 LLVM_PREFERRED_TYPE(bool)

393

394

395 LLVM_PREFERRED_TYPE(bool)

397

398

399 LLVM_PREFERRED_TYPE(bool)

401

402

403 LLVM_PREFERRED_TYPE(bool)

405

406

407 LLVM_PREFERRED_TYPE(bool)

409

410

411 LLVM_PREFERRED_TYPE(bool)

413

414

415 LLVM_PREFERRED_TYPE(bool)

417

418

419 LLVM_PREFERRED_TYPE(bool)

421

423

424

426

427 enum {

433

434 enum {

436

437

439

440

442

443

445

446

448

449

451

452

454

455

457

458

460

461

463

464

466

467

469

470

472

473

475

476

478

489

492

493

494

496

497

499

500

501

503

504

506

507

509

510

512

513

515

516

518

519

521

522

523

525

526

527

528

530

531

532

534

535

536 std::map<std::string, std::vectorstd::string> PluginArgs;

537

538

540

541

543

544

546

547

549

550

551

553

554

556

557

559

560

561

563

564

565

567

568

570

571

573

574

576

577

579

580

582

583

584

585 LLVM_PREFERRED_TYPE(bool)

587

588

590

591

593

594public:

611

612

613

614

615

616

618};

619

620}

621

622#endif

Options controlling the behavior of code completion.

An input file for the front end.

llvm::MemoryBufferRef getBuffer() const

bool isPreprocessed() const

FrontendInputFile()=default

FrontendInputFile(llvm::MemoryBufferRef Buffer, InputKind Kind, bool IsSystem=false)

InputKind getKind() const

StringRef getFile() const

InputKind::HeaderUnitKind getHeaderUnitKind() const

FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem=false)

FrontendOptions - Options for controlling the behavior of the frontend.

InputKind DashX

The input kind, either specified via -x argument or deduced from the input file name.

unsigned BuildingImplicitModule

Whether we are performing an implicit module build.

unsigned TimeTraceGranularity

Minimum time granularity (in microseconds) traced by time profiler.

std::string ObjCMTAllowListPath

std::vector< std::string > ModuleFiles

The list of additional prebuilt module files to load before processing the input.

unsigned AllowPCMWithCompilerErrors

Output (and read) PCM files regardless of compiler errors.

unsigned SkipFunctionBodies

Skip over function bodies to speed up parsing in cases you do not need them (e.g.

unsigned IncludeTimestamps

Whether timestamps should be written to the produced PCH file.

enum clang::FrontendOptions::@202 ARCMTAction

unsigned EmitSymbolGraphSymbolLabelsForTesting

Whether to emit symbol labels for testing in generated symbol graphs.

unsigned EmitSymbolGraph

Whether to emit symbol graph files as a side effect of compilation.

std::map< std::string, std::vector< std::string > > PluginArgs

Args to pass to the plugins.

unsigned BuildingImplicitModuleUsesLock

Whether to use a filesystem lock when building implicit modules.

unsigned ModulesShareFileManager

Whether to share the FileManager when building modules.

std::string ASTDumpFilter

If given, filter dumped AST Decl nodes by this substring.

unsigned ASTDumpLookups

Whether we include lookup table dumps in AST dumps.

unsigned UseTemporary

Should a temporary file be used during compilation.

CodeCompleteOptions CodeCompleteOpts

unsigned IsSystemModule

When using -emit-module, treat the modulemap as a system module.

unsigned PrintSupportedCPUs

print the supported cpus for the current target

unsigned FixToTemporaries

Apply fixes to temporary files.

unsigned PrintSupportedExtensions

Print the supported extensions for the current target.

unsigned PrintEnabledExtensions

Print the extensions enabled for the current target.

std::vector< std::string > LLVMArgs

A list of arguments to forward to LLVM's option processing; this should only be used for debugging an...

unsigned ShowHelp

Show the -help text.

std::string TimeTracePath

Path which stores the output files for -ftime-trace.

unsigned FixAndRecompile

Apply fixes and recompile.

unsigned UseClangIRPipeline

Use Clang IR pipeline to emit code.

unsigned FixOnlyWarnings

Apply fixes only for warnings.

ASTDumpOutputFormat ASTDumpFormat

Specifies the output format of the AST.

std::optional< std::string > AuxTargetCPU

Auxiliary target CPU for CUDA/HIP compilation.

std::string StatsFile

Filename to write statistics to.

std::string OutputFile

The output file, if any.

unsigned ShowStats

Show frontend performance metrics and statistics.

unsigned GenReducedBMI

Whether to generate reduced BMI for C++20 named modules.

std::string ActionName

The name of the action to run when using a plugin action.

std::vector< std::shared_ptr< ModuleFileExtension > > ModuleFileExtensions

The list of module file extensions.

ParsedSourceLocation CodeCompletionAt

If given, enable code completion at the provided location.

std::string FixItSuffix

If given, the new suffix for fix-it rewritten files.

std::string ARCMTMigrateReportOut

std::string OriginalModuleMap

When the input is a module map, the original module map file from which that map was inferred,...

std::vector< std::string > ModulesEmbedFiles

The list of files to embed into the compiled module file.

unsigned ShowVersion

Show the -version text.

unsigned ARCMTMigrateEmitARCErrors

Emit ARC errors even if the migrator can fix them.

std::string ProductName

The name of the product the input files belong too.

unsigned ModulesEmbedAllFiles

Whether we should embed all used files into the PCM file.

std::string ModuleOutputPath

Output Path for module output file.

std::vector< std::string > AddPluginActions

The list of plugin actions to run in addition to the normal action.

unsigned ASTDumpDeclTypes

Whether we include declaration type dumps in AST dumps.

unsigned FixWhatYouCan

Apply fixes even if there are unfixable errors.

static InputKind getInputKindForExtension(StringRef Extension)

getInputKindForExtension - Return the appropriate input kind for a file extension.

std::string SymbolGraphOutputDir

std::vector< std::string > ASTMergeFiles

The list of AST files to merge.

std::vector< std::string > Plugins

The list of plugins to load.

unsigned ASTDumpAll

Whether we deserialize all decls when forming AST dumps.

@ ObjCMT_Instancetype

Enable migration of ObjC methods to 'instancetype'.

@ ObjCMT_DesignatedInitializer

Enable inferring NS_DESIGNATED_INITIALIZER for ObjC methods.

@ ObjCMT_Annotation

Enable annotation of ObjCMethods of all kinds.

@ ObjCMT_PropertyDotSyntax

Enable converting setter/getter expressions to property-dot syntx.

@ ObjCMT_ProtocolConformance

Enable migration to add conforming protocols.

@ ObjCMT_NsMacros

Enable migration to NS_ENUM/NS_OPTIONS macros.

@ ObjCMT_AtomicProperty

prefer 'atomic' property over 'nonatomic'.

@ ObjCMT_Literals

Enable migration to modern ObjC literals.

@ ObjCMT_ReadonlyProperty

Enable migration to modern ObjC readonly property.

@ ObjCMT_Subscripting

Enable migration to modern ObjC subscripting.

@ ObjCMT_NsAtomicIOSOnlyProperty

use NS_NONATOMIC_IOSONLY for property 'atomic' attribute

@ ObjCMT_Property

Enable migration to modern ObjC property.

@ ObjCMT_ReadwriteProperty

Enable migration to modern ObjC readwrite property.

@ ObjCMT_ReturnsInnerPointerProperty

annotate property with NS_RETURNS_INNER_POINTER

unsigned GenerateGlobalModuleIndex

Whether we can generate the global module index if needed.

unsigned TimeTraceVerbose

Make time trace capture verbose event details (e.g.

unsigned RelocatablePCH

When generating PCH files, instruct the AST writer to create relocatable PCH files.

unsigned EmitExtensionSymbolGraphs

Whether to emit additional symbol graphs for extended modules.

unsigned DisableFree

Disable memory freeing on exit.

SmallVector< FrontendInputFile, 0 > Inputs

The input files and their types.

frontend::ActionKind ProgramAction

The frontend action to perform.

std::optional< std::vector< std::string > > AuxTargetFeatures

Auxiliary target features for CUDA/HIP compilation.

unsigned EmitPrettySymbolGraphs

Whether to emit symbol labels for testing in generated symbol graphs.

std::string OverrideRecordLayoutsFile

File name of the file that will provide record layouts (in the format produced by -fdump-record-layou...

std::vector< std::string > ExtractAPIIgnoresFileList

std::string AuxTriple

Auxiliary triple for CUDA/HIP compilation.

unsigned UseGlobalModuleIndex

Whether we can use the global module index if available.

std::vector< std::string > ModuleMapFiles

The list of module map files to load before processing the input.

unsigned ASTDumpDecls

Whether we include declaration dumps in AST dumps.

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

bool isPreprocessed() const

InputKind withHeaderUnit(HeaderUnitKind HU) const

bool isHeaderUnit() const

bool isUnknown() const

Is the input kind fully-unknown?

bool isObjectiveC() const

Is the language of the input some dialect of Objective-C?

constexpr InputKind(Language L=Language::Unknown, Format F=Source, bool PP=false, HeaderUnitKind HU=HeaderUnit_None, bool HD=false)

Format

The input file format.

InputKind getPreprocessed() const

HeaderUnitKind getHeaderUnitKind() const

InputKind getHeader() const

InputKind withFormat(Format F) const

Language getLanguage() const

@ GenerateHeaderUnit

Generate a C++20 header unit module from a header file.

@ VerifyPCH

Load and verify that a PCH file is usable.

@ PrintPreprocessedInput

-E mode.

@ RewriteTest

Rewriter playground.

@ ParseSyntaxOnly

Parse and perform semantic analysis.

@ TemplightDump

Dump template instantiations.

@ GenerateModuleInterface

Generate pre-compiled module from a standard C++ module interface unit.

@ EmitLLVM

Emit a .ll file.

@ PrintPreamble

Print the "preamble" of the input file.

@ MigrateSource

Run migrator.

@ InitOnly

Only execute frontend initialization.

@ ASTView

Parse ASTs and view them in Graphviz.

@ PluginAction

Run a plugin action,.

@ DumpRawTokens

Dump out raw tokens.

@ PrintDependencyDirectivesSourceMinimizerOutput

Print the output of the dependency directives source minimizer.

@ RewriteObjC

ObjC->C Rewriter.

@ RunPreprocessorOnly

Just lex, no output.

@ ModuleFileInfo

Dump information about a module file.

@ EmitCIR

Emit a .cir file.

@ DumpCompilerOptions

Dump the compiler configuration.

@ RunAnalysis

Run one or more source code analyses.

@ ASTPrint

Parse ASTs and print them.

@ GenerateReducedModuleInterface

Generate reduced module interface for a standard C++ module interface unit.

@ GenerateInterfaceStubs

Generate Interface Stub Files.

@ ASTDump

Parse ASTs and dump them.

@ DumpTokens

Dump out preprocessed tokens.

@ FixIt

Parse and apply any fixits to the source.

@ EmitAssembly

Emit a .s file.

@ EmitCodeGenOnly

Generate machine code, but don't emit anything.

@ RewriteMacros

Expand macros but not #includes.

@ EmitHTML

Translate input source into HTML.

@ GeneratePCH

Generate pre-compiled header.

@ EmitLLVMOnly

Generate LLVM IR, but do not emit anything.

@ GenerateModule

Generate pre-compiled module from a module map.

@ ASTDeclList

Parse ASTs and list Decl nodes.

The JSON file list parser is used to communicate input to InstallAPI.

ASTDumpOutputFormat

Used to specify the format for printing AST dump information.

Language

The language for the input, used to select and validate the language standard and possible actions.

Diagnostic wrappers for TextAPI types for error reporting.

A source location that has been parsed on the command line.