xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/CrossWindows.h (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
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)
37       : Tool("CrossWindows::Linker", "ld", TC, RF_Full) {}
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 CrossWindows
48 } // end namespace tools
49 
50 namespace toolchains {
51 
52 class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain : public Generic_GCC {
53 public:
54   CrossWindowsToolChain(const Driver &D, const llvm::Triple &T,
55                         const llvm::opt::ArgList &Args);
56 
57   bool IsIntegratedAssemblerDefault() const override { return true; }
58   bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
59   bool isPICDefault() const override;
60   bool isPIEDefault() const override;
61   bool isPICDefaultForced() const override;
62 
63   unsigned int GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
64     return 0;
65   }
66 
67   void
68   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
69                             llvm::opt::ArgStringList &CC1Args) const override;
70   void AddClangCXXStdlibIncludeArgs(
71       const llvm::opt::ArgList &DriverArgs,
72       llvm::opt::ArgStringList &CC1Args) const override;
73   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
74                            llvm::opt::ArgStringList &CmdArgs) const override;
75 
76   SanitizerMask getSupportedSanitizers() const override;
77 
78 protected:
79   Tool *buildLinker() const override;
80   Tool *buildAssembler() const override;
81 };
82 
83 } // end namespace toolchains
84 } // end namespace driver
85 } // end namespace clang
86 
87 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CROSSWINDOWS_H
88