Coverage Report

Created: 2018-12-11 17:59

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Driver/ToolChain.h
Line
Count
Source (jump to first uncovered line)
1
//===- ToolChain.h - Collections of tools for one platform ------*- 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_TOOLCHAIN_H
11
#define LLVM_CLANG_DRIVER_TOOLCHAIN_H
12
13
#include "clang/Basic/LLVM.h"
14
#include "clang/Basic/Sanitizers.h"
15
#include "clang/Basic/DebugInfoOptions.h"
16
#include "clang/Driver/Action.h"
17
#include "clang/Driver/Multilib.h"
18
#include "clang/Driver/Types.h"
19
#include "llvm/ADT/ArrayRef.h"
20
#include "llvm/ADT/SmallVector.h"
21
#include "llvm/ADT/StringRef.h"
22
#include "llvm/ADT/Triple.h"
23
#include "llvm/MC/MCTargetOptions.h"
24
#include "llvm/Option/Option.h"
25
#include "llvm/Support/VersionTuple.h"
26
#include "llvm/Target/TargetOptions.h"
27
#include <cassert>
28
#include <memory>
29
#include <string>
30
#include <utility>
31
32
namespace llvm {
33
namespace opt {
34
35
class Arg;
36
class ArgList;
37
class DerivedArgList;
38
39
} // namespace opt
40
namespace vfs {
41
42
class FileSystem;
43
44
} // namespace vfs
45
} // namespace llvm
46
47
namespace clang {
48
49
class ObjCRuntime;
50
51
namespace driver {
52
53
class Driver;
54
class InputInfo;
55
class SanitizerArgs;
56
class Tool;
57
class XRayArgs;
58
59
/// Helper structure used to pass information extracted from clang executable
60
/// name such as `i686-linux-android-g++`.
61
0
struct ParsedClangName {
62
  /// Target part of the executable name, as `i686-linux-android`.
63
  std::string TargetPrefix;
64
65
  /// Driver mode part of the executable name, as `g++`.
66
  std::string ModeSuffix;
67
68
  /// Corresponding driver mode argument, as '--driver-mode=g++'
69
  const char *DriverMode = nullptr;
70
71
  /// True if TargetPrefix is recognized as a registered target name.
72
  bool TargetIsValid = false;
73
74
31.9k
  ParsedClangName() = default;
75
  ParsedClangName(std::string Suffix, const char *Mode)
76
74.4k
      : ModeSuffix(Suffix), DriverMode(Mode) {}
77
  ParsedClangName(std::string Target, std::string Suffix, const char *Mode,
78
                  bool IsRegistered)
79
      : TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
80
32
        TargetIsValid(IsRegistered) {}
81
82
31.7k
  bool isEmpty() const {
83
31.7k
    return TargetPrefix.empty() && 
ModeSuffix.empty()31.7k
&&
DriverMode == nullptr5.82k
;
84
31.7k
  }
85
};
86
87
/// ToolChain - Access to tools for a single platform.
88
class ToolChain {
89
public:
90
  using path_list = SmallVector<std::string, 16>;
91
92
  enum CXXStdlibType {
93
    CST_Libcxx,
94
    CST_Libstdcxx
95
  };
96
97
  enum RuntimeLibType {
98
    RLT_CompilerRT,
99
    RLT_Libgcc
100
  };
101
102
  enum RTTIMode {
103
    RM_Enabled,
104
    RM_Disabled,
105
  };
106
107
private:
108
  friend class RegisterEffectiveTriple;
109
110
  const Driver &D;
111
  llvm::Triple Triple;
112
  const llvm::opt::ArgList &Args;
113
114
  // We need to initialize CachedRTTIArg before CachedRTTIMode
115
  const llvm::opt::Arg *const CachedRTTIArg;
116
117
  const RTTIMode CachedRTTIMode;
118
119
  /// The list of toolchain specific path prefixes to search for libraries.
120
  path_list LibraryPaths;
121
122
  /// The list of toolchain specific path prefixes to search for files.
123
  path_list FilePaths;
124
125
  /// The list of toolchain specific path prefixes to search for programs.
126
  path_list ProgramPaths;
127
128
  mutable std::unique_ptr<Tool> Clang;
129
  mutable std::unique_ptr<Tool> Assemble;
130
  mutable std::unique_ptr<Tool> Link;
131
  mutable std::unique_ptr<Tool> OffloadBundler;
132
133
  Tool *getClang() const;
134
  Tool *getAssemble() const;
135
  Tool *getLink() const;
136
  Tool *getClangAs() const;
137
  Tool *getOffloadBundler() const;
138
139
  mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
140
  mutable std::unique_ptr<XRayArgs> XRayArguments;
141
142
  /// The effective clang triple for the current Job.
143
  mutable llvm::Triple EffectiveTriple;
144
145
  /// Set the toolchain's effective clang triple.
146
83.7k
  void setEffectiveTriple(llvm::Triple ET) const {
147
83.7k
    EffectiveTriple = std::move(ET);
148
83.7k
  }
149
150
protected:
151
  MultilibSet Multilibs;
152
  Multilib SelectedMultilib;
153
154
  ToolChain(const Driver &D, const llvm::Triple &T,
155
            const llvm::opt::ArgList &Args);
156
157
  void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
158
159
  virtual Tool *buildAssembler() const;
160
  virtual Tool *buildLinker() const;
161
  virtual Tool *getTool(Action::ActionClass AC) const;
162
163
  /// \name Utilities for implementing subclasses.
164
  ///@{
165
  static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
166
                               llvm::opt::ArgStringList &CC1Args,
167
                               const Twine &Path);
168
  static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
169
                                      llvm::opt::ArgStringList &CC1Args,
170
                                      const Twine &Path);
171
  static void
172
      addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
173
                                      llvm::opt::ArgStringList &CC1Args,
174
                                      const Twine &Path);
