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