clang  8.0.0svn
Driver.h
Go to the documentation of this file.
1 //===--- Driver.h - Clang GCC Compatible Driver -----------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_DRIVER_DRIVER_H
11 #define LLVM_CLANG_DRIVER_DRIVER_H
12 
13 #include "clang/Basic/Diagnostic.h"
14 #include "clang/Basic/LLVM.h"
15 #include "clang/Driver/Action.h"
16 #include "clang/Driver/Phases.h"
17 #include "clang/Driver/ToolChain.h"
18 #include "clang/Driver/Types.h"
19 #include "clang/Driver/Util.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Option/ArgList.h"
23 #include "llvm/Support/StringSaver.h"
24 
25 #include <list>
26 #include <map>
27 #include <string>
28 
29 namespace llvm {
30 class Triple;
31 namespace vfs {
32 class FileSystem;
33 }
34 } // namespace llvm
35 
36 namespace clang {
37 
38 namespace driver {
39 
40  class Command;
41  class Compilation;
42  class InputInfo;
43  class JobList;
44  class JobAction;
45  class SanitizerArgs;
46  class ToolChain;
47 
48 /// Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
49 enum LTOKind {
54 };
55 
56 /// Driver - Encapsulate logic for constructing compilation processes
57 /// from a set of gcc-driver-like command line arguments.
58 class Driver {
59  std::unique_ptr<llvm::opt::OptTable> Opts;
60 
61  DiagnosticsEngine &Diags;
62 
64 
65  enum DriverMode {
66  GCCMode,
67  GXXMode,
68  CPPMode,
69  CLMode
70  } Mode;
71 
72  enum SaveTempsMode {
73  SaveTempsNone,
74  SaveTempsCwd,
75  SaveTempsObj
76  } SaveTemps;
77 
78  enum BitcodeEmbedMode {
79  EmbedNone,
80  EmbedMarker,
82  } BitcodeEmbed;
83 
84  /// LTO mode selected via -f(no-)?lto(=.*)? options.
85  LTOKind LTOMode;
86 
87 public:
89  /// An unknown OpenMP runtime. We can't generate effective OpenMP code
90  /// without knowing what runtime to target.
92 
93  /// The LLVM OpenMP runtime. When completed and integrated, this will become
94  /// the default for Clang.
96 
97  /// The GNU OpenMP runtime. Clang doesn't support generating OpenMP code for
98  /// this runtime but can swallow the pragmas, and find and link against the
99  /// runtime library itself.
101 
102  /// The legacy name for the LLVM OpenMP runtime from when it was the Intel
103  /// OpenMP runtime. We support this mode for users with existing
104  /// dependencies on this runtime library name.
105  OMPRT_IOMP5
106  };
107 
108  // Diag - Forwarding function for diagnostics.
109  DiagnosticBuilder Diag(unsigned DiagID) const {
110  return Diags.Report(DiagID);
111  }
112 
113  // FIXME: Privatize once interface is stable.
114 public:
115  /// The name the driver was invoked as.
116  std::string Name;
117 
118  /// The path the driver executable was in, as invoked from the
119  /// command line.
120  std::string Dir;
121 
122  /// The original path to the clang executable.
123  std::string ClangExecutable;
124 
125  /// Target and driver mode components extracted from clang executable name.
127 
128  /// The path to the installed clang directory, if any.
129  std::string InstalledDir;
130 
131  /// The path to the compiler resource directory.
132  std::string ResourceDir;
133 
134  /// System directory for config files.
135  std::string SystemConfigDir;
136 
137  /// User directory for config files.
138  std::string UserConfigDir;
139 
140  /// A prefix directory used to emulate a limited subset of GCC's '-Bprefix'
141  /// functionality.
142  /// FIXME: This type of customization should be removed in favor of the
143  /// universal driver when it is ready.
145  prefix_list PrefixDirs;
146 
147  /// sysroot, if present
148  std::string SysRoot;
149 
150  /// Dynamic loader prefix, if present
151  std::string DyldPrefix;
152 
153  /// Driver title to use with help.
154  std::string DriverTitle;
155 
156  /// Information about the host which can be overridden by the user.
157  std::string HostBits, HostMachine, HostSystem, HostRelease;
158 
159  /// The file to log CC_PRINT_OPTIONS output to, if enabled.
161 
162  /// The file to log CC_PRINT_HEADERS output to, if enabled.
164 
165  /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
167 
168  /// A list of inputs and their types for the given arguments.
171 
172  /// Whether the driver should follow g++ like behavior.
173  bool CCCIsCXX() const { return Mode == GXXMode; }
174 
175  /// Whether the driver is just the preprocessor.
176  bool CCCIsCPP() const { return Mode == CPPMode; }
177 
178  /// Whether the driver should follow gcc like behavior.
179  bool CCCIsCC() const { return Mode == GCCMode; }
180 
181  /// Whether the driver should follow cl.exe like behavior.
182  bool IsCLMode() const { return Mode == CLMode; }
183 
184  /// Only print tool bindings, don't build any jobs.
185  unsigned CCCPrintBindings : 1;
186 
187  /// Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to
188  /// CCPrintOptionsFilename or to stderr.
189  unsigned CCPrintOptions : 1;
190 
191  /// Set CC_PRINT_HEADERS mode, which causes the frontend to log header include
192  /// information to CCPrintHeadersFilename or to stderr.
193  unsigned CCPrintHeaders : 1;
194 
195  /// Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics
196  /// to CCLogDiagnosticsFilename or to stderr, in a stable machine readable
197  /// format.
198  unsigned CCLogDiagnostics : 1;
199 
200  /// Whether the driver is generating diagnostics for debugging purposes.
201  unsigned CCGenDiagnostics : 1;
202 
203 private:
204  /// Raw target triple.
205  std::string TargetTriple;
206 
207  /// Name to use when invoking gcc/g++.
208  std::string CCCGenericGCCName;
209 
210  /// Name of configuration file if used.
211  std::string ConfigFile;
212 
213  /// Allocator for string saver.
214  llvm::BumpPtrAllocator Alloc;
215 
216  /// Object that stores strings read from configuration file.
217  llvm::StringSaver Saver;
218 
219  /// Arguments originated from configuration file.
220  std::unique_ptr<llvm::opt::InputArgList> CfgOptions;
221 
222  /// Arguments originated from command line.
223  std::unique_ptr<llvm::opt::InputArgList> CLOptions;
224 
225  /// Whether to check that input files exist when constructing compilation
226  /// jobs.
227  unsigned CheckInputsExist : 1;
228 
229 public:
230  /// Use lazy precompiled headers for PCH support.
231  unsigned CCCUsePCH : 1;
232 
233  /// Force clang to emit reproducer for driver invocation. This is enabled
234  /// indirectly by setting FORCE_CLANG_DIAGNOSTICS_CRASH environment variable
235  /// or when using the -gen-reproducer driver flag.
236  unsigned GenReproducer : 1;
237 
238 private:
239  /// Certain options suppress the 'no input files' warning.
240  unsigned SuppressMissingInputWarning : 1;
241 
242  std::list<std::string> TempFiles;
243  std::list<std::string> ResultFiles;
244 
245  /// Cache of all the ToolChains in use by the driver.
246  ///
247  /// This maps from the string representation of a triple to a ToolChain
248  /// created targeting that triple. The driver owns all the ToolChain objects
249  /// stored in it, and will clean them up when torn down.
250  mutable llvm::StringMap<std::unique_ptr<ToolChain>> ToolChains;
251 
252 private:
253  /// TranslateInputArgs - Create a new derived argument list from the input
254  /// arguments, after applying the standard argument translations.
255  llvm::opt::DerivedArgList *
256  TranslateInputArgs(const llvm::opt::InputArgList &Args) const;
257 
258  // getFinalPhase - Determine which compilation mode we are in and record
259  // which option we used to determine the final phase.
260  phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL,
261  llvm::opt::Arg **FinalPhaseArg = nullptr) const;
262 
263  // Before executing jobs, sets up response files for commands that need them.
264  void setUpResponseFiles(Compilation &C, Command &Cmd);
265 
266  void generatePrefixedToolNames(StringRef Tool, const ToolChain &TC,
267  SmallVectorImpl<std::string> &Names) const;
268 
269  /// Find the appropriate .crash diagonostic file for the child crash
270  /// under this driver and copy it out to a temporary destination with the
271  /// other reproducer related files (.sh, .cache, etc). If not found, suggest a
272  /// directory for the user to look at.
273  ///
274  /// \param ReproCrashFilename The file path to copy the .crash to.
275  /// \param CrashDiagDir The suggested directory for the user to look at
276  /// in case the search or copy fails.
277  ///
278  /// \returns If the .crash is found and successfully copied return true,
279  /// otherwise false and return the suggested directory in \p CrashDiagDir.
280  bool getCrashDiagnosticFile(StringRef ReproCrashFilename,
281  SmallString<128> &CrashDiagDir);
282 
283 public:
284  Driver(StringRef ClangExecutable, StringRef TargetTriple,
285  DiagnosticsEngine &Diags,
287 
288  /// @name Accessors
289  /// @{
290 
291  /// Name to use when invoking gcc/g++.
292  const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
293 
294  const std::string &getConfigFile() const { return ConfigFile; }
295 
296  const llvm::opt::OptTable &getOpts() const { return *Opts; }
297 
298  const DiagnosticsEngine &getDiags() const { return Diags; }
299 
300  llvm::vfs::FileSystem &getVFS() const { return *VFS; }
301 
302  bool getCheckInputsExist() const { return CheckInputsExist; }
303 
304  void setCheckInputsExist(bool Value) { CheckInputsExist = Value; }
305 
306  void setTargetAndMode(const ParsedClangName &TM) { ClangNameParts = TM; }
307 
308  const std::string &getTitle() { return DriverTitle; }
309  void setTitle(std::string Value) { DriverTitle = std::move(Value); }
310 
311  std::string getTargetTriple() const { return TargetTriple; }
312 
313  /// Get the path to the main clang executable.
314  const char *getClangProgramPath() const {
315  return ClangExecutable.c_str();
316  }
317 
318  /// Get the path to where the clang executable was installed.
319  const char *getInstalledDir() const {
320  if (!InstalledDir.empty())
321  return InstalledDir.c_str();
322  return Dir.c_str();
323  }
324  void setInstalledDir(StringRef Value) {
325  InstalledDir = Value;
326  }
327 
328  bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
329  bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
330 
331  bool embedBitcodeEnabled() const { return BitcodeEmbed != EmbedNone; }
332  bool embedBitcodeInObject() const { return (BitcodeEmbed == EmbedBitcode); }
333  bool embedBitcodeMarkerOnly() const { return (BitcodeEmbed == EmbedMarker); }
334 
335  /// Compute the desired OpenMP runtime from the flags provided.
336  OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const;
337 
338  /// @}
339  /// @name Primary Functionality
340  /// @{
341 
342  /// CreateOffloadingDeviceToolChains - create all the toolchains required to
343  /// support offloading devices given the programming models specified in the
344  /// current compilation. Also, update the host tool chain kind accordingly.
345  void CreateOffloadingDeviceToolChains(Compilation &C, InputList &Inputs);
346 
347  /// BuildCompilation - Construct a compilation object for a command
348  /// line argument vector.
349  ///
350  /// \return A compilation, or 0 if none was built for the given
351  /// argument vector. A null return value does not necessarily
352  /// indicate an error condition, the diagnostics should be queried
353  /// to determine if an error occurred.
354  Compilation *BuildCompilation(ArrayRef<const char *> Args);
355 
356  /// @name Driver Steps
357  /// @{
358 
359  /// ParseDriverMode - Look for and handle the driver mode option in Args.
360  void ParseDriverMode(StringRef ProgramName, ArrayRef<const char *> Args);
361 
362  /// ParseArgStrings - Parse the given list of strings into an
363  /// ArgList.
364  llvm::opt::InputArgList ParseArgStrings(ArrayRef<const char *> Args,
365  bool &ContainsError);
366 
367  /// BuildInputs - Construct the list of inputs and their types from
368  /// the given arguments.
369  ///
370  /// \param TC - The default host tool chain.
371  /// \param Args - The input arguments.
372  /// \param Inputs - The list to store the resulting compilation
373  /// inputs onto.
374  void BuildInputs(const ToolChain &TC, llvm::opt::DerivedArgList &Args,
375  InputList &Inputs) const;
376 
377  /// BuildActions - Construct the list of actions to perform for the
378  /// given arguments, which are only done for a single architecture.
379  ///
380  /// \param C - The compilation that is being built.
381  /// \param Args - The input arguments.
382  /// \param Actions - The list to store the resulting actions onto.
383  void BuildActions(Compilation &C, llvm::opt::DerivedArgList &Args,
384  const InputList &Inputs, ActionList &Actions) const;
385 
386  /// BuildUniversalActions - Construct the list of actions to perform
387  /// for the given arguments, which may require a universal build.
388  ///
389  /// \param C - The compilation that is being built.
390  /// \param TC - The default host tool chain.
391  void BuildUniversalActions(Compilation &C, const ToolChain &TC,
392  const InputList &BAInputs) const;
393 
394  /// BuildJobs - Bind actions to concrete tools and translate
395  /// arguments to form the list of jobs to run.
396  ///
397  /// \param C - The compilation that is being built.
398  void BuildJobs(Compilation &C) const;
399 
400  /// ExecuteCompilation - Execute the compilation according to the command line
401  /// arguments and return an appropriate exit code.
402  ///
403  /// This routine handles additional processing that must be done in addition
404  /// to just running the subprocesses, for example reporting errors, setting
405  /// up response files, removing temporary files, etc.
406  int ExecuteCompilation(Compilation &C,
407  SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands);
408 
409  /// Contains the files in the compilation diagnostic report generated by
410  /// generateCompilationDiagnostics.
413  };
414 
415  /// generateCompilationDiagnostics - Generate diagnostics information
416  /// including preprocessed source file(s).
417  ///
418  void generateCompilationDiagnostics(
419  Compilation &C, const Command &FailingCommand,
420  StringRef AdditionalInformation = "",
421  CompilationDiagnosticReport *GeneratedReport = nullptr);
422 
423  /// @}
424  /// @name Helper Methods
425  /// @{
426 
427  /// PrintActions - Print the list of actions.
428  void PrintActions(const Compilation &C) const;
429 
430  /// PrintHelp - Print the help text.
431  ///
432  /// \param ShowHidden - Show hidden options.
433  void PrintHelp(bool ShowHidden) const;
434 
435  /// PrintVersion - Print the driver version.
436  void PrintVersion(const Compilation &C, raw_ostream &OS) const;
437 
438  /// GetFilePath - Lookup \p Name in the list of file search paths.
439  ///
440  /// \param TC - The tool chain for additional information on
441  /// directories to search.
442  //
443  // FIXME: This should be in CompilationInfo.
444  std::string GetFilePath(StringRef Name, const ToolChain &TC) const;
445 
446  /// GetProgramPath - Lookup \p Name in the list of program search paths.
447  ///
448  /// \param TC - The provided tool chain for additional information on
449  /// directories to search.
450  //
451  // FIXME: This should be in CompilationInfo.
452  std::string GetProgramPath(StringRef Name, const ToolChain &TC) const;
453 
454  /// HandleAutocompletions - Handle --autocomplete by searching and printing
455  /// possible flags, descriptions, and its arguments.
456  void HandleAutocompletions(StringRef PassedFlags) const;
457 
458  /// HandleImmediateArgs - Handle any arguments which should be
459  /// treated before building actions or binding tools.
460  ///
461  /// \return Whether any compilation should be built for this
462  /// invocation.
463  bool HandleImmediateArgs(const Compilation &C);
464 
465  /// ConstructAction - Construct the appropriate action to do for
466  /// \p Phase on the \p Input, taking in to account arguments
467  /// like -fsyntax-only or --analyze.
468  Action *ConstructPhaseAction(
469  Compilation &C, const llvm::opt::ArgList &Args, phases::ID Phase,
470  Action *Input,
471  Action::OffloadKind TargetDeviceOffloadKind = Action::OFK_None) const;
472 
473  /// BuildJobsForAction - Construct the jobs to perform for the action \p A and
474  /// return an InputInfo for the result of running \p A. Will only construct
475  /// jobs for a given (Action, ToolChain, BoundArch, DeviceKind) tuple once.
476  InputInfo
477  BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC,
478  StringRef BoundArch, bool AtTopLevel, bool MultipleArchs,
479  const char *LinkingOutput,
480  std::map<std::pair<const Action *, std::string>, InputInfo>
481  &CachedResults,
482  Action::OffloadKind TargetDeviceOffloadKind) const;
483 
484  /// Returns the default name for linked images (e.g., "a.out").
485  const char *getDefaultImageName() const;
486 
487  /// GetNamedOutputPath - Return the name to use for the output of
488  /// the action \p JA. The result is appended to the compilation's
489  /// list of temporary or result files, as appropriate.
490  ///
491  /// \param C - The compilation.
492  /// \param JA - The action of interest.
493  /// \param BaseInput - The original input file that this action was
494  /// triggered by.
495  /// \param BoundArch - The bound architecture.
496  /// \param AtTopLevel - Whether this is a "top-level" action.
497  /// \param MultipleArchs - Whether multiple -arch options were supplied.
498  /// \param NormalizedTriple - The normalized triple of the relevant target.
499  const char *GetNamedOutputPath(Compilation &C, const JobAction &JA,
500  const char *BaseInput, StringRef BoundArch,
501  bool AtTopLevel, bool MultipleArchs,
502  StringRef NormalizedTriple) const;
503 
504  /// GetTemporaryPath - Return the pathname of a temporary file to use
505  /// as part of compilation; the file will have the given prefix and suffix.
506  ///
507  /// GCC goes to extra lengths here to be a bit more robust.
508  std::string GetTemporaryPath(StringRef Prefix, StringRef Suffix) const;
509 
510  /// Return the pathname of the pch file in clang-cl mode.
511  std::string GetClPchPath(Compilation &C, StringRef BaseName) const;
512 
513  /// ShouldUseClangCompiler - Should the clang compiler be used to
514  /// handle this action.
515  bool ShouldUseClangCompiler(const JobAction &JA) const;
516 
517  /// Returns true if we are performing any kind of LTO.
518  bool isUsingLTO() const { return LTOMode != LTOK_None; }
519 
520  /// Get the specific kind of LTO being performed.
521  LTOKind getLTOMode() const { return LTOMode; }
522 
523 private:
524 
525  /// Tries to load options from configuration file.
526  ///
527  /// \returns true if error occurred.
528  bool loadConfigFile();
529 
530  /// Read options from the specified file.
531  ///
532  /// \param [in] FileName File to read.
533  /// \returns true, if error occurred while reading.
534  bool readConfigFile(StringRef FileName);
535 
536  /// Set the driver mode (cl, gcc, etc) from an option string of the form
537  /// --driver-mode=<mode>.
538  void setDriverModeFromOption(StringRef Opt);
539 
540  /// Parse the \p Args list for LTO options and record the type of LTO
541  /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
542  void setLTOMode(const llvm::opt::ArgList &Args);
543 
544  /// Retrieves a ToolChain for a particular \p Target triple.
545  ///
546  /// Will cache ToolChains for the life of the driver object, and create them
547  /// on-demand.
548  const ToolChain &getToolChain(const llvm::opt::ArgList &Args,
549  const llvm::Triple &Target) const;
550 
551  /// @}
552 
553  /// Get bitmasks for which option flags to include and exclude based on
554  /// the driver mode.
555  std::pair<unsigned, unsigned> getIncludeExcludeOptionFlagMasks() const;
556 
557  /// Helper used in BuildJobsForAction. Doesn't use the cache when building
558  /// jobs specifically for the given action, but will use the cache when
559  /// building jobs for the Action's inputs.
560  InputInfo BuildJobsForActionNoCache(
561  Compilation &C, const Action *A, const ToolChain *TC, StringRef BoundArch,
562  bool AtTopLevel, bool MultipleArchs, const char *LinkingOutput,
563  std::map<std::pair<const Action *, std::string>, InputInfo>
564  &CachedResults,
565  Action::OffloadKind TargetDeviceOffloadKind) const;
566 
567 public:
568  /// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
569  /// return the grouped values as integers. Numbers which are not
570  /// provided are set to 0.
571  ///
572  /// \return True if the entire string was parsed (9.2), or all
573  /// groups were parsed (10.3.5extrastuff). HadExtra is true if all
574  /// groups were parsed but extra characters remain at the end.
575  static bool GetReleaseVersion(StringRef Str, unsigned &Major, unsigned &Minor,
576  unsigned &Micro, bool &HadExtra);
577 
578  /// Parse digits from a string \p Str and fulfill \p Digits with
579  /// the parsed numbers. This method assumes that the max number of
580  /// digits to look for is equal to Digits.size().
581  ///
582  /// \return True if the entire string was parsed and there are
583  /// no extra characters remaining at the end.
584  static bool GetReleaseVersion(StringRef Str,
586  /// Compute the default -fmodule-cache-path.
587  static void getDefaultModuleCachePath(SmallVectorImpl<char> &Result);
588 };
589 
590 /// \return True if the last defined optimization level is -Ofast.
591 /// And False otherwise.
592 bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
593 
594 } // end namespace driver
595 } // end namespace clang
596 
597 #endif
ID
ID - Ordered values for successive stages in the compilation process which interact with user options...
Definition: Phases.h:18
prefix_list PrefixDirs
Definition: Driver.h:145
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
unsigned CCPrintHeaders
Set CC_PRINT_HEADERS mode, which causes the frontend to log header include information to CCPrintHead...
Definition: Driver.h:193
unsigned CCCUsePCH
Use lazy precompiled headers for PCH support.
Definition: Driver.h:231
bool isUsingLTO() const
Returns true if we are performing any kind of LTO.
Definition: Driver.h:518
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1294
std::string DyldPrefix
Dynamic loader prefix, if present.
Definition: Driver.h:151
bool embedBitcodeEnabled() const
Definition: Driver.h:331
std::string getTargetTriple() const
Definition: Driver.h:311
LTOKind getLTOMode() const
Get the specific kind of LTO being performed.
Definition: Driver.h:521
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:109
Contains the files in the compilation diagnostic report generated by generateCompilationDiagnostics.
Definition: Driver.h:411
bool embedBitcodeMarkerOnly() const
Definition: Driver.h:333
unsigned CCLogDiagnostics
Set CC_LOG_DIAGNOSTICS mode, which causes the frontend to log diagnostics to CCLogDiagnosticsFilename...
Definition: Driver.h:198
const std::string & getTitle()
Definition: Driver.h:308
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition: Driver.h:120
Action - Represent an abstract compilation step to perform.
Definition: Action.h:48
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:149
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
CompileCommand Cmd
void setTargetAndMode(const ParsedClangName &TM)
Definition: Driver.h:306
Defines the Diagnostic-related interfaces.
The LLVM OpenMP runtime.
Definition: Driver.h:95
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:58
An unknown OpenMP runtime.
Definition: Driver.h:91
const char * CCPrintOptionsFilename
The file to log CC_PRINT_OPTIONS output to, if enabled.
Definition: Driver.h:160
llvm::vfs::FileSystem & getVFS() const
Definition: Driver.h:300
std::string HostSystem
Definition: Driver.h:157
SmallVector< std::pair< types::ID, const llvm::opt::Arg * >, 16 > InputList
A list of inputs and their types for the given arguments.
Definition: Driver.h:170
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:1042
unsigned GenReproducer
Force clang to emit reproducer for driver invocation.
Definition: Driver.h:236
const DiagnosticsEngine & getDiags() const
Definition: Driver.h:298
bool isSaveTempsObj() const
Definition: Driver.h:329
const std::string & getConfigFile() const
Definition: Driver.h:294
bool IsCLMode() const
Whether the driver should follow cl.exe like behavior.
Definition: Driver.h:182
unsigned CCPrintOptions
Set CC_PRINT_OPTIONS mode, which is like -v but logs the commands to CCPrintOptionsFilename or to std...
Definition: Driver.h:189
void setCheckInputsExist(bool Value)
Definition: Driver.h:304
bool embedBitcodeInObject() const
Definition: Driver.h:332
Command - An executable path/name and argument vector to execute.
Definition: Job.h:42
std::string InstalledDir
The path to the installed clang directory, if any.
Definition: Driver.h:129
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition: Driver.h:173
bool isSaveTempsEnabled() const
Definition: Driver.h:328
std::string UserConfigDir
User directory for config files.
Definition: Driver.h:138
void setTitle(std::string Value)
Definition: Driver.h:309
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:60
void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts, llvm::MemoryBufferRef Buf)
Dataflow Directional Tag Classes.
const char * CCPrintHeadersFilename
The file to log CC_PRINT_HEADERS output to, if enabled.
Definition: Driver.h:163
unsigned CCCPrintBindings
Only print tool bindings, don&#39;t build any jobs.
Definition: Driver.h:185
const std::string & getCCCGenericGCCName() const
Name to use when invoking gcc/g++.
Definition: Driver.h:292
std::string SysRoot
sysroot, if present
Definition: Driver.h:148
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
std::string Name
The name the driver was invoked as.
Definition: Driver.h:116
The GNU OpenMP runtime.
Definition: Driver.h:100
llvm::SmallVector< std::string, 4 > TemporaryFiles
Definition: Driver.h:412
ParsedClangName ClangNameParts
Target and driver mode components extracted from clang executable name.
Definition: Driver.h:126
bool getCheckInputsExist() const
Definition: Driver.h:302
const char * getInstalledDir() const
Get the path to where the clang executable was installed.
Definition: Driver.h:319
std::string ClangExecutable
The original path to the clang executable.
Definition: Driver.h:123
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:46
SmallVector< std::string, 4 > prefix_list
A prefix directory used to emulate a limited subset of GCC&#39;s &#39;-Bprefix&#39; functionality.
Definition: Driver.h:144
const char * CCLogDiagnosticsFilename
The file to log CC_LOG_DIAGNOSTICS output to, if enabled.
Definition: Driver.h:166
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
Definition: Driver.h:49
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:296
const char * getClangProgramPath() const
Get the path to the main clang executable.
Definition: Driver.h:314
std::string DriverTitle
Driver title to use with help.
Definition: Driver.h:154
bool CCCIsCPP() const
Whether the driver is just the preprocessor.
Definition: Driver.h:176
void setInstalledDir(StringRef Value)
Definition: Driver.h:324
bool CCCIsCC() const
Whether the driver should follow gcc like behavior.
Definition: Driver.h:179
unsigned CCGenDiagnostics
Whether the driver is generating diagnostics for debugging purposes.
Definition: Driver.h:201
std::string SystemConfigDir
System directory for config files.
Definition: Driver.h:135
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:87
std::string ResourceDir
The path to the compiler resource directory.
Definition: Driver.h:132