175
  static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
176
                                llvm::opt::ArgStringList &CC1Args,
177
                                ArrayRef<StringRef> Paths);
178
  ///@}
179
180
public:
181
  virtual ~ToolChain();
182
183
  // Accessors
184
185
723k
  const Driver &getDriver() const { return D; }
186
  llvm::vfs::FileSystem &getVFS() const;
187
1.49M
  const llvm::Triple &getTriple() const { return Triple; }
188
189
  /// Get the toolchain's aux triple, if it has one.
190
  ///
191
  /// Exactly what the aux triple represents depends on the toolchain, but for
192
  /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
193
  /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
194
198
  virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
195
196
  /// Some toolchains need to modify the file name, for example to replace the
197
  /// extension for object files with .cubin for OpenMP offloading to Nvidia
198
  /// GPUs.
199
  virtual std::string getInputFilename(const InputInfo &Input) const;
200
201
428k
  llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
202
2
  StringRef getArchName() const { return Triple.getArchName(); }
203
0
  StringRef getPlatform() const { return Triple.getVendorName(); }
204
40.6k
  StringRef getOS() const { return Triple.getOSName(); }
205
206
  /// Provide the default architecture name (as expected by -arch) for
207
  /// this toolchain.
208
  StringRef getDefaultUniversalArchName() const;
209
210
17.8k
  std::string getTripleString() const {
211
17.8k
    return Triple.getTriple();
212
17.8k
  }
213
214
  /// Get the toolchain's effective clang triple.
215
127k
  const llvm::Triple &getEffectiveTriple() const {
216
127k
    assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
217
127k
    return EffectiveTriple;
218
127k
  }
219
220
17
  path_list &getLibraryPaths() { return LibraryPaths; }
221
10.0k
  const path_list &getLibraryPaths() const { return LibraryPaths; }
222
223
4.19k
  path_list &getFilePaths() { return FilePaths; }
224
9.25k
  const path_list &getFilePaths() const { return FilePaths; }
225
226
47.9k
  path_list &getProgramPaths() { return ProgramPaths; }
227
5.46k
  const path_list &getProgramPaths() const { return ProgramPaths; }
228
229
1
  const MultilibSet &getMultilibs() const { return Multilibs; }
230
231
3
  const Multilib &getMultilib() const { return SelectedMultilib; }
232
233
  const SanitizerArgs& getSanitizerArgs() const;
234
235
  const XRayArgs& getXRayArgs() const;
236
237
  // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
238
4
  const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
239
240
  // Returns the RTTIMode for the toolchain with the current arguments.
241
65.5k
  RTTIMode getRTTIMode() const { return CachedRTTIMode; }
