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