clang 20.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.
511 llvm::DenseSet<StringRef>
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. The compilation can only be modified when
632 /// this function returns false.
634
635 /// ConstructAction - Construct the appropriate action to do for
636 /// \p Phase on the \p Input, taking in to account arguments
637 /// like -fsyntax-only or --analyze.
639 Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase,
640 Action *Input,
641 Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None) const;
642
643 /// BuildJobsForAction - Construct the jobs to perform for the action \p A and
644 /// return an InputInfo for the result of running \p A. Will only construct
645 /// jobs for a given (Action, ToolChain, BoundArch, DeviceKind) tuple once.
647 Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
648 bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
649 std::map<std::pair<const Action *, std::string>, InputInfoList>
650 &CachedResults,
651 Action::OffloadKind TargetDeviceOffloadKind) const;
652
653 /// Returns the default name for linked images (e.g., "a.out").
654 const char *getDefaultImageName() const;
655
656 /// Creates a temp file.
657 /// 1. If \p MultipleArch is false or \p BoundArch is empty, the temp file is
658 /// in the temporary directory with name $Prefix-%%%%%%.$Suffix.
659 /// 2. If \p MultipleArch is true and \p BoundArch is not empty,
660 /// 2a. If \p NeedUniqueDirectory is false, the temp file is in the
661 /// temporary directory with name $Prefix-$BoundArch-%%%%%.$Suffix.
662 /// 2b. If \p NeedUniqueDirectory is true, the temp file is in a unique
663 /// subdiretory with random name under the temporary directory, and
664 /// the temp file itself has name $Prefix-$BoundArch.$Suffix.
665 const char *CreateTempFile(Compilation &C, StringRef Prefix, StringRef Suffix,
666 bool MultipleArchs = false,
667 StringRef BoundArch = {},
668 bool NeedUniqueDirectory = false) const;
669
670 /// GetNamedOutputPath - Return the name to use for the output of
671 /// the action \p JA. The result is appended to the compilation's
672 /// list of temporary or result files, as appropriate.
673 ///
674 /// \param C - The compilation.
675 /// \param JA - The action of interest.
676 /// \param BaseInput - The original input file that this action was
677 /// triggered by.
678 /// \param BoundArch - The bound architecture.
679 /// \param AtTopLevel - Whether this is a "top-level" action.
680 /// \param MultipleArchs - Whether multiple -arch options were supplied.
681 /// \param NormalizedTriple - The normalized triple of the relevant target.
682 const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
683 const char *BaseInput, StringRef BoundArch,
684 bool AtTopLevel, bool MultipleArchs,
685 StringRef NormalizedTriple) const;
686
687 /// GetTemporaryPath - Return the pathname of a temporary file to use
688 /// as part of compilation; the file will have the given prefix and suffix.
689 ///
690 /// GCC goes to extra lengths here to be a bit more robust.
691 std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
692
693 /// GetTemporaryDirectory - Return the pathname of a temporary directory to
694 /// use as part of compilation; the directory will have the given prefix.
695 std::string GetTemporaryDirectory(StringRef Prefix) const;
696
697 /// Return the pathname of the pch file in clang-cl mode.
698 std::string GetClPchPath(Compilation &C, StringRef BaseName) const;
699
700 /// ShouldUseClangCompiler - Should the clang compiler be used to
701 /// handle this action.
702 bool ShouldUseClangCompiler(const JobAction &JA) const;
703
704 /// ShouldUseFlangCompiler - Should the flang compiler be used to
705 /// handle this action.
706 bool ShouldUseFlangCompiler(const JobAction &JA) const;
707
708 /// ShouldEmitStaticLibrary - Should the linker emit a static library.
709 bool ShouldEmitStaticLibrary(const llvm::opt::ArgList &Args) const;
710
711 /// Returns true if the user has indicated a C++20 header unit mode.
712 bool hasHeaderMode() const { return CXX20HeaderType != HeaderMode_None; }
713
714 /// Get the mode for handling headers as set by fmodule-header{=}.
715 ModuleHeaderMode getModuleHeaderMode() const { return CXX20HeaderType; }
716
717 /// Returns true if we are performing any kind of LTO.
718 bool isUsingLTO() const { return getLTOMode() != LTOK_None; }
719
720 /// Get the specific kind of LTO being performed.
721 LTOKind getLTOMode() const { return LTOMode; }
722
723 /// Returns true if we are performing any kind of offload LTO.
724 bool isUsingOffloadLTO() const { return getOffloadLTOMode() != LTOK_None; }
725
726 /// Get the specific kind of offload LTO being performed.
727 LTOKind getOffloadLTOMode() const { return OffloadLTOMode; }
728
729private:
730
731 /// Tries to load options from configuration files.
732 ///
733 /// \returns true if error occurred.
734 bool loadConfigFiles();
735
736 /// Tries to load options from default configuration files (deduced from
737 /// executable filename).
738 ///
739 /// \returns true if error occurred.
740 bool loadDefaultConfigFiles(llvm::cl::ExpansionContext &ExpCtx);
741
742 /// Read options from the specified file.
743 ///
744 /// \param [in] FileName File to read.
745 /// \param [in] Search and expansion options.
746 /// \returns true, if error occurred while reading.
747 bool readConfigFile(StringRef FileName, llvm::cl::ExpansionContext &ExpCtx);
748
749 /// Set the driver mode (cl, gcc, etc) from the value of the `--driver-mode`
750 /// option.
751 void setDriverMode(StringRef DriverModeValue);
752
753 /// Parse the \p Args list for LTO options and record the type of LTO
754 /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
755 void setLTOMode(const llvm::opt::ArgList &Args);
756
757 /// Retrieves a ToolChain for a particular \p Target triple.
758 ///
759 /// Will cache ToolChains for the life of the driver object, and create them
760 /// on-demand.
761 const ToolChain &getToolChain(const llvm::opt::ArgList &Args,
762 const llvm::Triple &Target) const;
763
764 /// @}
765
766 /// Retrieves a ToolChain for a particular device \p Target triple
767 ///
768 /// \param[in] HostTC is the host ToolChain paired with the device
769 ///
770 /// \param[in] TargetDeviceOffloadKind (e.g. OFK_Cuda/OFK_OpenMP/OFK_SYCL) is
771 /// an Offloading action that is optionally passed to a ToolChain (used by
772 /// CUDA, to specify if it's used in conjunction with OpenMP)
773 ///
774 /// Will cache ToolChains for the life of the driver object, and create them
775 /// on-demand.
776 const ToolChain &getOffloadingDeviceToolChain(
777 const llvm::opt::ArgList &Args, const llvm::Triple &Target,
778 const ToolChain &HostTC,
779 const Action::OffloadKind &TargetDeviceOffloadKind) const;
780
781 /// Get bitmasks for which option flags to include and exclude based on
782 /// the driver mode.
783 llvm::opt::Visibility
784 getOptionVisibilityMask(bool UseDriverMode = true) const;
785
786 /// Helper used in BuildJobsForAction. Doesn't use the cache when building
787 /// jobs specifically for the given action, but will use the cache when
788 /// building jobs for the Action's inputs.
789 InputInfoList BuildJobsForActionNoCache(
790 Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
791 bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
792 std::map<std::pair<const Action *, std::string>, InputInfoList>
793 &CachedResults,
794 Action::OffloadKind TargetDeviceOffloadKind) const;
795
796 /// Return the typical executable name for the specified driver \p Mode.
797 static const char *getExecutableForDriverMode(DriverMode Mode);
798
799public:
800 /// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
801 /// return the grouped values as integers. Numbers which are not
802 /// provided are set to 0.
803 ///
804 /// \return True if the entire string was parsed (9.2), or all
805 /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
806 /// groups were parsed but extra characters remain at the end.
807 static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor,
808 unsigned &Micro, bool &HadExtra);
809
810 /// Parse digits from a string \p Str and fulfill \p Digits with
811 /// the parsed numbers. This method assumes that the max number of
812 /// digits to look for is equal to Digits.size().
813 ///
814 /// \return True if the entire string was parsed and there are
815 /// no extra characters remaining at the end.
816 static bool GetReleaseVersion(StringRef Str,
818 /// Compute the default -fmodule-cache-path.
819 /// \return True if the system provides a default cache directory.
821};
822
823/// \return True if the last defined optimization level is -Ofast.
824/// And False otherwise.
825bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
826
827/// \return True if the argument combination will end up generating remarks.
828bool willEmitRemarks(const llvm::opt::ArgList &Args);
829
830/// Returns the driver mode option's value, i.e. `X` in `--driver-mode=X`. If \p
831/// Args doesn't mention one explicitly, tries to deduce from `ProgName`.
832/// Returns empty on failure.
833/// Common values are "gcc", "g++", "cpp", "cl" and "flang". Returned value need
834/// not be one of these.
835llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef<const char *> Args);
836
837/// Checks whether the value produced by getDriverMode is for CL mode.
838bool IsClangCL(StringRef DriverMode);
839
840/// Expand response files from a clang driver or cc1 invocation.
841///
842/// \param Args The arguments that will be expanded.
843/// \param ClangCLMode Whether clang is in CL mode.
844/// \param Alloc Allocator for new arguments.
845/// \param FS Filesystem to use when expanding files.
847 bool ClangCLMode, llvm::BumpPtrAllocator &Alloc,
848 llvm::vfs::FileSystem *FS = nullptr);
849
850/// Apply a space separated list of edits to the input argument lists.
851/// See applyOneOverrideOption.
853 const char *OverrideOpts,
854 llvm::StringSet<> &SavedStrings,
855 raw_ostream *OS = nullptr);
856
857} // end namespace driver
858} // end namespace clang
859
860#endif
static char ID
Definition: Arena.cpp:183
Defines the Diagnostic-related interfaces.
enum clang::sema::@1655::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:4753
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:2458
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:4576
void PrintHelp(bool ShowHidden) const
PrintHelp - Print the help text.
Definition: Driver.cpp:1995
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:4474
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:4896
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:5431
std::string GetFilePath(StringRef Name, const ToolChain &TC) const
GetFilePath - Lookup Name in the list of file search paths.
Definition: Driver.cpp:6152
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:2442
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:5879
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:6310
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:5768
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:6593
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:2637
static bool getDefaultModuleCachePath(SmallVectorImpl< char > &Result)
Compute the default -fmodule-cache-path.
Definition: Clang.cpp:3951
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
Definition: Driver.h:264
bool HandleImmediateArgs(Compilation &C)
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding...
Definition: Driver.cpp:2134
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:1913
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:6605
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:6321
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:5817
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:4112
bool offloadHostOnly() const
Definition: Driver.h:434
ModuleHeaderMode getModuleHeaderMode() const
Get the mode for handling headers as set by fmodule-header{=}.
Definition: Driver.h:715
void generateCompilationDiagnostics(Compilation &C, const Command &FailingCommand, StringRef AdditionalInformation="", CompilationDiagnosticReport *GeneratedReport=nullptr)
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(...
Definition: Driver.cpp:1667
bool hasHeaderMode() const
Returns true if the user has indicated a C++20 header unit mode.
Definition: Driver.h:712
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:2004
bool ShouldUseFlangCompiler(const JobAction &JA) const
ShouldUseFlangCompiler - Should the flang compiler be used to handle this action.
Definition: Driver.cpp:6579
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:2546
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
LTOKind getOffloadLTOMode() const
Get the specific kind of offload LTO being performed.
Definition: Driver.h:727
bool isUsingOffloadLTO() const
Returns true if we are performing any kind of offload LTO.
Definition: Driver.h:724
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:6212
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:2047
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:6564
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:6299
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
bool isUsingLTO() const
Returns true if we are performing any kind of LTO.
Definition: Driver.h:718
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:6254
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:1204
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
LTOKind getLTOMode() const
Get the specific kind of LTO being performed.
Definition: Driver.h:721
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:6893
llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef< const char * > Args)
Returns the driver mode option's value, i.e.
Definition: Driver.cpp:6722
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:6739
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:6737
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