clang 23.0.0git
Driver.h
Go to the documentation of this file.
1//===--- Driver.h - Clang GCC Compatible Driver -----------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_DRIVER_DRIVER_H
10#define LLVM_CLANG_DRIVER_DRIVER_H
11
14#include "clang/Basic/LLVM.h"
15#include "clang/Driver/Action.h"
18#include "clang/Driver/Phases.h"
20#include "clang/Driver/Types.h"
21#include "clang/Driver/Util.h"
23#include "llvm/ADT/ArrayRef.h"
24#include "llvm/ADT/STLFunctionalExtras.h"
25#include "llvm/ADT/StringMap.h"
26#include "llvm/ADT/StringRef.h"
27#include "llvm/Option/Arg.h"
28#include "llvm/Option/ArgList.h"
29#include "llvm/Support/StringSaver.h"
30
31#include <map>
32#include <set>
33#include <string>
34#include <vector>
35
36namespace llvm {
37class Triple;
38namespace vfs {
39class FileSystem;
40}
41namespace cl {
42class ExpansionContext;
43}
44} // namespace llvm
45
46namespace clang {
47
48namespace driver {
49
51
52class Command;
53class Compilation;
54class JobAction;
55class ToolChain;
56
57/// Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
64
65/// Whether headers used to construct C++20 module units should be looked
66/// up by the path supplied on the command line, or in the user or system
67/// search paths.
74
75/// Options for specifying CUID used by CUDA/HIP for uniquely identifying
76/// compilation units.
78public:
79 enum class Kind { Hash, Random, Fixed, None, Invalid };
80
81 CUIDOptions() = default;
82 CUIDOptions(llvm::opt::DerivedArgList &Args, const Driver &D);
83
84 // Get the CUID for an input string
85 std::string getCUID(StringRef InputFile,
86 llvm::opt::DerivedArgList &Args) const;
87
88 bool isEnabled() const {
89 return UseCUID != Kind::None && UseCUID != Kind::Invalid;
90 }
91
92private:
93 Kind UseCUID = Kind::None;
94 StringRef FixedCUID;
95};
96
97/// Driver - Encapsulate logic for constructing compilation processes
98/// from a set of gcc-driver-like command line arguments.
99class Driver {
100 DiagnosticsEngine &Diags;
101
103
104 enum DriverMode {
105 GCCMode,
106 GXXMode,
107 CPPMode,
108 CLMode,
109 FlangMode,
110 DXCMode
111 } Mode;
112
113 enum SaveTempsMode {
114 SaveTempsNone,
115 SaveTempsCwd,
116 SaveTempsObj
117 } SaveTemps;
118
119 enum BitcodeEmbedMode {
120 EmbedNone,
121 EmbedMarker,
122 EmbedBitcode
123 } BitcodeEmbed;
124
125 enum OffloadMode {
126 OffloadHostDevice,
127 OffloadHost,
128 OffloadDevice,
129 } Offload;
130
131 /// Header unit mode set by -fmodule-header={user,system}.
132 ModuleHeaderMode CXX20HeaderType;
133
134 /// Set if we should process inputs and jobs with C++20 module
135 /// interpretation.
136 bool ModulesModeCXX20;
137
138 /// LTO mode selected via -f(no-)?lto(=.*)? options.
139 LTOKind LTOMode;
140
141 /// LTO mode selected via -f(no-offload-)?lto(=.*)? options.
142 LTOKind OffloadLTOMode;
143
144 /// Options for CUID
145 CUIDOptions CUIDOpts;
146
147public:
149 /// An unknown OpenMP runtime. We can't generate effective OpenMP code
150 /// without knowing what runtime to target.
152
153 /// The LLVM OpenMP runtime. When completed and integrated, this will become
154 /// the default for Clang.
156
157 /// The GNU OpenMP runtime. Clang doesn't support generating OpenMP code for
158 /// this runtime but can swallow the pragmas, and find and link against the
159 /// runtime library itself.
161
162 /// The legacy name for the LLVM OpenMP runtime from when it was the Intel
163 /// OpenMP runtime. We support this mode for users with existing
164 /// dependencies on this runtime library name.
166 };
167
168 // Diag - Forwarding function for diagnostics.
169 DiagnosticBuilder Diag(unsigned DiagID) const {
170 return Diags.Report(DiagID);
171 }
172
173 // FIXME: Privatize once interface is stable.
174public:
175 /// The name the driver was invoked as.
176 std::string Name;
177
178 /// The path the driver executable was in, as invoked from the
179 /// command line.
180 std::string Dir;
181
182 /// The original path to the clang executable.
183 std::string ClangExecutable;
184
185 /// Target and driver mode components extracted from clang executable name.
187
188 /// The path to the compiler resource directory.
189 std::string ResourceDir;
190
191 /// System directory for config files.
192 std::string SystemConfigDir;
193
194 /// User directory for config files.
195 std::string UserConfigDir;
196
197 /// A prefix directory used to emulate a limited subset of GCC's '-Bprefix'
198 /// functionality.
199 /// FIXME: This type of customization should be removed in favor of the
200 /// universal driver when it is ready.
203
204 /// sysroot, if present
205 std::string SysRoot;
206
207 /// Dynamic loader prefix, if present
208 std::string DyldPrefix;
209
210 /// Driver title to use with help.
211 std::string DriverTitle;
212
213 /// Information about the host which can be overridden by the user.
215
216 /// The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
218
219 /// The file to log CC_PRINT_INTERNAL_STAT_FILE output to, if enabled.
221
222 /// The file to log CC_PRINT_OPTIONS output to, if enabled.
224
225 /// The file to log CC_PRINT_HEADERS output to, if enabled.
227
228 /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
230
231 /// Whether the driver should follow g++ like behavior.
232 bool CCCIsCXX() const { return Mode == GXXMode; }
233
234 /// Whether the driver is just the preprocessor.
235 bool CCCIsCPP() const { return Mode == CPPMode; }
236
237 /// Whether the driver should follow gcc like behavior.
238 bool CCCIsCC() const { return Mode == GCCMode; }
239
240 /// Whether the driver should follow cl.exe like behavior.
241 bool IsCLMode() const { return Mode == CLMode; }
242
243 /// Whether the driver should invoke flang for fortran inputs.
244 /// Other modes fall back to calling gcc which in turn calls gfortran.
245 bool IsFlangMode() const { return Mode == FlangMode; }
246
247 /// Whether the driver should follow dxc.exe like behavior.
248 bool IsDXCMode() const { return Mode == DXCMode; }
249
250 /// Only print tool bindings, don't build any jobs.
251 LLVM_PREFERRED_TYPE(bool)
253
254 /// Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to
255 /// CCPrintOptionsFilename or to stderr.
256 LLVM_PREFERRED_TYPE(bool)
257 unsigned CCPrintOptions : 1;
258
259 /// The format of the header information that is emitted. If CC_PRINT_HEADERS
260 /// is set, the format is textual. Otherwise, the format is determined by the
261 /// enviroment variable CC_PRINT_HEADERS_FORMAT.
263
264 /// This flag determines whether clang should filter the header information
265 /// that is emitted. If enviroment variable CC_PRINT_HEADERS_FILTERING is set
266 /// to "only-direct-system", only system headers that are directly included
267 /// from non-system headers are emitted.
269
270 /// Name of the library that provides implementations of
271 /// IEEE-754 128-bit float math functions used by Fortran F128
272 /// runtime library. It should be linked as needed by the linker job.
274
275 /// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics
276 /// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable
277 /// format.
278 LLVM_PREFERRED_TYPE(bool)
279 unsigned CCLogDiagnostics : 1;
280
281 /// Whether the driver is generating diagnostics for debugging purposes.
282 LLVM_PREFERRED_TYPE(bool)
283 unsigned CCGenDiagnostics : 1;
284
285 /// Set CC_PRINT_PROC_STAT mode, which causes the driver to dump
286 /// performance report to CC_PRINT_PROC_STAT_FILE or to stdout.
287 LLVM_PREFERRED_TYPE(bool)
289
290 /// Set CC_PRINT_INTERNAL_STAT mode, which causes the driver to dump internal
291 /// performance report to CC_PRINT_INTERNAL_STAT_FILE or to stdout.
292 LLVM_PREFERRED_TYPE(bool)
294
295 /// Pointer to the ExecuteCC1Tool function, if available.
296 /// When the clangDriver lib is used through clang.exe, this provides a
297 /// shortcut for executing the -cc1 command-line directly, in the same
298 /// process.
300 llvm::function_ref<int(SmallVectorImpl<const char *> &ArgV)>;
302
303private:
304 /// Raw target triple.
305 std::string TargetTriple;
306
307 /// Name to use when invoking gcc/g++.
308 std::string CCCGenericGCCName;
309
310 /// Paths to configuration files used.
311 std::vector<std::string> ConfigFiles;
312
313 /// Allocator for string saver.
314 llvm::BumpPtrAllocator Alloc;
315
316 /// Object that stores strings read from configuration file.
317 llvm::StringSaver Saver;
318
319 /// Arguments originated from configuration file (head part).
320 std::unique_ptr<llvm::opt::InputArgList> CfgOptionsHead;
321
322 /// Arguments originated from configuration file (tail part).
323 std::unique_ptr<llvm::opt::InputArgList> CfgOptionsTail;
324
325 /// Arguments originated from command line.
326 std::unique_ptr<llvm::opt::InputArgList> CLOptions;
327
328 /// If this is non-null, the driver will prepend this argument before
329 /// reinvoking clang. This is useful for the llvm-driver where clang's
330 /// realpath will be to the llvm binary and not clang, so it must pass
331 /// "clang" as it's first argument.
332 const char *PrependArg;
333
334 /// The default value of -fuse-ld= option. An empty string means the default
335 /// system linker.
336 std::string PreferredLinker;
337
338 /// Whether to check that input files exist when constructing compilation
339 /// jobs.
340 LLVM_PREFERRED_TYPE(bool)
341 unsigned CheckInputsExist : 1;
342 /// Whether to probe for PCH files on disk, in order to upgrade
343 /// -include foo.h to -include-pch foo.h.pch.
344 LLVM_PREFERRED_TYPE(bool)
345 unsigned ProbePrecompiled : 1;
346
347public:
348 // getFinalPhase - Determine which compilation mode we are in and record
349 // which option we used to determine the final phase.
350 // TODO: Much of what getFinalPhase returns are not actually true compiler
351 // modes. Fold this functionality into Types::getCompilationPhases and
352 // handleArguments.
353 phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
354 llvm::opt::Arg **FinalPhaseArg = nullptr) const;
355
356 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
357 executeProgram(llvm::ArrayRef<llvm::StringRef> Args) const;
358
359private:
360 /// Certain options suppress the 'no input files' warning.
361 LLVM_PREFERRED_TYPE(bool)
362 unsigned SuppressMissingInputWarning : 1;
363
364 /// Cache of all the ToolChains in use by the driver.
365 ///
366 /// This maps from the string representation of a triple to a ToolChain
367 /// created targeting that triple. The driver owns all the ToolChain objects
368 /// stored in it, and will clean them up when torn down.
369 mutable llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains;
370
371private:
372 /// TranslateInputArgs - Create a new derived argument list from the input
373 /// arguments, after applying the standard argument translations.
374 llvm::opt::DerivedArgList *
375 TranslateInputArgs(const llvm::opt::InputArgList &Args) const;
376
377 // handleArguments - All code related to claiming and printing diagnostics
378 // related to arguments to the driver are done here.
379 void handleArguments(Compilation &C, llvm::opt::DerivedArgList &Args,
380 const InputList &Inputs, ActionList &Actions) const;
381
382 // Before executing jobs, sets up response files for commands that need them.
383 void setUpResponseFiles(Compilation &C, Command &Cmd);
384
385 void generatePrefixedToolNames(StringRef Tool, const ToolChain &TC,
386 SmallVectorImpl<std::string> &Names) const;
387
388 /// Find the appropriate .crash diagonostic file for the child crash
389 /// under this driver and copy it out to a temporary destination with the
390 /// other reproducer related files (.sh, .cache, etc). If not found, suggest a
391 /// directory for the user to look at.
392 ///
393 /// \param ReproCrashFilename The file path to copy the .crash to.
394 /// \param CrashDiagDir The suggested directory for the user to look at
395 /// in case the search or copy fails.
396 ///
397 /// \returns If the .crash is found and successfully copied return true,
398 /// otherwise false and return the suggested directory in \p CrashDiagDir.
399 bool getCrashDiagnosticFile(StringRef ReproCrashFilename,
400 SmallString<128> &CrashDiagDir);
401
402public:
403 Driver(StringRef ClangExecutable, StringRef TargetTriple,
404 DiagnosticsEngine &Diags, std::string Title = "clang LLVM compiler",
405 IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
406
407 /// @name Accessors
408 /// @{
409
410 /// Name to use when invoking gcc/g++.
411 const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
412
414 return ConfigFiles;
415 }
416
417 const llvm::opt::OptTable &getOpts() const { return getDriverOptTable(); }
418
419 DiagnosticsEngine &getDiags() const { return Diags; }
420
421 llvm::vfs::FileSystem &getVFS() const { return *VFS; }
422
423 bool getCheckInputsExist() const { return CheckInputsExist; }
424
425 void setCheckInputsExist(bool Value) { CheckInputsExist = Value; }
426
427 bool getProbePrecompiled() const { return ProbePrecompiled; }
428 void setProbePrecompiled(bool Value) { ProbePrecompiled = Value; }
429
430 const char *getPrependArg() const { return PrependArg; }
431 void setPrependArg(const char *Value) { PrependArg = Value; }
432
434
435 const std::string &getTitle() { return DriverTitle; }
436 void setTitle(std::string Value) { DriverTitle = std::move(Value); }
437
438 std::string getTargetTriple() const { return TargetTriple; }
439
440 /// Get the path to the main clang executable.
441 const char *getClangProgramPath() const {
442 return ClangExecutable.c_str();
443 }
444
445 StringRef getPreferredLinker() const { return PreferredLinker; }
446 void setPreferredLinker(std::string Value) {
447 PreferredLinker = std::move(Value);
448 }
449
450 bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
451 bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
452
453 bool embedBitcodeEnabled() const { return BitcodeEmbed != EmbedNone; }
454 bool embedBitcodeInObject() const { return (BitcodeEmbed == EmbedBitcode); }
455 bool embedBitcodeMarkerOnly() const { return (BitcodeEmbed == EmbedMarker); }
456
457 bool offloadHostOnly() const { return Offload == OffloadHost; }
458 bool offloadDeviceOnly() const { return Offload == OffloadDevice; }
459
460 void setFlangF128MathLibrary(std::string name) {
461 FlangF128MathLibrary = std::move(name);
462 }
463 StringRef getFlangF128MathLibrary() const { return FlangF128MathLibrary; }
464
465 /// Compute the desired OpenMP runtime from the flags provided.
466 OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const;
467
468 /// @}
469 /// @name Primary Functionality
470 /// @{
471
472 /// CreateOffloadingDeviceToolChains - create all the toolchains required to
473 /// support offloading devices given the programming models specified in the
474 /// current compilation. Also, update the host tool chain kind accordingly.
476
477 /// BuildCompilation - Construct a compilation object for a command
478 /// line argument vector.
479 ///
480 /// \return A compilation, or 0 if none was built for the given
481 /// argument vector. A null return value does not necessarily
482 /// indicate an error condition, the diagnostics should be queried
483 /// to determine if an error occurred.
485
486 /// ParseArgStrings - Parse the given list of strings into an
487 /// ArgList.
488 llvm::opt::InputArgList ParseArgStrings(ArrayRef<const char *> Args,
489 bool UseDriverMode,
490 bool &ContainsError) const;
491
492 /// BuildInputs - Construct the list of inputs and their types from
493 /// the given arguments.
494 ///
495 /// \param TC - The default host tool chain.
496 /// \param Args - The input arguments.
497 /// \param Inputs - The list to store the resulting compilation
498 /// inputs onto.
499 void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args,
500 InputList &Inputs) const;
501
502 /// BuildActions - Construct the list of actions to perform for the
503 /// given arguments, which are only done for a single architecture.
504 ///
505 /// \param C - The compilation that is being built.
506 /// \param Args - The input arguments.
507 /// \param Actions - The list to store the resulting actions onto.
508 void BuildActions(Compilation &C, llvm::opt::DerivedArgList &Args,
509 const InputList &Inputs, ActionList &Actions) const;
510
511 /// BuildUniversalActions - Construct the list of actions to perform
512 /// for the given arguments, which may require a universal build.
513 ///
514 /// \param C - The compilation that is being built.
515 /// \param TC - The default host tool chain.
517 const InputList &BAInputs) const;
518
519 /// BuildOffloadingActions - Construct the list of actions to perform for the
520 /// offloading toolchain that will be embedded in the host.
521 ///
522 /// \param C - The compilation that is being built.
523 /// \param Args - The input arguments.
524 /// \param Input - The input type and arguments
525 /// \param CUID - The CUID for \p Input
526 /// \param HostAction - The host action used in the offloading toolchain.
528 llvm::opt::DerivedArgList &Args,
529 const InputTy &Input, StringRef CUID,
530 Action *HostAction) const;
531
532 /// Returns the set of bound architectures active for this offload kind.
533 /// If there are no bound architctures we return a set containing only the
534 /// empty string.
536 getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
537 Action::OffloadKind Kind, const ToolChain &TC) const;
538
539 /// Check that the file referenced by Value exists. If it doesn't,
540 /// issue a diagnostic and return false.
541 /// If TypoCorrect is true and the file does not exist, see if it looks
542 /// like a likely typo for a flag and if so print a "did you mean" blurb.
543 bool DiagnoseInputExistence(StringRef Value, types::ID Ty,
544 bool TypoCorrect) const;
545
546 /// BuildJobs - Bind actions to concrete tools and translate
547 /// arguments to form the list of jobs to run.
548 ///
549 /// \param C - The compilation that is being built.
550 void BuildJobs(Compilation &C) const;
551
552 /// ExecuteCompilation - Execute the compilation according to the command line
553 /// arguments and return an appropriate exit code.
554 ///
555 /// This routine handles additional processing that must be done in addition
556 /// to just running the subprocesses, for example reporting errors, setting
557 /// up response files, removing temporary files, etc.
559 SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands);
560
561 /// Contains the files in the compilation diagnostic report generated by
562 /// generateCompilationDiagnostics.
566
567 /// generateCompilationDiagnostics - Generate diagnostics information
568 /// including preprocessed source file(s).
569 ///
571 Compilation &C, const Command &FailingCommand,
572 StringRef AdditionalInformation = "",
573 CompilationDiagnosticReport *GeneratedReport = nullptr);
574
575 enum class CommandStatus {
576 Crash = 1,
579 };
580
581 enum class ReproLevel {
582 Off = 0,
583 OnCrash = static_cast<int>(CommandStatus::Crash),
584 OnError = static_cast<int>(CommandStatus::Error),
585 Always = static_cast<int>(CommandStatus::Ok),
586 };
587
590 const Command &FailingCommand, StringRef AdditionalInformation = "",
591 CompilationDiagnosticReport *GeneratedReport = nullptr) {
592 if (static_cast<int>(CS) > static_cast<int>(Level))
593 return false;
594 if (CS != CommandStatus::Crash)
595 Diags.Report(diag::err_drv_force_crash)
596 << !::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH");
597 // Hack to ensure that diagnostic notes get emitted.
598 Diags.setLastDiagnosticIgnored(false);
599 generateCompilationDiagnostics(C, FailingCommand, AdditionalInformation,
600 GeneratedReport);
601 return true;
602 }
603
604 /// @}
605 /// @name Helper Methods
606 /// @{
607
608 /// PrintActions - Print the list of actions.
609 void PrintActions(const Compilation &C) const;
610
611 /// PrintHelp - Print the help text.
612 ///
613 /// \param ShowHidden - Show hidden options.
614 void PrintHelp(bool ShowHidden) const;
615
616 /// PrintVersion - Print the driver version.
617 void PrintVersion(const Compilation &C, raw_ostream &OS) const;
618
619 /// GetFilePath - Lookup \p Name in the list of file search paths.
620 ///
621 /// \param TC - The tool chain for additional information on
622 /// directories to search.
623 //
624 // FIXME: This should be in CompilationInfo.
625 std::string GetFilePath(StringRef Name, const ToolChain &TC) const;
626
627 /// GetProgramPath - Lookup \p Name in the list of program search paths.
628 ///
629 /// \param TC - The provided tool chain for additional information on
630 /// directories to search.
631 //
632 // FIXME: This should be in CompilationInfo.
633 std::string GetProgramPath(StringRef Name, const ToolChain &TC) const;
634
635 /// Lookup the path to the Standard library module manifest.
636 ///
637 /// \param C - The compilation.
638 /// \param TC - The tool chain for additional information on
639 /// directories to search.
640 //
641 // FIXME: This should be in CompilationInfo.
642 std::string GetStdModuleManifestPath(const Compilation &C,
643 const ToolChain &TC) const;
644
645 /// HandleAutocompletions - Handle --autocomplete by searching and printing
646 /// possible flags, descriptions, and its arguments.
647 void HandleAutocompletions(StringRef PassedFlags) const;
648
649 /// HandleImmediateArgs - Handle any arguments which should be
650 /// treated before building actions or binding tools.
651 ///
652 /// \return Whether any compilation should be built for this
653 /// invocation. The compilation can only be modified when
654 /// this function returns false.
656
657 /// ConstructAction - Construct the appropriate action to do for
658 /// \p Phase on the \p Input, taking in to account arguments
659 /// like -fsyntax-only or --analyze.
661 Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase,
662 Action *Input,
663 Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None) const;
664
665 /// BuildJobsForAction - Construct the jobs to perform for the action \p A and
666 /// return an InputInfo for the result of running \p A. Will only construct
667 /// jobs for a given (Action, ToolChain, BoundArch, DeviceKind) tuple once.
669 Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
670 bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
671 std::map<std::pair<const Action *, std::string>, InputInfoList>
672 &CachedResults,
673 Action::OffloadKind TargetDeviceOffloadKind) const;
674
675 /// Returns the default name for linked images (e.g., "a.out").
676 const char *getDefaultImageName() const;
677
678 /// Creates a temp file.
679 /// 1. If \p MultipleArch is false or \p BoundArch is empty, the temp file is
680 /// in the temporary directory with name $Prefix-%%%%%%.$Suffix.
681 /// 2. If \p MultipleArch is true and \p BoundArch is not empty,
682 /// 2a. If \p NeedUniqueDirectory is false, the temp file is in the
683 /// temporary directory with name $Prefix-$BoundArch-%%%%%.$Suffix.
684 /// 2b. If \p NeedUniqueDirectory is true, the temp file is in a unique
685 /// subdiretory with random name under the temporary directory, and
686 /// the temp file itself has name $Prefix-$BoundArch.$Suffix.
687 const char *CreateTempFile(Compilation &C, StringRef Prefix, StringRef Suffix,
688 bool MultipleArchs = false,
689 StringRef BoundArch = {},
690 bool NeedUniqueDirectory = false) const;
691
692 /// GetNamedOutputPath - Return the name to use for the output of
693 /// the action \p JA. The result is appended to the compilation's
694 /// list of temporary or result files, as appropriate.
695 ///
696 /// \param C - The compilation.
697 /// \param JA - The action of interest.
698 /// \param BaseInput - The original input file that this action was
699 /// triggered by.
700 /// \param BoundArch - The bound architecture.
701 /// \param AtTopLevel - Whether this is a "top-level" action.
702 /// \param MultipleArchs - Whether multiple -arch options were supplied.
703 /// \param NormalizedTriple - The normalized triple of the relevant target.
704 const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
705 const char *BaseInput, StringRef BoundArch,
706 bool AtTopLevel, bool MultipleArchs,
707 StringRef NormalizedTriple) const;
708
709 /// GetTemporaryPath - Return the pathname of a temporary file to use
710 /// as part of compilation; the file will have the given prefix and suffix.
711 ///
712 /// GCC goes to extra lengths here to be a bit more robust.
713 std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
714
715 /// GetTemporaryDirectory - Return the pathname of a temporary directory to
716 /// use as part of compilation; the directory will have the given prefix.
717 std::string GetTemporaryDirectory(StringRef Prefix) const;
718
719 /// Return the pathname of the pch file in clang-cl mode.
720 std::string GetClPchPath(Compilation &C, StringRef BaseName) const;
721
722 /// ShouldUseClangCompiler - Should the clang compiler be used to
723 /// handle this action.
724 bool ShouldUseClangCompiler(const JobAction &JA) const;
725
726 /// ShouldUseFlangCompiler - Should the flang compiler be used to
727 /// handle this action.
728 bool ShouldUseFlangCompiler(const JobAction &JA) const;
729
730 /// ShouldEmitStaticLibrary - Should the linker emit a static library.
731 bool ShouldEmitStaticLibrary(const llvm::opt::ArgList &Args) const;
732
733 /// Returns true if the user has indicated a C++20 header unit mode.
734 bool hasHeaderMode() const { return CXX20HeaderType != HeaderMode_None; }
735
736 /// Get the mode for handling headers as set by fmodule-header{=}.
737 ModuleHeaderMode getModuleHeaderMode() const { return CXX20HeaderType; }
738
739 /// Returns true if we are performing any kind of LTO.
740 bool isUsingLTO() const { return getLTOMode() != LTOK_None; }
741
742 /// Get the specific kind of LTO being performed.
743 LTOKind getLTOMode() const { return LTOMode; }
744
745 /// Returns true if we are performing any kind of offload LTO.
746 bool isUsingOffloadLTO() const { return getOffloadLTOMode() != LTOK_None; }
747
748 /// Get the specific kind of offload LTO being performed.
749 LTOKind getOffloadLTOMode() const { return OffloadLTOMode; }
750
751 /// Get the CUID option.
752 const CUIDOptions &getCUIDOpts() const { return CUIDOpts; }
753
754private:
755
756 /// Tries to load options from configuration files.
757 ///
758 /// \returns true if error occurred.
759 bool loadConfigFiles();
760
761 /// Tries to load options from default configuration files (deduced from
762 /// executable filename).
763 ///
764 /// \returns true if error occurred.
765 bool loadDefaultConfigFiles(llvm::cl::ExpansionContext &ExpCtx);
766
767 /// Tries to load options from customization file.
768 ///
769 /// \returns true if error occurred.
770 bool loadZOSCustomizationFile(llvm::cl::ExpansionContext &);
771
772 /// Read options from the specified file.
773 ///
774 /// \param [in] FileName File to read.
775 /// \param [in] Search and expansion options.
776 /// \returns true, if error occurred while reading.
777 bool readConfigFile(StringRef FileName, llvm::cl::ExpansionContext &ExpCtx);
778
779 /// Set the driver mode (cl, gcc, etc) from the value of the `--driver-mode`
780 /// option.
781 void setDriverMode(StringRef DriverModeValue);
782
783 /// Parse the \p Args list for LTO options and record the type of LTO
784 /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
785 void setLTOMode(const llvm::opt::ArgList &Args);
786
787 /// Retrieves a ToolChain for a particular \p Target triple.
788 ///
789 /// Will cache ToolChains for the life of the driver object, and create them
790 /// on-demand.
791 const ToolChain &getToolChain(const llvm::opt::ArgList &Args,
792 const llvm::Triple &Target) const;
793
794 /// Retrieves a ToolChain for a particular \p Target triple for offloading.
795 ///
796 /// Will cache ToolChains for the life of the driver object, and create them
797 /// on-demand.
798 const ToolChain &getOffloadToolChain(const llvm::opt::ArgList &Args,
799 const Action::OffloadKind Kind,
800 const llvm::Triple &Target,
801 const llvm::Triple &AuxTarget) const;
802
803 /// Get bitmasks for which option flags to include and exclude based on
804 /// the driver mode.
805 llvm::opt::Visibility
806 getOptionVisibilityMask(bool UseDriverMode = true) const;
807
808 /// Helper used in BuildJobsForAction. Doesn't use the cache when building
809 /// jobs specifically for the given action, but will use the cache when
810 /// building jobs for the Action's inputs.
811 InputInfoList BuildJobsForActionNoCache(
812 Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
813 bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
814 std::map<std::pair<const Action *, std::string>, InputInfoList>
815 &CachedResults,
816 Action::OffloadKind TargetDeviceOffloadKind) const;
817
818 /// Return the typical executable name for the specified driver \p Mode.
819 static const char *getExecutableForDriverMode(DriverMode Mode);
820
821public:
822 /// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
823 /// return the grouped values as integers. Numbers which are not
824 /// provided are set to 0.
825 ///
826 /// \return True if the entire string was parsed (9.2), or all
827 /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
828 /// groups were parsed but extra characters remain at the end.
829 static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor,
830 unsigned &Micro, bool &HadExtra);
831
832 /// Parse digits from a string \p Str and fulfill \p Digits with
833 /// the parsed numbers. This method assumes that the max number of
834 /// digits to look for is equal to Digits.size().
835 ///
836 /// \return True if the entire string was parsed and there are
837 /// no extra characters remaining at the end.
838 static bool GetReleaseVersion(StringRef Str,
840 /// Compute the default -fmodule-cache-path.
841 /// \return True if the system provides a default cache directory.
843};
844
845/// \return True if the last defined optimization level is -Ofast.
846/// And False otherwise.
847bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
848
849/// \return True if the argument combination will end up generating remarks.
850bool willEmitRemarks(const llvm::opt::ArgList &Args);
851
852/// Returns the driver mode option's value, i.e. `X` in `--driver-mode=X`. If \p
853/// Args doesn't mention one explicitly, tries to deduce from `ProgName`.
854/// Returns empty on failure.
855/// Common values are "gcc", "g++", "cpp", "cl" and "flang". Returned value need
856/// not be one of these.
857llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef<const char *> Args);
858
859/// Checks whether the value produced by getDriverMode is for CL mode.
860bool IsClangCL(StringRef DriverMode);
861
862/// Expand response files from a clang driver or cc1 invocation.
863///
864/// \param Args The arguments that will be expanded.
865/// \param ClangCLMode Whether clang is in CL mode.
866/// \param Alloc Allocator for new arguments.
867/// \param FS Filesystem to use when expanding files.
869 bool ClangCLMode, llvm::BumpPtrAllocator &Alloc,
870 llvm::vfs::FileSystem *FS = nullptr);
871
872/// Apply a space separated list of edits to the input argument lists.
873/// See applyOneOverrideOption.
875 const char *OverrideOpts,
876 llvm::StringSet<> &SavedStrings, StringRef EnvVar,
877 raw_ostream *OS = nullptr);
878
879/// Creates and adds a synthesized input argument.
880///
881/// \param Args The argument list to append the input argument to.
882/// \param Opts The option table used to look up OPT_INPUT.
883/// \param Value The input to add, typically a filename.
884/// \param Claim Whether the newly created argument should be claimed.
885///
886/// \return The newly created input argument.
887llvm::opt::Arg *makeInputArg(llvm::opt::DerivedArgList &Args,
888 const llvm::opt::OptTable &Opts, StringRef Value,
889 bool Claim = true);
890
891} // end namespace driver
892} // end namespace clang
893
894#endif
Defines the Diagnostic-related interfaces.
Defines enums used when emitting included header information.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
A little helper class used to produce diagnostics.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:232
Action - Represent an abstract compilation step to perform.
Definition Action.h:47
Options for specifying CUID used by CUDA/HIP for uniquely identifying compilation units.
Definition Driver.h:77
std::string getCUID(StringRef InputFile, llvm::opt::DerivedArgList &Args) const
Definition Driver.cpp:151
bool isEnabled() const
Definition Driver.h:88
Command - An executable path/name and argument vector to execute.
Definition Job.h:106
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:99
const CUIDOptions & getCUIDOpts() const
Get the CUID option.
Definition Driver.h:752
std::string SysRoot
sysroot, if present
Definition Driver.h:205
std::string CCPrintInternalStatReportFilename
The file to log CC_PRINT_INTERNAL_STAT_FILE output to, if enabled.
Definition Driver.h:220
std::string UserConfigDir
User directory for config files.
Definition Driver.h:195
Action * ConstructPhaseAction(Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase, Action *Input, Action::OffloadKind TargetDeviceOffloadKind=Action::OFK_None) const
ConstructAction - Construct the appropriate action to do for Phase on the Input, taking in to account...
Definition Driver.cpp:5126
std::string HostRelease
Definition Driver.h:214
void BuildUniversalActions(Compilation &C, const ToolChain &TC, const InputList &BAInputs) const
BuildUniversalActions - Construct the list of actions to perform for the given arguments,...
Definition Driver.cpp:2854
void PrintHelp(bool ShowHidden) const
PrintHelp - Print the help text.
Definition Driver.cpp:2386
bool offloadDeviceOnly() const
Definition Driver.h:458
bool isSaveTempsEnabled() const
Definition Driver.h:450
void BuildJobs(Compilation &C) const
BuildJobs - Bind actions to concrete tools and translate arguments to form the list of jobs to run.
Definition Driver.cpp:5339
InputInfoList BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput, std::map< std::pair< const Action *, std::string >, InputInfoList > &CachedResults, Action::OffloadKind TargetDeviceOffloadKind) const
BuildJobsForAction - Construct the jobs to perform for the action A and return an InputInfo for the r...
Definition Driver.cpp:5881
std::string GetFilePath(StringRef Name, const ToolChain &TC) const
GetFilePath - Lookup Name in the list of file search paths.
Definition Driver.cpp:6619
void setPreferredLinker(std::string Value)
Definition Driver.h:446
void setCheckInputsExist(bool Value)
Definition Driver.h:425
unsigned CCPrintProcessStats
Set CC_PRINT_PROC_STAT mode, which causes the driver to dump performance report to CC_PRINT_PROC_STAT...
Definition Driver.h:288
DiagnosticsEngine & getDiags() const
Definition Driver.h:419
void PrintActions(const Compilation &C) const
PrintActions - Print the list of actions.
Definition Driver.cpp:2838
const char * GetNamedOutputPath(Compilation &C, const JobAction &JA, const char *BaseInput, StringRef BoundArch, bool AtTopLevel, bool MultipleArchs, StringRef NormalizedTriple) const
GetNamedOutputPath - Return the name to use for the output of the action JA.
Definition Driver.cpp:6325
void setFlangF128MathLibrary(std::string name)
Definition Driver.h:460
std::string CCPrintOptionsFilename
The file to log CC_PRINT_OPTIONS output to, if enabled.
Definition Driver.h:223
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > executeProgram(llvm::ArrayRef< llvm::StringRef > Args) const
Definition Driver.cpp:389
const char * getPrependArg() const
Definition Driver.h:430
CC1ToolFunc CC1Main
Definition Driver.h:301
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const
Compute the desired OpenMP runtime from the flags provided.
Definition Driver.cpp:880
std::string GetTemporaryDirectory(StringRef Prefix) const
GetTemporaryDirectory - Return the pathname of a temporary directory to use as part of compilation; t...
Definition Driver.cpp:6800
bool IsDXCMode() const
Whether the driver should follow dxc.exe like behavior.
Definition Driver.h:248
const char * getDefaultImageName() const
Returns the default name for linked images (e.g., "a.out").
Definition Driver.cpp:6214
llvm::function_ref< int(SmallVectorImpl< const char * > &ArgV)> CC1ToolFunc
Pointer to the ExecuteCC1Tool function, if available.
Definition Driver.h:299
bool IsCLMode() const
Whether the driver should follow cl.exe like behavior.
Definition Driver.h:241
std::string DyldPrefix
Dynamic loader prefix, if present.
Definition Driver.h:208
bool ShouldEmitStaticLibrary(const llvm::opt::ArgList &Args) const
ShouldEmitStaticLibrary - Should the linker emit a static library.
Definition Driver.cpp:7142
std::string DriverTitle
Driver title to use with help.
Definition Driver.h:211
unsigned CCCPrintBindings
Only print tool bindings, don't build any jobs.
Definition Driver.h:252
unsigned CCLogDiagnostics
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename...
Definition Driver.h:279
llvm::ArrayRef< std::string > getConfigFiles() const
Definition Driver.h:413
void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args, InputList &Inputs) const
BuildInputs - Construct the list of inputs and their types from the given arguments.
Definition Driver.cpp:3032
static bool getDefaultModuleCachePath(SmallVectorImpl< char > &Result)
Compute the default -fmodule-cache-path.
Definition Clang.cpp:3819
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
Definition Driver.h:283
bool HandleImmediateArgs(Compilation &C)
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding...
Definition Driver.cpp:2525
const char * getClangProgramPath() const
Get the path to the main clang executable.
Definition Driver.h:441
int ExecuteCompilation(Compilation &C, SmallVectorImpl< std::pair< int, const Command * > > &FailingCommands)
ExecuteCompilation - Execute the compilation according to the command line arguments and return an ap...
Definition Driver.cpp:2297
DiagnosticBuilder Diag(unsigned DiagID) const
Definition Driver.h:169
std::string SystemConfigDir
System directory for config files.
Definition Driver.h:192
ParsedClangName ClangNameParts
Target and driver mode components extracted from clang executable name.
Definition Driver.h:186
unsigned CCPrintInternalStats
Set CC_PRINT_INTERNAL_STAT mode, which causes the driver to dump internal performance report to CC_PR...
Definition Driver.h:293
static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor, unsigned &Micro, bool &HadExtra)
GetReleaseVersion - Parse (([0-9]+)(.
Definition Driver.cpp:7154
llvm::SmallVector< StringRef > getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args, Action::OffloadKind Kind, const ToolChain &TC) const
Returns the set of bound architectures active for this offload kind.
Definition Driver.cpp:4780
std::string Name
The name the driver was invoked as.
Definition Driver.h:176
phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL, llvm::opt::Arg **FinalPhaseArg=nullptr) const
Definition Driver.cpp:330
std::string GetClPchPath(Compilation &C, StringRef BaseName) const
Return the pathname of the pch file in clang-cl mode.
Definition Driver.cpp:6811
std::string ClangExecutable
The original path to the clang executable.
Definition Driver.h:183
const char * CreateTempFile(Compilation &C, StringRef Prefix, StringRef Suffix, bool MultipleArchs=false, StringRef BoundArch={}, bool NeedUniqueDirectory=false) const
Creates a temp file.
Definition Driver.cpp:6263
void setPrependArg(const char *Value)
Definition Driver.h:431
StringRef getFlangF128MathLibrary() const
Definition Driver.h:463
const llvm::opt::OptTable & getOpts() const
Definition Driver.h:417
void BuildActions(Compilation &C, llvm::opt::DerivedArgList &Args, const InputList &Inputs, ActionList &Actions) const
BuildActions - Construct the list of actions to perform for the given arguments, which are only done ...
Definition Driver.cpp:4423
bool offloadHostOnly() const
Definition Driver.h:457
ModuleHeaderMode getModuleHeaderMode() const
Get the mode for handling headers as set by fmodule-header{=}.
Definition Driver.h:737
void generateCompilationDiagnostics(Compilation &C, const Command &FailingCommand, StringRef AdditionalInformation="", CompilationDiagnosticReport *GeneratedReport=nullptr)
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(...
Definition Driver.cpp:2010
bool hasHeaderMode() const
Returns true if the user has indicated a C++20 header unit mode.
Definition Driver.h:734
SmallVector< std::string, 4 > prefix_list
A prefix directory used to emulate a limited subset of GCC's '-Bprefix' functionality.
Definition Driver.h:201
void PrintVersion(const Compilation &C, raw_ostream &OS) const
PrintVersion - Print the driver version.
Definition Driver.cpp:2395
Action * BuildOffloadingActions(Compilation &C, llvm::opt::DerivedArgList &Args, const InputTy &Input, StringRef CUID, Action *HostAction) const
BuildOffloadingActions - Construct the list of actions to perform for the offloading toolchain that w...
Definition Driver.cpp:4881
bool ShouldUseFlangCompiler(const JobAction &JA) const
ShouldUseFlangCompiler - Should the flang compiler be used to handle this action.
Definition Driver.cpp:7128
const std::string & getTitle()
Definition Driver.h:435
bool DiagnoseInputExistence(StringRef Value, types::ID Ty, bool TypoCorrect) const
Check that the file referenced by Value exists.
Definition Driver.cpp:2941
LTOKind getOffloadLTOMode() const
Get the specific kind of offload LTO being performed.
Definition Driver.h:749
bool isUsingOffloadLTO() const
Returns true if we are performing any kind of offload LTO.
Definition Driver.h:746
bool embedBitcodeEnabled() const
Definition Driver.h:453
void CreateOffloadingDeviceToolChains(Compilation &C, InputList &Inputs)
CreateOffloadingDeviceToolChains - create all the toolchains required to support offloading devices g...
Definition Driver.cpp:1040
std::string GetProgramPath(StringRef Name, const ToolChain &TC) const
GetProgramPath - Lookup Name in the list of program search paths.
Definition Driver.cpp:6684
std::string CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
Definition Driver.h:229
bool isSaveTempsObj() const
Definition Driver.h:451
std::string CCPrintHeadersFilename
The file to log CC_PRINT_HEADERS output to, if enabled.
Definition Driver.h:226
void HandleAutocompletions(StringRef PassedFlags) const
HandleAutocompletions - Handle –autocomplete by searching and printing possible flags,...
Definition Driver.cpp:2438
std::string ResourceDir
The path to the compiler resource directory.
Definition Driver.h:189
llvm::vfs::FileSystem & getVFS() const
Definition Driver.h:421
unsigned CCPrintOptions
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to std...
Definition Driver.h:257
bool ShouldUseClangCompiler(const JobAction &JA) const
ShouldUseClangCompiler - Should the clang compiler be used to handle this action.
Definition Driver.cpp:7113
std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const
GetTemporaryPath - Return the pathname of a temporary file to use as part of compilation; the file wi...
Definition Driver.cpp:6789
void setProbePrecompiled(bool Value)
Definition Driver.h:428
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition Driver.h:180
bool maybeGenerateCompilationDiagnostics(CommandStatus CS, ReproLevel Level, Compilation &C, const Command &FailingCommand, StringRef AdditionalInformation="", CompilationDiagnosticReport *GeneratedReport=nullptr)
Definition Driver.h:588
@ OMPRT_IOMP5
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
Definition Driver.h:165
@ OMPRT_OMP
The LLVM OpenMP runtime.
Definition Driver.h:155
@ OMPRT_Unknown
An unknown OpenMP runtime.
Definition Driver.h:151
@ OMPRT_GOMP
The GNU OpenMP runtime.
Definition Driver.h:160
bool isUsingLTO() const
Returns true if we are performing any kind of LTO.
Definition Driver.h:740
std::string HostBits
Information about the host which can be overridden by the user.
Definition Driver.h:214
Driver(StringRef ClangExecutable, StringRef TargetTriple, DiagnosticsEngine &Diags, std::string Title="clang LLVM compiler", IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr)
Definition Driver.cpp:173
HeaderIncludeFormatKind CCPrintHeadersFormat
The format of the header information that is emitted.
Definition Driver.h:262
std::string getTargetTriple() const
Definition Driver.h:438
bool getCheckInputsExist() const
Definition Driver.h:423
bool CCCIsCC() const
Whether the driver should follow gcc like behavior.
Definition Driver.h:238
void setTargetAndMode(const ParsedClangName &TM)
Definition Driver.h:433
std::string GetStdModuleManifestPath(const Compilation &C, const ToolChain &TC) const
Lookup the path to the Standard library module manifest.
Definition Driver.cpp:6726
bool IsFlangMode() const
Whether the driver should invoke flang for fortran inputs.
Definition Driver.h:245
bool embedBitcodeMarkerOnly() const
Definition Driver.h:455
void setTitle(std::string Value)
Definition Driver.h:436
prefix_list PrefixDirs
Definition Driver.h:202
Compilation * BuildCompilation(ArrayRef< const char * > Args)
BuildCompilation - Construct a compilation object for a command line argument vector.
Definition Driver.cpp:1474
HeaderIncludeFilteringKind CCPrintHeadersFiltering
This flag determines whether clang should filter the header information that is emitted.
Definition Driver.h:268
const std::string & getCCCGenericGCCName() const
Name to use when invoking gcc/g++.
Definition Driver.h:411
LTOKind getLTOMode() const
Get the specific kind of LTO being performed.
Definition Driver.h:743
std::string HostMachine
Definition Driver.h:214
bool embedBitcodeInObject() const
Definition Driver.h:454
std::string CCPrintStatReportFilename
The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
Definition Driver.h:217
llvm::opt::InputArgList ParseArgStrings(ArrayRef< const char * > Args, bool UseDriverMode, bool &ContainsError) const
ParseArgStrings - Parse the given list of strings into an ArgList.
Definition Driver.cpp:239
bool CCCIsCPP() const
Whether the driver is just the preprocessor.
Definition Driver.h:235
StringRef getPreferredLinker() const
Definition Driver.h:445
std::string HostSystem
Definition Driver.h:214
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition Driver.h:232
bool getProbePrecompiled() const
Definition Driver.h:427
std::string FlangF128MathLibrary
Name of the library that provides implementations of IEEE-754 128-bit float math functions used by Fo...
Definition Driver.h:273
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition Tool.h:32
ID
ID - Ordered values for successive stages in the compilation process which interact with user options...
Definition Phases.h:17
void applyOverrideOptions(SmallVectorImpl< const char * > &Args, const char *OverrideOpts, llvm::StringSet<> &SavedStrings, StringRef EnvVar, raw_ostream *OS=nullptr)
Apply a space separated list of edits to the input argument lists.
Definition Driver.cpp:7443
ModuleHeaderMode
Whether headers used to construct C++20 module units should be looked up by the path supplied on the ...
Definition Driver.h:68
@ HeaderMode_System
Definition Driver.h:72
@ HeaderMode_None
Definition Driver.h:69
@ HeaderMode_Default
Definition Driver.h:70
@ HeaderMode_User
Definition Driver.h:71
llvm::opt::Arg * makeInputArg(llvm::opt::DerivedArgList &Args, const llvm::opt::OptTable &Opts, StringRef Value, bool Claim=true)
Creates and adds a synthesized input argument.
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
Definition Driver.h:58
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:50
std::pair< types::ID, const llvm::opt::Arg * > InputTy
A list of inputs and their types for the given arguments.
Definition Types.h:133
SmallVector< Action *, 3 > ActionList
ActionList - Type used for lists of actions.
Definition Util.h:25
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef< const char * > Args)
Returns the driver mode option's value, i.e.
Definition Driver.cpp:7271
llvm::Error expandResponseFiles(SmallVectorImpl< const char * > &Args, bool ClangCLMode, llvm::BumpPtrAllocator &Alloc, llvm::vfs::FileSystem *FS=nullptr)
Expand response files from a clang driver or cc1 invocation.
Definition Driver.cpp:7288
llvm::SmallVector< InputTy, 16 > InputList
A list of inputs and their types for the given arguments.
Definition Types.h:136
bool willEmitRemarks(const llvm::opt::ArgList &Args)
bool IsClangCL(StringRef DriverMode)
Checks whether the value produced by getDriverMode is for CL mode.
Definition Driver.cpp:7286
The JSON file list parser is used to communicate input to InstallAPI.
HeaderIncludeFilteringKind
Whether header information is filtered or not.
@ Result
The result type of a method or function.
Definition TypeBase.h:905
const llvm::opt::OptTable & getDriverOptTable()
HeaderIncludeFormatKind
The format in which header information is emitted.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
Contains the files in the compilation diagnostic report generated by generateCompilationDiagnostics.
Definition Driver.h:563
llvm::SmallVector< std::string, 4 > TemporaryFiles
Definition Driver.h:564
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition ToolChain.h:65