242
243
  /// Return any implicit target and/or mode flag for an invocation of
244
  /// the compiler driver as `ProgName`.
245
  ///
246
  /// For example, when called with i686-linux-android-g++, the first element
247
  /// of the return value will be set to `"i686-linux-android"` and the second
248
  /// will be set to "--driver-mode=g++"`.
249
  /// It is OK if the target name is not registered. In this case the return
250
  /// value contains false in the field TargetIsValid.
251
  ///
252
  /// \pre `llvm::InitializeAllTargets()` has been called.
253
  /// \param ProgName The name the Clang driver was invoked with (from,
254
  /// e.g., argv[0]).
255
  /// \return A structure of type ParsedClangName that contains the executable
256
  /// name parts.
257
  static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName);
258
259
  // Tool access.
260
261
  /// TranslateArgs - Create a new derived argument list for any argument
262
  /// translations this ToolChain may wish to perform, or 0 if no tool chain
263
  /// specific translations are needed. If \p DeviceOffloadKind is specified
264
  /// the translation specific for that offload kind is performed.
265
  ///
266
  /// \param BoundArch - The bound architecture name, or 0.
267
  /// \param DeviceOffloadKind - The device offload kind used for the
268
  /// translation.
269
  virtual llvm::opt::DerivedArgList *
270
  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
271
384
                Action::OffloadKind DeviceOffloadKind) const {
272
384
    return nullptr;
273
384
  }
274
275
  /// TranslateOpenMPTargetArgs - Create a new derived argument list for
276
  /// that contains the OpenMP target specific flags passed via
277
  /// -Xopenmp-target -opt=val OR -Xopenmp-target=<triple> -opt=val
278
  virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
279
      const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
280
      SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
281
282
  /// Choose a tool to use to handle the action \p JA.
283
  ///
284
  /// This can be overridden when a particular ToolChain needs to use
285
  /// a compiler other than Clang.
286
  virtual Tool *SelectTool(const JobAction &JA) const;
287
288
  // Helper methods
289
290
  std::string GetFilePath(const char *Name) const;
291
  std::string GetProgramPath(const char *Name) const;
292
293
  /// Returns the linker path, respecting the -fuse-ld= argument to determine
294
  /// the linker suffix or name.
295
  std::string GetLinkerPath() const;
296
297
  /// Dispatch to the specific toolchain for verbose printing.
298
  ///
299
  /// This is used when handling the verbose option to print detailed,
300
  /// toolchain-specific information useful for understanding the behavior of
301
  /// the driver on a specific platform.
302
14
  virtual void printVerboseInfo(raw_ostream &OS) const {}
303
304
  // Platform defaults information
305
306
  /// Returns true if the toolchain is targeting a non-native
307
  /// architecture.
308
  virtual bool isCrossCompiling() const;
309
310
  /// HasNativeLTOLinker - Check whether the linker and related tools have
311
  /// native LLVM support.
312
  virtual bool HasNativeLLVMSupport() const;
313
314
  /// LookupTypeForExtension - Return the default language type to use for the
315
  /// given extension.
316
  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
317
318
  /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
319
8.09k
  virtual bool IsBlocksDefault() const { return false; }
320
321
  /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
322
  /// by default.
323
594
  virtual bool IsIntegratedAssemblerDefault() const { return false; }
324
325
  /// Check if the toolchain should use the integrated assembler.
326
  virtual bool useIntegratedAs() const;
327
328
  /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
329
7.05k
  virtual bool IsMathErrnoDefault() const { return true; }
330
331
  /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
332
  /// -fencode-extended-block-signature by default.
333
8.09k
  virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
334
335
  /// IsObjCNonFragileABIDefault - Does this tool chain set
336
  /// -fobjc-nonfragile-abi by default.
337
7.58k
  virtual bool IsObjCNonFragileABIDefault() const { return false; }
338
339
  /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
340
  /// mixed dispatch method be used?
341
0
  virtual bool UseObjCMixedDispatch() const { return false; }
342
343
  /// Check whether to enable x86 relax relocations by default.
344
  virtual bool useRelaxRelocations() const;
345
346
  /// GetDefaultStackProtectorLevel - Get the default stack protector level for
347
  /// this tool chain (0=off, 1=on, 2=strong, 3=all).
348
9.10k
  virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
