clang  14.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 Linker : public Tool {
22 public:
23  Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {}
24 
25  bool hasIntegratedCPP() const override { return false; }
26  bool isLinkJob() const override { return true; }
27 
28  void ConstructJob(Compilation &C, const JobAction &JA,
29  const InputInfo &Output, const InputInfoList &Inputs,
30  const llvm::opt::ArgList &TCArgs,
31  const char *LinkingOutput) const override;
32 };
33 } // end namespace fuchsia
34 } // end namespace tools
35 
36 namespace toolchains {
37 
38 class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
39 public:
40  Fuchsia(const Driver &D, const llvm::Triple &Triple,
41  const llvm::opt::ArgList &Args);
42 
43  bool HasNativeLLVMSupport() const override { return true; }
44  bool IsIntegratedAssemblerDefault() const override { return true; }
45  bool IsMathErrnoDefault() const override { return false; }
46  bool useRelaxRelocations() const override { return true; };
49  }
51  return ToolChain::CST_Libcxx;
52  }
53  bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
54  return true;
55  }
56  bool isPICDefault() const override { return false; }
57  bool isPIEDefault() const override { return true; }
58  bool isPICDefaultForced() const override { return false; }
59  llvm::DebuggerKind getDefaultDebuggerTuning() const override {
60  return llvm::DebuggerKind::GDB;
61  }
62 
64  GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
66  }
67 
68  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
69  types::ID InputType) const override;
70 
71  SanitizerMask getSupportedSanitizers() const override;
72  SanitizerMask getDefaultSanitizers() const override;
73 
74  RuntimeLibType
75  GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
76  CXXStdlibType
77  GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
78 
79  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
80  llvm::opt::ArgStringList &CC1Args,
81  Action::OffloadKind DeviceOffloadKind) const override;
82  void
83  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
84  llvm::opt::ArgStringList &CC1Args) const override;
85  void
86  AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
87  llvm::opt::ArgStringList &CC1Args) const override;
88  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
89  llvm::opt::ArgStringList &CmdArgs) const override;
90 
91  const char *getDefaultLinker() const override {
92  return "ld.lld";
93  }
94 
95 protected:
96  Tool *buildLinker() const override;
97 };
98 
99 } // end namespace toolchains
100 } // end namespace driver
101 } // end namespace clang
102 
103 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
clang::driver::toolchains::Fuchsia::IsUnwindTablesDefault
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: Fuchsia.h:53
clang::LangOptions::StackProtectorMode
StackProtectorMode
Definition: LangOptions.h:64
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::toolchains::Fuchsia::isPIEDefault
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: Fuchsia.h:57
clang::LangOptions::SSPStrong
@ SSPStrong
Definition: LangOptions.h:64
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::toolchains::Fuchsia::isPICDefault
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: Fuchsia.h:56
clang::driver::toolchains::Fuchsia::HasNativeLLVMSupport
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: Fuchsia.h:43
clang::driver::toolchains::Fuchsia::GetDefaultRuntimeLibType
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: Fuchsia.h:47
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::driver::tools::fuchsia::Linker::Linker
Linker(const ToolChain &TC)
Definition: Fuchsia.h:23
clang::driver::toolchains::Fuchsia::IsIntegratedAssemblerDefault
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: Fuchsia.h:44
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::toolchains::Fuchsia::getDefaultLinker
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: Fuchsia.h:91
clang::driver::toolchains::Fuchsia::isPICDefaultForced
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: Fuchsia.h:58
LangOptions.h
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
Tool.h
clang::driver::toolchains::Fuchsia::useRelaxRelocations
bool useRelaxRelocations() const override
Check whether to enable x86 relax relocations by default.
Definition: Fuchsia.h:46
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
clang::driver::toolchains::Fuchsia::GetDefaultStackProtectorLevel
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: Fuchsia.h:64
ToolChain.h
clang::driver::toolchains::Fuchsia::getDefaultDebuggerTuning
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Fuchsia.h:59
clang::driver::tools::fuchsia::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: Fuchsia.h:25
Gnu.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::ToolChain::RLT_CompilerRT
@ RLT_CompilerRT
Definition: ToolChain.h:101
clang::driver::toolchains::Fuchsia::IsMathErrnoDefault
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: Fuchsia.h:45
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::tools::fuchsia::Linker
Definition: Fuchsia.h:21
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
clang::driver::toolchains::Fuchsia::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: Fuchsia.h:50
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:85
clang::driver::JobAction
Definition: Action.h:380
clang::driver::tools::fuchsia::Linker::isLinkJob
bool isLinkJob() const override
Definition: Fuchsia.h:26
clang::driver::toolchains::Fuchsia
Definition: Fuchsia.h:38
clang::SanitizerMask
Definition: Sanitizers.h:30