xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/CrossWindows.h (revision ae41709ab46305df80f7f35bb478a3c8ebf22ebb)
1 //===--- CrossWindows.h - CrossWindows ToolChain Implementation -*- 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_CROSSWINDOWS_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CROSSWINDOWS_H
11 
12 #include "Cuda.h"
13 #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 
21 namespace CrossWindows {
22 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
23 public:
24   Assembler(const ToolChain &TC) : Tool("CrossWindows::Assembler", "as", TC) {}
25 
26   bool hasIntegratedCPP() const override { return false; }
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 
34 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
35 public:
36   Linker(const ToolChain &TC) : Tool("CrossWindows::Linker", "ld", TC) {}
37 
38   bool hasIntegratedCPP() const override { return false; }
39   bool isLinkJob() const override { return true; }
40 
41   void ConstructJob(Compilation &C, const JobAction &JA,
42                     const InputInfo &Output, const InputInfoList &Inputs,
43                     const llvm::opt::ArgList &TCArgs,
44                     const char *LinkingOutput) const override;
45 };
46 } // end namespace CrossWindows
47 } // end namespace tools
48 
49 namespace toolchains {
50 
51 class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : public Generic_GCC {
52 public:
53   CrossWindowsToolChain(const Driver &D, const llvm::Triple &T,
54                         const llvm::opt::ArgList &Args);
55 
56   bool IsIntegratedAssemblerDefault() const override { return true; }
57   bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
58   bool isPICDefault() const override;
59   bool isPIEDefault() const override;
60   bool isPICDefaultForced() const override;
61 
62   unsigned int GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
63     return 0;
64   }
65 
66   void
67   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
68                             llvm::opt::ArgStringList &CC1Args) const override;
69   void AddClangCXXStdlibIncludeArgs(
70       const llvm::opt::ArgList &DriverArgs,
71       llvm::opt::ArgStringList &CC1Args) const override;
72   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
73                            llvm::opt::ArgStringList &CmdArgs) const override;
74 
75   SanitizerMask getSupportedSanitizers() const override;
76 
77 protected:
78   Tool *buildLinker() const override;
79   Tool *buildAssembler() const override;
80 };
81 
82 } // end namespace toolchains
83 } // end namespace driver
84 } // end namespace clang
85 
86 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CROSSWINDOWS_H
87