clang  20.0.0git
Fuchsia.h
Go to the documentation of this file.
1 //===--- Fuchsia.h - Fuchsia ToolChain Implementations ----------*- 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_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
11 
12 #include "Gnu.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 
17 namespace clang {
18 namespace driver {
19 namespace tools {
20 namespace fuchsia {
21 class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool {
22 public:
24  : Tool("fuchsia::StaticLibTool", "llvm-ar", TC) {}
25 
26  bool hasIntegratedCPP() const override { return false; }
27  bool isLinkJob() const override { return true; }
28 
29  void ConstructJob(Compilation &C, const JobAction &JA,
30  const InputInfo &Output, const InputInfoList &Inputs,
31  const llvm::opt::ArgList &TCArgs,
32  const char *LinkingOutput) const override;
33 };
34 
35 class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
36 public:
37  Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {}
38 
39  bool hasIntegratedCPP() const override { return false; }
40  bool isLinkJob() const override { return true; }
41 
42  void ConstructJob(Compilation &C, const JobAction &JA,
43  const InputInfo &Output, const InputInfoList &Inputs,
44  const llvm::opt::ArgList &TCArgs,
45  const char *LinkingOutput) const override;
46 };
47 } // end namespace fuchsia
48 } // end namespace tools
49 
50 namespace toolchains {
51 
52 class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
53 public:
54  Fuchsia(const Driver &D, const llvm::Triple &Triple,
55  const llvm::opt::ArgList &Args);
56 
57  bool HasNativeLLVMSupport() const override { return true; }
58  bool IsMathErrnoDefault() const override { return false; }
61  }
63  return ToolChain::CST_Libcxx;
64  }
65  UnwindTableLevel
66  getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override {
67  return UnwindTableLevel::Asynchronous;
68  }
69  bool isPICDefault() const override { return false; }
70  bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
71  return true;
72  }
73  bool isPICDefaultForced() const override { return false; }
74  llvm::DebuggerKind getDefaultDebuggerTuning() const override {
75  return llvm::DebuggerKind::GDB;
76  }
77 
79  GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
81  }
82 
83  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
84  types::ID InputType) const override;
85 
86  SanitizerMask getSupportedSanitizers() const override;
87  SanitizerMask getDefaultSanitizers() const override;
88 
89  RuntimeLibType
90  GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
91  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
92 
94  const llvm::opt::ArgList &Args) const override {
95  return true;
96  }
97 
98  void
99  addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
100  llvm::opt::ArgStringList &CC1Args,
101  Action::OffloadKind DeviceOffloadKind) const override;
102  void
103  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
104  llvm::opt::ArgStringList &CC1Args) const override;
105  void AddClangCXXStdlibIncludeArgs(
106  const llvm::opt::ArgList &DriverArgs,
107  llvm::opt::ArgStringList &CC1Args) const override;
108  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
109  llvm::opt::ArgStringList &CmdArgs) const override;
110 
111  const char *getDefaultLinker() const override { return "ld.lld"; }
112 
113 protected:
114  Tool *buildLinker() const override;
115  Tool *buildStaticLibTool() const override;
116 };
117 
118 } // end namespace toolchains
119 } // end namespace driver
120 } // end namespace clang
121 
122 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
const Decl * D
Defines the clang::LangOptions interface.
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: Fuchsia.h:69
UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override
How detailed should the unwind tables be by default.
Definition: Fuchsia.h:66
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: Fuchsia.h:58
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: Fuchsia.h:73
bool IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain supports outline atomics by default.
Definition: Fuchsia.h:93
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: Fuchsia.h:59
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: Fuchsia.h:57
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Fuchsia.h:74
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: Fuchsia.h:62
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: Fuchsia.h:111
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: Fuchsia.h:70
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: Fuchsia.h:79
Linker(const ToolChain &TC)
Definition: Fuchsia.h:37
bool hasIntegratedCPP() const override
Definition: Fuchsia.h:39
bool isLinkJob() const override
Definition: Fuchsia.h:40
bool hasIntegratedCPP() const override
Definition: Fuchsia.h:26
The JSON file list parser is used to communicate input to InstallAPI.