349
9.10k
    return 0;
350
9.10k
  }
351
352
  /// GetDefaultLinker - Get the default linker to use.
353
4.26k
  virtual const char *getDefaultLinker() const { return "ld"; }
354
355
  /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
356
3.06k
  virtual RuntimeLibType GetDefaultRuntimeLibType() const {
357
3.06k
    return ToolChain::RLT_Libgcc;
358
3.06k
  }
359
360
1.84k
  virtual CXXStdlibType GetDefaultCXXStdlibType() const {
361
1.84k
    return ToolChain::CST_Libstdcxx;
362
1.84k
  }
363
364
  virtual std::string getCompilerRTPath() const;
365
366
  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
367
                                    StringRef Component,
368
                                    bool Shared = false) const;
369
370
  const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
371
                                     StringRef Component,
372
                                     bool Shared = false) const;
373
374
  // Returns <ResourceDir>/lib/<OSName>/<arch>.  This is used by runtimes (such
375
  // as OpenMP) to find arch-specific libraries.
376
  std::string getArchSpecificLibPath() const;
377
378
  // Returns <OSname> part of above.
379
  StringRef getOSLibName() const;
380
381
  /// needsProfileRT - returns true if instrumentation profile is on.
382
  static bool needsProfileRT(const llvm::opt::ArgList &Args);
383
384
  /// Returns true if gcov instrumentation (-fprofile-arcs or --coverage) is on.
385
  static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args);
386
387
  /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
388
  /// by default.
389
  virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const;
390
391
  /// Test whether this toolchain defaults to PIC.
392
  virtual bool isPICDefault() const = 0;
393
394
  /// Test whether this toolchain defaults to PIE.
395
  virtual bool isPIEDefault() const = 0;
396
397
  /// Tests whether this toolchain forces its default for PIC, PIE or
398
  /// non-PIC.  If this returns true, any PIC related flags should be ignored
399
  /// and instead the results of \c isPICDefault() and \c isPIEDefault() are
400
  /// used exclusively.
401
  virtual bool isPICDefaultForced() const = 0;
402
403
  /// SupportsProfiling - Does this tool chain support -pg.
404
15.0k
  virtual bool SupportsProfiling() const { return true; }
405
406
  /// Complain if this tool chain doesn't support Objective-C ARC.
407
0
  virtual void CheckObjCARC() const {}
408
409
  /// Get the default debug info format. Typically, this is DWARF.
410
4.61k
  virtual codegenoptions::DebugInfoFormat getDefaultDebugFormat() const {
411
4.61k
    return codegenoptions::DIF_DWARF;
412
4.61k
  }
413
414
  /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
415
  /// compile unit information.
416
8.29k
  virtual bool UseDwarfDebugFlags() const { return false; }
417
418
  // Return the DWARF version to emit, in the absence of arguments
419
  // to the contrary.
420
557
  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
421
422
  // True if the driver should assume "-fstandalone-debug"
423
  // in the absence of an option specifying otherwise,
424
  // provided that debugging was requested in the first place.
425
  // i.e. a value of 'true' does not imply that debugging is wanted.
426
9.57k
  virtual bool GetDefaultStandaloneDebug() const { return false; }
427
428
  // Return the default debugger "tuning."
429
8.91k
  virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
430
8.91k
    return llvm::DebuggerKind::GDB;
431
8.91k
  }
432
433
  /// Does this toolchain supports given debug info option or not.
434
4.82k
  virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
435
4.82k
    return true;
436
4.82k
  }
437
438
  /// GetExceptionModel - Return the tool chain exception model.
439
  virtual llvm::ExceptionHandling
440
  GetExceptionModel(const llvm::opt::ArgList &Args) const;
441
442
  /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
443
0
  virtual bool SupportsEmbeddedBitcode() const { return false; }
444
445
  /// getThreadModel() - Which thread model does this target use?
446
38.6k
  virtual std::string getThreadModel() const { return "posix"; }
447
448
  /// isThreadModelSupported() - Does this target support a thread model?
449
  virtual bool isThreadModelSupported(const StringRef Model) const;
450
451
  /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
452
  /// command line arguments into account.
453
  virtual std::string
454
  ComputeLLVMTriple(const llvm::opt::ArgList &Args,
455
                    types::ID InputType = types::TY_INVALID) const;
