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