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