456
457
  /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
458
  /// target, which may take into account the command line arguments. For
459
  /// example, on Darwin the -mmacosx-version-min= command line argument (which
460
  /// sets the deployment target) determines the version in the triple passed to
461
  /// Clang.
462
  virtual std::string ComputeEffectiveClangTriple(
463
      const llvm::opt::ArgList &Args,
464
      types::ID InputType = types::TY_INVALID) const;
465
466
  /// getDefaultObjCRuntime - Return the default Objective-C runtime
467
  /// for this platform.
468
  ///
469
  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
470
  virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
471
472
  /// hasBlocksRuntime - Given that the user is compiling with
473
  /// -fblocks, does this tool chain guarantee the existence of a
474
  /// blocks runtime?
475
  ///
476
  /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
477
1.62k
  virtual bool hasBlocksRuntime() const { return true; }
478
479
  /// Add the clang cc1 arguments for system include paths.
480
  ///
481
  /// This routine is responsible for adding the necessary cc1 arguments to
482
  /// include headers from standard system header directories.
483
  virtual void
484
  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
485
                            llvm::opt::ArgStringList &CC1Args) const;
486
487
  /// Add options that need to be passed to cc1 for this target.
488
  virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
489
                                     llvm::opt::ArgStringList &CC1Args,
490
                                     Action::OffloadKind DeviceOffloadKind) const;
491
492
  /// Add warning options that need to be passed to cc1 for this target.
493
  virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
494
495
  // GetRuntimeLibType - Determine the runtime library type to use with the
496
  // given compilation arguments.
497
  virtual RuntimeLibType
498
  GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
499
500
  // GetCXXStdlibType - Determine the C++ standard library type to use with the
501
  // given compilation arguments.
502
  virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
503
504
  /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
505
  /// the include paths to use for the given C++ standard library type.
506
  virtual void
507
  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
508
                               llvm::opt::ArgStringList &CC1Args) const;
509
510
  /// Returns if the C++ standard library should be linked in.
511
  /// Note that e.g. -lm should still be linked even if this returns false.
512
  bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
513
514
  /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
515
  /// for the given C++ standard library type.
516
  virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
517
                                   llvm::opt::ArgStringList &CmdArgs) const;
518
519
  /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
520
  void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
521
                          llvm::opt::ArgStringList &CmdArgs) const;
522
523
  /// AddCCKextLibArgs - Add the system specific linker arguments to use
524
  /// for kernel extensions (Darwin-specific).
525
  virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
526
                                llvm::opt::ArgStringList &CmdArgs) const;
527
528
  /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
529
  /// global flags for unsafe floating point math, add it and return true.
530
  ///
531
  /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
532
  virtual bool AddFastMathRuntimeIfAvailable(
533
      const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
534
535
  /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
536
  /// a suitable profile runtime library to the linker.
537
  virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
538
                                llvm::opt::ArgStringList &CmdArgs) const;
539
540
  /// Add arguments to use system-specific CUDA includes.
541
  virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
542
                                  llvm::opt::ArgStringList &CC1Args) const;
543
544
  /// Add arguments to use MCU GCC toolchain includes.
545
  virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
546
                                   llvm::opt::ArgStringList &CC1Args) const;
547
548
  /// On Windows, returns the MSVC compatibility version.
549
  virtual VersionTuple computeMSVCVersion(const Driver *D,
550
                                          const llvm::opt::ArgList &Args) const;
551
552
  /// Return sanitizers which are available in this toolchain.
553
  virtual SanitizerMask getSupportedSanitizers() const;
554
555
  /// Return sanitizers which are enabled by default.
556
33.2k
  virtual SanitizerMask getDefaultSanitizers() const { return 0; }
557
};
558
559
/// Set a ToolChain's effective triple. Reset it when the registration object
560
/// is destroyed.
561
class RegisterEffectiveTriple {
562
  const ToolChain &TC;
563
564
public:
565
41.8k
  RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
566
41.8k
    TC.setEffectiveTriple(std::move(T));
567
41.8k
  }
568
569
41.8k
  ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
570
};
571
572
} // namespace driver
573
574
} // namespace clang
575
576
#endif // LLVM_CLANG_DRIVER_TOOLCHAIN_H