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