clang  15.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 
12 #include "clang/Basic/Diagnostic.h"
13 #include "clang/Basic/LLVM.h"
14 #include "clang/Driver/Action.h"
16 #include "clang/Driver/InputInfo.h"
17 #include "clang/Driver/Options.h"
18 #include "clang/Driver/Phases.h"
19 #include "clang/Driver/ToolChain.h"
20 #include "clang/Driver/Types.h"
21 #include "clang/Driver/Util.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Option/Arg.h"
25 #include "llvm/Option/ArgList.h"
26 #include "llvm/Support/StringSaver.h"
27 
28 #include <list>
29 #include <map>
30 #include <string>
31 
32 namespace llvm {
33 class Triple;
34 namespace vfs {
35 class FileSystem;
36 }
37 } // namespace llvm
38 
39 namespace clang {
40 
41 namespace driver {
42 
44 
45 class Command;
46 class Compilation;
47 class JobList;
48 class JobAction;
49 class SanitizerArgs;
50 class ToolChain;
51 
52 /// Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
53 enum LTOKind {
58 };
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.
68 };
69 
70 /// Driver - Encapsulate logic for constructing compilation processes
71 /// from a set of gcc-driver-like command line arguments.
72 class Driver {
73  DiagnosticsEngine &Diags;
74 
76 
77  enum DriverMode {
78  GCCMode,
79  GXXMode,
80  CPPMode,
81  CLMode,
82  FlangMode,
83  DXCMode
84  } Mode;
85 
86  enum SaveTempsMode {
87  SaveTempsNone,
88  SaveTempsCwd,
89  SaveTempsObj
90  } SaveTemps;
91 
92  enum BitcodeEmbedMode {
93  EmbedNone,
94  EmbedMarker,
95  EmbedBitcode
96  } BitcodeEmbed;
97 
98  enum OffloadMode {
99  OffloadHostDevice,
100  OffloadHost,
101  OffloadDevice,
102  } Offload;
103 
104  /// Header unit mode set by -fmodule-header={user,system}.
105  ModuleHeaderMode CXX20HeaderType;
106 
107  /// Set if we should process inputs and jobs with C++20 module
108  /// interpretation.
109  bool ModulesModeCXX20;
110 
111  /// LTO mode selected via -f(no-)?lto(=.*)? options.
112  LTOKind LTOMode;
113 
114  /// LTO mode selected via -f(no-offload-)?lto(=.*)? options.
115  LTOKind OffloadLTOMode;
116 
117 public:
119  /// An unknown OpenMP runtime. We can't generate effective OpenMP code
120  /// without knowing what runtime to target.
122 
123  /// The LLVM OpenMP runtime. When completed and integrated, this will become
124  /// the default for Clang.
126 
127  /// The GNU OpenMP runtime. Clang doesn't support generating OpenMP code for
128  /// this runtime but can swallow the pragmas, and find and link against the
129  /// runtime library itself.
131 
132  /// The legacy name for the LLVM OpenMP runtime from when it was the Intel
133  /// OpenMP runtime. We support this mode for users with existing
134  /// dependencies on this runtime library name.
136  };
137 
138  // Diag - Forwarding function for diagnostics.
139  DiagnosticBuilder Diag(unsigned DiagID) const {
140  return Diags.Report(DiagID);
141  }
142 
143  // FIXME: Privatize once interface is stable.
144 public:
145  /// The name the driver was invoked as.
147 
148  /// The path the driver executable was in, as invoked from the
149  /// command line.
151 
152  /// The original path to the clang executable.
154 
155  /// Target and driver mode components extracted from clang executable name.
157 
158  /// The path to the installed clang directory, if any.
160 
161  /// The path to the compiler resource directory.
163 
164  /// System directory for config files.
166 
167  /// User directory for config files.
169 
170  /// A prefix directory used to emulate a limited subset of GCC's '-Bprefix'
171  /// functionality.
172  /// FIXME: This type of customization should be removed in favor of the
173  /// universal driver when it is ready.
176 
177  /// sysroot, if present
179 
180  /// Dynamic loader prefix, if present
182 
183  /// Driver title to use with help.
185 
186  /// Information about the host which can be overridden by the user.
188 
189  /// The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
191 
192  /// The file to log CC_PRINT_OPTIONS output to, if enabled.
194 
195  /// The file to log CC_PRINT_HEADERS output to, if enabled.
197 
198  /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
200 
201  /// An input type and its arguments.
202  using InputTy = std::pair<types::ID, const llvm::opt::Arg *>;
203 
204  /// A list of inputs and their types for the given arguments.
206 
207  /// Whether the driver should follow g++ like behavior.
208  bool CCCIsCXX() const { return Mode == GXXMode; }
209 
210  /// Whether the driver is just the preprocessor.
211  bool CCCIsCPP() const { return Mode == CPPMode; }
212 
213  /// Whether the driver should follow gcc like behavior.
214  bool CCCIsCC() const { return Mode == GCCMode; }
215 
216  /// Whether the driver should follow cl.exe like behavior.
217  bool IsCLMode() const { return Mode == CLMode; }
218 
219  /// Whether the driver should invoke flang for fortran inputs.
220  /// Other modes fall back to calling gcc which in turn calls gfortran.
221  bool IsFlangMode() const { return Mode == FlangMode; }
222 
223  /// Whether the driver should follow dxc.exe like behavior.
224  bool IsDXCMode() const { return Mode == DXCMode; }
225 
226  /// Only print tool bindings, don't build any jobs.
227  unsigned CCCPrintBindings : 1;
228 
229  /// Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to
230  /// CCPrintOptionsFilename or to stderr.
231  unsigned CCPrintOptions : 1;
232 
233  /// Set CC_PRINT_HEADERS mode, which causes the frontend to log header include
234  /// information to CCPrintHeadersFilename or to stderr.
235  unsigned CCPrintHeaders : 1;
236 
237  /// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics
238  /// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable
239  /// format.
240  unsigned CCLogDiagnostics : 1;
241 
242  /// Whether the driver is generating diagnostics for debugging purposes.
243  unsigned CCGenDiagnostics : 1;
244 
245  /// Set CC_PRINT_PROC_STAT mode, which causes the driver to dump
246  /// performance report to CC_PRINT_PROC_STAT_FILE or to stdout.
247  unsigned CCPrintProcessStats : 1;
248 
249  /// Pointer to the ExecuteCC1Tool function, if available.
250  /// When the clangDriver lib is used through clang.exe, this provides a
251  /// shortcut for executing the -cc1 command-line directly, in the same
252  /// process.
254  CC1ToolFunc CC1Main = nullptr;
255 
256 private:
257  /// Raw target triple.
258  std::string TargetTriple;
259 
260  /// Name to use when invoking gcc/g++.
261  std::string CCCGenericGCCName;
262 
263  /// Name of configuration file if used.
264  std::string ConfigFile;
265 
266  /// Allocator for string saver.
267  llvm::BumpPtrAllocator Alloc;
268 
269  /// Object that stores strings read from configuration file.
270  llvm::StringSaver Saver;
271 
272  /// Arguments originated from configuration file.
273  std::unique_ptr<llvm::opt::InputArgList> CfgOptions;
274 
275  /// Arguments originated from command line.
276  std::unique_ptr<llvm::opt::InputArgList> CLOptions;
277 
278  /// Whether to check that input files exist when constructing compilation
279  /// jobs.
280  unsigned CheckInputsExist : 1;
281  /// Whether to probe for PCH files on disk, in order to upgrade
282  /// -include foo.h to -include-pch foo.h.pch.
283  unsigned ProbePrecompiled : 1;
284 
285 public:
286  // getFinalPhase - Determine which compilation mode we are in and record
287  // which option we used to determine the final phase.
288  // TODO: Much of what getFinalPhase returns are not actually true compiler
289  // modes. Fold this functionality into Types::getCompilationPhases and
290  // handleArguments.
291  phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
292  llvm::opt::Arg **FinalPhaseArg = nullptr) const;
293 
294 private:
295  /// Certain options suppress the 'no input files' warning.
296  unsigned SuppressMissingInputWarning : 1;
297 
298  /// Cache of all the ToolChains in use by the driver.
299  ///
300  /// This maps from the string representation of a triple to a ToolChain
301  /// created targeting that triple. The driver owns all the ToolChain objects
302  /// stored in it, and will clean them up when torn down.
303  mutable llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains;
304 
305  /// Cache of known offloading architectures for the ToolChain already derived.
306  /// This should only be modified when we first initialize the offloading
307  /// toolchains.
308  llvm::DenseMap<const ToolChain *, llvm::DenseSet<llvm::StringRef>> KnownArchs;
309 
310 private:
311  /// TranslateInputArgs - Create a new derived argument list from the input
312  /// arguments, after applying the standard argument translations.
313  llvm::opt::DerivedArgList *
314  TranslateInputArgs(const llvm::opt::InputArgList &Args) const;
315 
316  // handleArguments - All code related to claiming and printing diagnostics
317  // related to arguments to the driver are done here.
318  void handleArguments(Compilation &C, llvm::opt::DerivedArgList &Args,
319  const InputList &Inputs, ActionList &Actions) const;
320 
321  // Before executing jobs, sets up response files for commands that need them.
322  void setUpResponseFiles(Compilation &C, Command &Cmd);
323 
324  void generatePrefixedToolNames(StringRef Tool, const ToolChain &TC,
325  SmallVectorImpl<std::string> &Names) const;
326 
327  /// Find the appropriate .crash diagonostic file for the child crash
328  /// under this driver and copy it out to a temporary destination with the
329  /// other reproducer related files (.sh, .cache, etc). If not found, suggest a
330  /// directory for the user to look at.
331  ///
332  /// \param ReproCrashFilename The file path to copy the .crash to.
333  /// \param CrashDiagDir The suggested directory for the user to look at
334  /// in case the search or copy fails.
335  ///
336  /// \returns If the .crash is found and successfully copied return true,
337  /// otherwise false and return the suggested directory in \p CrashDiagDir.
338  bool getCrashDiagnosticFile(StringRef ReproCrashFilename,
339  SmallString<128> &CrashDiagDir);
340 
341 public:
342 
343  /// Takes the path to a binary that's either in bin/ or lib/ and returns
344  /// the path to clang's resource directory.
345  static std::string GetResourcesPath(StringRef BinaryPath,
346  StringRef CustomResourceDir = "");
347 
348  Driver(StringRef ClangExecutable, StringRef TargetTriple,
349  DiagnosticsEngine &Diags, std::string Title = "clang LLVM compiler",
351 
352  /// @name Accessors
353  /// @{
354 
355  /// Name to use when invoking gcc/g++.
356  const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
357 
358  const std::string &getConfigFile() const { return ConfigFile; }
359 
360  const llvm::opt::OptTable &getOpts() const { return getDriverOptTable(); }
361 
362  DiagnosticsEngine &getDiags() const { return Diags; }
363 
364  llvm::vfs::FileSystem &getVFS() const { return *VFS; }
365 
366  bool getCheckInputsExist() const { return CheckInputsExist; }
367 
368  void setCheckInputsExist(bool Value) { CheckInputsExist = Value; }
369 
370  bool getProbePrecompiled() const { return ProbePrecompiled; }
371  void setProbePrecompiled(bool Value) { ProbePrecompiled = Value; }
372 
374 
375  const std::string &getTitle() { return DriverTitle; }
376  void setTitle(std::string Value) { DriverTitle = std::move(Value); }
377 
378  std::string getTargetTriple() const { return TargetTriple; }
379 
380  /// Get the path to the main clang executable.
381  const char *getClangProgramPath() const {
382  return ClangExecutable.c_str();
383  }
384 
385  /// Get the path to where the clang executable was installed.
386  const char *getInstalledDir() const {
387  if (!InstalledDir.empty())
388  return InstalledDir.c_str();
389  return Dir.c_str();
390  }
392 
393  bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
394  bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
395 
396  bool embedBitcodeEnabled() const { return BitcodeEmbed != EmbedNone; }
397  bool embedBitcodeInObject() const { return (BitcodeEmbed == EmbedBitcode); }
398  bool embedBitcodeMarkerOnly() const { return (BitcodeEmbed == EmbedMarker); }
399 
400  bool offloadHostOnly() const { return Offload == OffloadHost; }
401  bool offloadDeviceOnly() const { return Offload == OffloadDevice; }
402 
403  /// Compute the desired OpenMP runtime from the flags provided.
404  OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const;
405 
406  /// @}
407  /// @name Primary Functionality
408  /// @{
409 
410  /// CreateOffloadingDeviceToolChains - create all the toolchains required to
411  /// support offloading devices given the programming models specified in the
412  /// current compilation. Also, update the host tool chain kind accordingly.
414 
415  /// BuildCompilation - Construct a compilation object for a command
416  /// line argument vector.
417  ///
418  /// \return A compilation, or 0 if none was built for the given
419  /// argument vector. A null return value does not necessarily
420  /// indicate an error condition, the diagnostics should be queried
421  /// to determine if an error occurred.
423 
424  /// ParseArgStrings - Parse the given list of strings into an
425  /// ArgList.
426  llvm::opt::InputArgList ParseArgStrings(ArrayRef<const char *> Args,
427  bool IsClCompatMode,
428  bool &ContainsError);
429 
430  /// BuildInputs - Construct the list of inputs and their types from
431  /// the given arguments.
432  ///
433  /// \param TC - The default host tool chain.
434  /// \param Args - The input arguments.
435  /// \param Inputs - The list to store the resulting compilation
436  /// inputs onto.
437  void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args,
438  InputList &Inputs) const;
439 
440  /// BuildActions - Construct the list of actions to perform for the
441  /// given arguments, which are only done for a single architecture.
442  ///
443  /// \param C - The compilation that is being built.
444  /// \param Args - The input arguments.
445  /// \param Actions - The list to store the resulting actions onto.
446  void BuildActions(Compilation &C, llvm::opt::DerivedArgList &Args,
447  const InputList &Inputs, ActionList &Actions) const;
448 
449  /// BuildUniversalActions - Construct the list of actions to perform
450  /// for the given arguments, which may require a universal build.
451  ///
452  /// \param C - The compilation that is being built.
453  /// \param TC - The default host tool chain.
454  void BuildUniversalActions(Compilation &C, const ToolChain &TC,
455  const InputList &BAInputs) const;
456 
457  /// BuildOffloadingActions - Construct the list of actions to perform for the
458  /// offloading toolchain that will be embedded in the host.
459  ///
460  /// \param C - The compilation that is being built.
461  /// \param Args - The input arguments.
462  /// \param Input - The input type and arguments
463  /// \param HostAction - The host action used in the offloading toolchain.
465  llvm::opt::DerivedArgList &Args,
466  const InputTy &Input,
467  Action *HostAction) const;
468 
469  /// Returns the set of bound architectures active for this offload kind.
470  /// If there are no bound architctures we return a set containing only the
471  /// empty string.
473  getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
474  Action::OffloadKind Kind, const ToolChain *TC) const;
475 
476  /// Check that the file referenced by Value exists. If it doesn't,
477  /// issue a diagnostic and return false.
478  /// If TypoCorrect is true and the file does not exist, see if it looks
479  /// like a likely typo for a flag and if so print a "did you mean" blurb.
480  bool DiagnoseInputExistence(const llvm::opt::DerivedArgList &Args,
481  StringRef Value, types::ID Ty,
482  bool TypoCorrect) const;
483 
484  /// BuildJobs - Bind actions to concrete tools and translate
485  /// arguments to form the list of jobs to run.
486  ///
487  /// \param C - The compilation that is being built.
488  void BuildJobs(Compilation &C) const;
489 
490  /// ExecuteCompilation - Execute the compilation according to the command line
491  /// arguments and return an appropriate exit code.
492  ///
493  /// This routine handles additional processing that must be done in addition
494  /// to just running the subprocesses, for example reporting errors, setting
495  /// up response files, removing temporary files, etc.
497  SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands);
498 
499  /// Contains the files in the compilation diagnostic report generated by
500  /// generateCompilationDiagnostics.
503  };
504 
505  /// generateCompilationDiagnostics - Generate diagnostics information
506  /// including preprocessed source file(s).
507  ///
509  Compilation &C, const Command &FailingCommand,
510  StringRef AdditionalInformation = "",
511  CompilationDiagnosticReport *GeneratedReport = nullptr);
512 
513  enum class CommandStatus {
514  Crash = 1,
515  Error,
516  Ok,
517  };
518 
519  enum class ReproLevel {
520  Off = 0,
521  OnCrash = static_cast<int>(CommandStatus::Crash),
522  OnError = static_cast<int>(CommandStatus::Error),
523  Always = static_cast<int>(CommandStatus::Ok),
524  };
525 
528  const Command &FailingCommand, StringRef AdditionalInformation = "",
529  CompilationDiagnosticReport *GeneratedReport = nullptr) {
530  if (static_cast<int>(CS) > static_cast<int>(Level))
531  return false;
532  if (CS != CommandStatus::Crash)
533  Diags.Report(diag::err_drv_force_crash)
534  << !::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH");
535  // Hack to ensure that diagnostic notes get emitted.
536  Diags.setLastDiagnosticIgnored(false);
537  generateCompilationDiagnostics(C, FailingCommand, AdditionalInformation,
538  GeneratedReport);
539  return true;
540  }
541 
542  /// @}
543  /// @name Helper Methods
544  /// @{
545 
546  /// PrintActions - Print the list of actions.
547  void PrintActions(const Compilation &C) const;
548 
549  /// PrintHelp - Print the help text.
550  ///
551  /// \param ShowHidden - Show hidden options.
552  void PrintHelp(bool ShowHidden) const;
553 
554  /// PrintVersion - Print the driver version.
555  void PrintVersion(const Compilation &C, raw_ostream &OS) const;
556 
557  /// GetFilePath - Lookup \p Name in the list of file search paths.
558  ///
559  /// \param TC - The tool chain for additional information on
560  /// directories to search.
561  //
562  // FIXME: This should be in CompilationInfo.
563  std::string GetFilePath(StringRef Name, const ToolChain &TC) const;
564 
565  /// GetProgramPath - Lookup \p Name in the list of program search paths.
566  ///
567  /// \param TC - The provided tool chain for additional information on
568  /// directories to search.
569  //
570  // FIXME: This should be in CompilationInfo.
571  std::string GetProgramPath(StringRef Name, const ToolChain &TC) const;
572 
573  /// HandleAutocompletions - Handle --autocomplete by searching and printing
574  /// possible flags, descriptions, and its arguments.
575  void HandleAutocompletions(StringRef PassedFlags) const;
576 
577  /// HandleImmediateArgs - Handle any arguments which should be
578  /// treated before building actions or binding tools.
579  ///
580  /// \return Whether any compilation should be built for this
581  /// invocation.
582  bool HandleImmediateArgs(const Compilation &C);
583 
584  /// ConstructAction - Construct the appropriate action to do for
585  /// \p Phase on the \p Input, taking in to account arguments
586  /// like -fsyntax-only or --analyze.
588  Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase,
589  Action *Input,
590  Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None) const;
591 
592  /// BuildJobsForAction - Construct the jobs to perform for the action \p A and
593  /// return an InputInfo for the result of running \p A. Will only construct
594  /// jobs for a given (Action, ToolChain, BoundArch, DeviceKind) tuple once.
596  Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
597  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
598  std::map<std::pair<const Action *, std::string>, InputInfoList>
599  &CachedResults,
600  Action::OffloadKind TargetDeviceOffloadKind) const;
601 
602  /// Returns the default name for linked images (e.g., "a.out").
603  const char *getDefaultImageName() const;
604 
605  /// GetNamedOutputPath - Return the name to use for the output of
606  /// the action \p JA. The result is appended to the compilation's
607  /// list of temporary or result files, as appropriate.
608  ///
609  /// \param C - The compilation.
610  /// \param JA - The action of interest.
611  /// \param BaseInput - The original input file that this action was
612  /// triggered by.
613  /// \param BoundArch - The bound architecture.
614  /// \param AtTopLevel - Whether this is a "top-level" action.
615  /// \param MultipleArchs - Whether multiple -arch options were supplied.
616  /// \param NormalizedTriple - The normalized triple of the relevant target.
617  const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
618  const char *BaseInput, StringRef BoundArch,
619  bool AtTopLevel, bool MultipleArchs,
620  StringRef NormalizedTriple) const;
621 
622  /// GetTemporaryPath - Return the pathname of a temporary file to use
623  /// as part of compilation; the file will have the given prefix and suffix.
624  ///
625  /// GCC goes to extra lengths here to be a bit more robust.
626  std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
627 
628  /// GetTemporaryDirectory - Return the pathname of a temporary directory to
629  /// use as part of compilation; the directory will have the given prefix.
630  std::string GetTemporaryDirectory(StringRef Prefix) const;
631 
632  /// Return the pathname of the pch file in clang-cl mode.
633  std::string GetClPchPath(Compilation &C, StringRef BaseName) const;
634 
635  /// ShouldUseClangCompiler - Should the clang compiler be used to
636  /// handle this action.
637  bool ShouldUseClangCompiler(const JobAction &JA) const;
638 
639  /// ShouldUseFlangCompiler - Should the flang compiler be used to
640  /// handle this action.
641  bool ShouldUseFlangCompiler(const JobAction &JA) const;
642 
643  /// ShouldEmitStaticLibrary - Should the linker emit a static library.
644  bool ShouldEmitStaticLibrary(const llvm::opt::ArgList &Args) const;
645 
646  /// Returns true if the user has indicated a C++20 header unit mode.
647  bool hasHeaderMode() const { return CXX20HeaderType != HeaderMode_None; }
648 
649  /// Get the mode for handling headers as set by fmodule-header{=}.
650  ModuleHeaderMode getModuleHeaderMode() const { return CXX20HeaderType; }
651 
652  /// Returns true if we are performing any kind of LTO.
653  bool isUsingLTO(bool IsOffload = false) const {
654  return getLTOMode(IsOffload) != LTOK_None;
655  }
656 
657  /// Get the specific kind of LTO being performed.
658  LTOKind getLTOMode(bool IsOffload = false) const {
659  return IsOffload ? OffloadLTOMode : LTOMode;
660  }
661 
662 private:
663 
664  /// Tries to load options from configuration file.
665  ///
666  /// \returns true if error occurred.
667  bool loadConfigFile();
668 
669  /// Read options from the specified file.
670  ///
671  /// \param [in] FileName File to read.
672  /// \returns true, if error occurred while reading.
673  bool readConfigFile(StringRef FileName);
674 
675  /// Set the driver mode (cl, gcc, etc) from the value of the `--driver-mode`
676  /// option.
677  void setDriverMode(StringRef DriverModeValue);
678 
679  /// Parse the \p Args list for LTO options and record the type of LTO
680  /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
681  void setLTOMode(const llvm::opt::ArgList &Args);
682 
683  /// Retrieves a ToolChain for a particular \p Target triple.
684  ///
685  /// Will cache ToolChains for the life of the driver object, and create them
686  /// on-demand.
687  const ToolChain &getToolChain(const llvm::opt::ArgList &Args,
688  const llvm::Triple &Target) const;
689 
690  /// @}
691 
692  /// Retrieves a ToolChain for a particular device \p Target triple
693  ///
694  /// \param[in] HostTC is the host ToolChain paired with the device
695  ///
696  /// \param[in] TargetDeviceOffloadKind (e.g. OFK_Cuda/OFK_OpenMP/OFK_SYCL) is
697  /// an Offloading action that is optionally passed to a ToolChain (used by
698  /// CUDA, to specify if it's used in conjunction with OpenMP)
699  ///
700  /// Will cache ToolChains for the life of the driver object, and create them
701  /// on-demand.
702  const ToolChain &getOffloadingDeviceToolChain(
703  const llvm::opt::ArgList &Args, const llvm::Triple &Target,
704  const ToolChain &HostTC,
705  const Action::OffloadKind &TargetDeviceOffloadKind) const;
706 
707  /// Get bitmasks for which option flags to include and exclude based on
708  /// the driver mode.
709  std::pair<unsigned, unsigned> getIncludeExcludeOptionFlagMasks(bool IsClCompatMode) const;
710 
711  /// Helper used in BuildJobsForAction. Doesn't use the cache when building
712  /// jobs specifically for the given action, but will use the cache when
713  /// building jobs for the Action's inputs.
714  InputInfoList BuildJobsForActionNoCache(
715  Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
716  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
717  std::map<std::pair<const Action *, std::string>, InputInfoList>
718  &CachedResults,
719  Action::OffloadKind TargetDeviceOffloadKind) const;
720 
721 public:
722  /// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
723  /// return the grouped values as integers. Numbers which are not
724  /// provided are set to 0.
725  ///
726  /// \return True if the entire string was parsed (9.2), or all
727  /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
728  /// groups were parsed but extra characters remain at the end.
729  static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor,
730  unsigned &Micro, bool &HadExtra);
731 
732  /// Parse digits from a string \p Str and fulfill \p Digits with
733  /// the parsed numbers. This method assumes that the max number of
734  /// digits to look for is equal to Digits.size().
735  ///
736  /// \return True if the entire string was parsed and there are
737  /// no extra characters remaining at the end.
738  static bool GetReleaseVersion(StringRef Str,
740  /// Compute the default -fmodule-cache-path.
741  /// \return True if the system provides a default cache directory.
743 };
744 
745 /// \return True if the last defined optimization level is -Ofast.
746 /// And False otherwise.
747 bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
748 
749 /// \return True if the argument combination will end up generating remarks.
750 bool willEmitRemarks(const llvm::opt::ArgList &Args);
751 
752 /// Returns the driver mode option's value, i.e. `X` in `--driver-mode=X`. If \p
753 /// Args doesn't mention one explicitly, tries to deduce from `ProgName`.
754 /// Returns empty on failure.
755 /// Common values are "gcc", "g++", "cpp", "cl" and "flang". Returned value need
756 /// not be one of these.
757 llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef<const char *> Args);
758 
759 /// Checks whether the value produced by getDriverMode is for CL mode.
760 bool IsClangCL(StringRef DriverMode);
761 
762 } // end namespace driver
763 } // end namespace clang
764 
765 #endif
clang::driver::Driver::InputList
SmallVector< InputTy, 16 > InputList
A list of inputs and their types for the given arguments.
Definition: Driver.h:205
clang::driver::Driver::embedBitcodeEnabled
bool embedBitcodeEnabled() const
Definition: Driver.h:396
clang::driver::Driver::BuildJobsForAction
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:5126
Util.h
clang::driver::Driver::GetProgramPath
std::string GetProgramPath(StringRef Name, const ToolChain &TC) const
GetProgramPath - Lookup Name in the list of program search paths.
Definition: Driver.cpp:5801
clang::driver::Driver::HostRelease
std::string HostRelease
Definition: Driver.h:187
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::driver::isOptimizationLevelFast
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
clang::driver::Driver::PrefixDirs
prefix_list PrefixDirs
Definition: Driver.h:175
clang::driver::Driver::GetNamedOutputPath
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:5509
clang::DiagnosticBuilder
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:1266
clang::driver::ParsedClangName
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:64
clang::driver::Driver::getCheckInputsExist
bool getCheckInputsExist() const
Definition: Driver.h:366
clang::driver::Driver::CompilationDiagnosticReport
Contains the files in the compilation diagnostic report generated by generateCompilationDiagnostics.
Definition: Driver.h:501
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::Driver::Dir
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition: Driver.h:150
clang::driver::LTOK_None
@ LTOK_None
Definition: Driver.h:54
clang::driver::Driver::DiagnoseInputExistence
bool DiagnoseInputExistence(const llvm::opt::DerivedArgList &Args, StringRef Value, types::ID Ty, bool TypoCorrect) const
Check that the file referenced by Value exists.
Definition: Driver.cpp:2331
clang::driver::Driver::PrintVersion
void PrintVersion(const Compilation &C, raw_ostream &OS) const
PrintVersion - Print the driver version.
Definition: Driver.cpp:1810
clang::driver::Driver::IsCLMode
bool IsCLMode() const
Whether the driver should follow cl.exe like behavior.
Definition: Driver.h:217
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::Driver::hasHeaderMode
bool hasHeaderMode() const
Returns true if the user has indicated a C++20 header unit mode.
Definition: Driver.h:647
clang::driver::Action
Action - Represent an abstract compilation step to perform.
Definition: Action.h:47
clang::driver::Driver::maybeGenerateCompilationDiagnostics
bool maybeGenerateCompilationDiagnostics(CommandStatus CS, ReproLevel Level, Compilation &C, const Command &FailingCommand, StringRef AdditionalInformation="", CompilationDiagnosticReport *GeneratedReport=nullptr)
Definition: Driver.h:526
clang::driver::Driver::getOffloadArchs
llvm::DenseSet< 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:4338
clang::driver::HeaderMode_User
@ HeaderMode_User
Definition: Driver.h:66
clang::driver::Driver::generateCompilationDiagnostics
void generateCompilationDiagnostics(Compilation &C, const Command &FailingCommand, StringRef AdditionalInformation="", CompilationDiagnosticReport *GeneratedReport=nullptr)
generateCompilationDiagnostics - Generate diagnostics information including preprocessed source file(...
Definition: Driver.cpp:1504
clang::driver::Driver::getModuleHeaderMode
ModuleHeaderMode getModuleHeaderMode() const
Get the mode for handling headers as set by fmodule-header{=}.
Definition: Driver.h:650
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::driver::phases::ID
ID
ID - Ordered values for successive stages in the compilation process which interact with user options...
Definition: Phases.h:17
clang::driver::Driver::embedBitcodeInObject
bool embedBitcodeInObject() const
Definition: Driver.h:397
int
__device__ int
Definition: __clang_hip_libdevice_declares.h:63
clang::driver::Driver::InputTy
std::pair< types::ID, const llvm::opt::Arg * > InputTy
An input type and its arguments.
Definition: Driver.h:202
clang::driver::InputInfoList
SmallVector< InputInfo, 4 > InputInfoList
Definition: Driver.h:43
clang::driver::Driver::CCPrintOptionsFilename
std::string CCPrintOptionsFilename
The file to log CC_PRINT_OPTIONS output to, if enabled.
Definition: Driver.h:193
clang::driver::Driver::OpenMPRuntimeKind
OpenMPRuntimeKind
Definition: Driver.h:118
clang::driver::Driver::BuildActions
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:4000
clang::driver::Driver::getConfigFile
const std::string & getConfigFile() const
Definition: Driver.h:358
clang::driver::Driver::getDefaultModuleCachePath
static bool getDefaultModuleCachePath(SmallVectorImpl< char > &Result)
Compute the default -fmodule-cache-path.
Definition: Clang.cpp:3600
clang::driver::Driver::CommandStatus
CommandStatus
Definition: Driver.h:513
clang::DiagnosticsEngine::setLastDiagnosticIgnored
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition: Diagnostic.h:756
clang::driver::Driver::getOpenMPRuntime
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const
Compute the desired OpenMP runtime from the flags provided.
Definition: Driver.cpp:700
clang::driver::Driver::getOpts
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:360
clang::driver::Driver::getDiags
DiagnosticsEngine & getDiags() const
Definition: Driver.h:362
clang::driver::Driver::PrintActions
void PrintActions(const Compilation &C) const
PrintActions - Print the list of actions.
Definition: Driver.cpp:2227
InputInfo.h
clang::driver::Driver::InstalledDir
std::string InstalledDir
The path to the installed clang directory, if any.
Definition: Driver.h:159
Action.h
clang::driver::Driver::DriverTitle
std::string DriverTitle
Driver title to use with help.
Definition: Driver.h:184
llvm::MutableArrayRef
Definition: LLVM.h:35
clang::driver::Driver::isSaveTempsEnabled
bool isSaveTempsEnabled() const
Definition: Driver.h:393
clang::driver::Driver::getLTOMode
LTOKind getLTOMode(bool IsOffload=false) const
Get the specific kind of LTO being performed.
Definition: Driver.h:658
clang::driver::Driver::Diag
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:139
clang::driver::Driver::CCCPrintBindings
unsigned CCCPrintBindings
Only print tool bindings, don't build any jobs.
Definition: Driver.h:227
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::getDriverOptTable
const llvm::opt::OptTable & getDriverOptTable()
Definition: DriverOptions.cpp:42
clang::driver::Driver::CCCIsCC
bool CCCIsCC() const
Whether the driver should follow gcc like behavior.
Definition: Driver.h:214
Options.h
clang::driver::Driver::ConstructPhaseAction
Action * ConstructPhaseAction(Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase, Action *Input, Action::OffloadKind TargetDeviceOffloadKind=Action::OFK_None) const
ConstructAction - Construct the appropriate action to do for Phase on the Input, taking in to account...
Definition: Driver.cpp:4492
clang::driver::Driver::CCCIsCPP
bool CCCIsCPP() const
Whether the driver is just the preprocessor.
Definition: Driver.h:211
clang::driver::Driver::CCPrintOptions
unsigned CCPrintOptions
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to std...
Definition: Driver.h:231
clang::driver::Driver::CommandStatus::Ok
@ Ok
clang::driver::Driver::ReproLevel::OnError
@ OnError
clang::driver::LTOK_Thin
@ LTOK_Thin
Definition: Driver.h:56
clang::driver::Driver::Name
std::string Name
The name the driver was invoked as.
Definition: Driver.h:146
Diagnostic.h
DriverDiagnostic.h
clang::driver::Driver::ParseArgStrings
llvm::opt::InputArgList ParseArgStrings(ArrayRef< const char * > Args, bool IsClCompatMode, bool &ContainsError)
ParseArgStrings - Parse the given list of strings into an ArgList.
Definition: Driver.cpp:245
clang::driver::Driver::HostBits
std::string HostBits
Information about the host which can be overridden by the user.
Definition: Driver.h:187
clang::driver::Driver::SystemConfigDir
std::string SystemConfigDir
System directory for config files.
Definition: Driver.h:165
clang::driver::Driver::CCPrintHeaders
unsigned CCPrintHeaders
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHead...
Definition: Driver.h:235
clang::driver::Driver::Driver
Driver(StringRef ClangExecutable, StringRef TargetTriple, DiagnosticsEngine &Diags, std::string Title="clang LLVM compiler", IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr)
Definition: Driver.cpp:190
clang::driver::Driver::BuildOffloadingActions
Action * BuildOffloadingActions(Compilation &C, llvm::opt::DerivedArgList &Args, const InputTy &Input, Action *HostAction) const
BuildOffloadingActions - Construct the list of actions to perform for the offloading toolchain that w...
Definition: Driver.cpp:4393
clang::driver::Driver::OMPRT_IOMP5
@ OMPRT_IOMP5
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
Definition: Driver.h:135
clang::driver::JobList
JobList - A sequence of jobs to perform.
Definition: Job.h:267
llvm::SmallString< 128 >
clang::driver::Driver::CommandStatus::Crash
@ Crash
clang::driver::HeaderMode_System
@ HeaderMode_System
Definition: Driver.h:67
clang::driver::Driver::SysRoot
std::string SysRoot
sysroot, if present
Definition: Driver.h:178
clang::driver::Driver::ReproLevel::Off
@ Off
clang::driver::Driver::ShouldEmitStaticLibrary
bool ShouldEmitStaticLibrary(const llvm::opt::ArgList &Args) const
ShouldEmitStaticLibrary - Should the linker emit a static library.
Definition: Driver.cpp:6147
llvm::DenseSet
Definition: Sema.h:77
clang::driver::Driver::CCCIsCXX
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition: Driver.h:208
clang::driver::Driver::OMPRT_OMP
@ OMPRT_OMP
The LLVM OpenMP runtime.
Definition: Driver.h:125
clang::driver::Driver::getCCCGenericGCCName
const std::string & getCCCGenericGCCName() const
Name to use when invoking gcc/g++.
Definition: Driver.h:356
clang::driver::Driver::getTitle
const std::string & getTitle()
Definition: Driver.h:375
clang::driver::Action::OFK_None
@ OFK_None
Definition: Action.h:89
clang::driver::LTOK_Full
@ LTOK_Full
Definition: Driver.h:55
Phases.h
clang::driver::SanitizerArgs
Definition: SanitizerArgs.h:24
clang::driver::Driver::offloadDeviceOnly
bool offloadDeviceOnly() const
Definition: Driver.h:401
clang::driver::Driver::CCLogDiagnostics
unsigned CCLogDiagnostics
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename...
Definition: Driver.h:240
clang::driver::Driver::CC1ToolFunc
int(* CC1ToolFunc)(SmallVectorImpl< const char * > &ArgV)
Pointer to the ExecuteCC1Tool function, if available.
Definition: Driver.h:253
Cmd
CompileCommand Cmd
Definition: InterpolatingCompilationDatabase.cpp:130
clang::driver::Driver::ResourceDir
std::string ResourceDir
The path to the compiler resource directory.
Definition: Driver.h:162
clang::driver::Driver::ExecuteCompilation
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:1705
clang::driver::Driver::getClangProgramPath
const char * getClangProgramPath() const
Get the path to the main clang executable.
Definition: Driver.h:381
clang::driver::Driver::CC1Main
CC1ToolFunc CC1Main
Definition: Driver.h:254
clang::driver::Driver::ReproLevel
ReproLevel
Definition: Driver.h:519
clang::driver::Driver::getFinalPhase
phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL, llvm::opt::Arg **FinalPhaseArg=nullptr) const
Definition: Driver.cpp:329
ToolChain.h
clang::driver::Driver::CreateOffloadingDeviceToolChains
void CreateOffloadingDeviceToolChains(Compilation &C, InputList &Inputs)
CreateOffloadingDeviceToolChains - create all the toolchains required to support offloading devices g...
Definition: Driver.cpp:725
clang::driver::Command
Command - An executable path/name and argument vector to execute.
Definition: Job.h:106
clang::driver::Driver::embedBitcodeMarkerOnly
bool embedBitcodeMarkerOnly() const
Definition: Driver.h:398
clang::driver::LTOKind
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
Definition: Driver.h:53
clang::driver::Driver::ReproLevel::Always
@ Always
clang::driver::Driver::CCPrintStatReportFilename
std::string CCPrintStatReportFilename
The file to log CC_PRINT_PROC_STAT_FILE output to, if enabled.
Definition: Driver.h:190
clang::driver::Driver::isUsingLTO
bool isUsingLTO(bool IsOffload=false) const
Returns true if we are performing any kind of LTO.
Definition: Driver.h:653
clang::driver::Driver::ClangNameParts
ParsedClangName ClangNameParts
Target and driver mode components extracted from clang executable name.
Definition: Driver.h:156
clang::driver::Driver::ShouldUseFlangCompiler
bool ShouldUseFlangCompiler(const JobAction &JA) const
ShouldUseFlangCompiler - Should the flang compiler be used to handle this action.
Definition: Driver.cpp:6133
clang::driver::Driver::isSaveTempsObj
bool isSaveTempsObj() const
Definition: Driver.h:394
clang::driver::Driver::GetClPchPath
std::string GetClPchPath(Compilation &C, StringRef BaseName) const
Return the pathname of the pch file in clang-cl mode.
Definition: Driver.cpp:5865
clang::driver::Driver::GetTemporaryPath
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:5843
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::Driver::IsDXCMode
bool IsDXCMode() const
Whether the driver should follow dxc.exe like behavior.
Definition: Driver.h:224
llvm::ArrayRef< const char * >
clang::driver::Driver::getDefaultImageName
const char * getDefaultImageName() const
Returns the default name for linked images (e.g., "a.out").
Definition: Driver.cpp:5460
Value
Value
Definition: UninitializedValues.cpp:102
clang::driver::Driver::prefix_list
SmallVector< std::string, 4 > prefix_list
A prefix directory used to emulate a limited subset of GCC's '-Bprefix' functionality.
Definition: Driver.h:174
clang::driver::Driver::UserConfigDir
std::string UserConfigDir
User directory for config files.
Definition: Driver.h:168
LLVM.h
clang::driver::Driver::GetResourcesPath
static std::string GetResourcesPath(StringRef BinaryPath, StringRef CustomResourceDir="")
Takes the path to a binary that's either in bin/ or lib/ and returns the path to clang's resource dir...
Definition: Driver.cpp:164
clang::driver::Driver::setTargetAndMode
void setTargetAndMode(const ParsedClangName &TM)
Definition: Driver.h:373
clang::driver::Driver::BuildJobs
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:4613
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::LTOK_Unknown
@ LTOK_Unknown
Definition: Driver.h:57
clang::driver::Driver::CCLogDiagnosticsFilename
std::string CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
Definition: Driver.h:199
clang::driver::Driver::GetFilePath
std::string GetFilePath(StringRef Name, const ToolChain &TC) const
GetFilePath - Lookup Name in the list of file search paths.
Definition: Driver.cpp:5741
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::driver::willEmitRemarks
bool willEmitRemarks(const llvm::opt::ArgList &Args)
clang::driver::Driver::setProbePrecompiled
void setProbePrecompiled(bool Value)
Definition: Driver.h:371
clang::driver::Driver::CompilationDiagnosticReport::TemporaryFiles
llvm::SmallVector< std::string, 4 > TemporaryFiles
Definition: Driver.h:502
clang::driver::Driver::setInstalledDir
void setInstalledDir(StringRef Value)
Definition: Driver.h:391
clang::driver::ModuleHeaderMode
ModuleHeaderMode
Whether headers used to construct C++20 module units should be looked up by the path supplied on the ...
Definition: Driver.h:63
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver::offloadHostOnly
bool offloadHostOnly() const
Definition: Driver.h:400
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:72
clang::driver::Driver::getTargetTriple
std::string getTargetTriple() const
Definition: Driver.h:378
clang::driver::Driver::ShouldUseClangCompiler
bool ShouldUseClangCompiler(const JobAction &JA) const
ShouldUseClangCompiler - Should the clang compiler be used to handle this action.
Definition: Driver.cpp:6118
clang::driver::Driver::CCPrintHeadersFilename
std::string CCPrintHeadersFilename
The file to log CC_PRINT_HEADERS output to, if enabled.
Definition: Driver.h:196
clang::driver::HeaderMode_None
@ HeaderMode_None
Definition: Driver.h:64
clang::driver::Driver::OMPRT_Unknown
@ OMPRT_Unknown
An unknown OpenMP runtime.
Definition: Driver.h:121
clang::prec::Level
Level
Definition: OperatorPrecedence.h:26
clang::driver::Driver::GetTemporaryDirectory
std::string GetTemporaryDirectory(StringRef Prefix) const
GetTemporaryDirectory - Return the pathname of a temporary directory to use as part of compilation; t...
Definition: Driver.cpp:5854
clang::driver::IsClangCL
bool IsClangCL(StringRef DriverMode)
Checks whether the value produced by getDriverMode is for CL mode.
Definition: Driver.cpp:6284
clang::driver::Driver::HostSystem
std::string HostSystem
Definition: Driver.h:187
clang::driver::Driver::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: Driver.h:364
Types.h
clang::driver::HeaderMode_Default
@ HeaderMode_Default
Definition: Driver.h:65
clang::driver::Driver::setTitle
void setTitle(std::string Value)
Definition: Driver.h:376
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:88
clang::driver::Driver::HandleImmediateArgs
bool HandleImmediateArgs(const Compilation &C)
HandleImmediateArgs - Handle any arguments which should be treated before building actions or binding...
Definition: Driver.cpp:1933
clang::driver::getDriverMode
llvm::StringRef getDriverMode(StringRef ProgName, ArrayRef< const char * > Args)
Returns the driver mode option's value, i.e.
Definition: Driver.cpp:6269
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::driver::Driver::PrintHelp
void PrintHelp(bool ShowHidden) const
PrintHelp - Print the help text.
Definition: Driver.cpp:1789
clang::driver::Driver::OMPRT_GOMP
@ OMPRT_GOMP
The GNU OpenMP runtime.
Definition: Driver.h:130
clang::driver::JobAction
Definition: Action.h:395
clang::driver::Driver::DyldPrefix
std::string DyldPrefix
Dynamic loader prefix, if present.
Definition: Driver.h:181
clang::driver::Driver::getProbePrecompiled
bool getProbePrecompiled() const
Definition: Driver.h:370
clang::driver::Driver::ReproLevel::OnCrash
@ OnCrash
clang::driver::Driver::BuildInputs
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:2427
clang::driver::Driver::GetReleaseVersion
static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor, unsigned &Micro, bool &HadExtra)
GetReleaseVersion - Parse (([0-9]+)(.
Definition: Driver.cpp:6159
clang::driver::Driver::ClangExecutable
std::string ClangExecutable
The original path to the clang executable.
Definition: Driver.h:153
clang::driver::Driver::CCPrintProcessStats
unsigned CCPrintProcessStats
Set CC_PRINT_PROC_STAT mode, which causes the driver to dump performance report to CC_PRINT_PROC_STAT...
Definition: Driver.h:247
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >
clang::driver::Driver::HandleAutocompletions
void HandleAutocompletions(StringRef PassedFlags) const
HandleAutocompletions - Handle –autocomplete by searching and printing possible flags,...
Definition: Driver.cpp:1847
clang::driver::Driver::getInstalledDir
const char * getInstalledDir() const
Get the path to where the clang executable was installed.
Definition: Driver.h:386
clang::driver::Driver::IsFlangMode
bool IsFlangMode() const
Whether the driver should invoke flang for fortran inputs.
Definition: Driver.h:221
clang::driver::Driver::setCheckInputsExist
void setCheckInputsExist(bool Value)
Definition: Driver.h:368
clang::driver::Driver::HostMachine
std::string HostMachine
Definition: Driver.h:187
clang::DiagnosticsEngine::Report
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1537
clang::driver::Driver::CommandStatus::Error
@ Error
clang::driver::Driver::BuildUniversalActions
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:2243
clang::driver::Driver::BuildCompilation
Compilation * BuildCompilation(ArrayRef< const char * > Args)
BuildCompilation - Construct a compilation object for a command line argument vector.
Definition: Driver.cpp:1113
clang::driver::Driver::CCGenDiagnostics
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
Definition: Driver.h:243