clang  10.0.0svn
NaCl.h
Go to the documentation of this file.
1 //===--- NaCl.h - Native Client 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_NACL_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
11 
12 #include "Gnu.h"
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
15 
16 namespace clang {
17 namespace driver {
18 namespace tools {
19 namespace nacltools {
20 class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler {
21 public:
22  AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {}
23 
24  void ConstructJob(Compilation &C, const JobAction &JA,
25  const InputInfo &Output, const InputInfoList &Inputs,
26  const llvm::opt::ArgList &TCArgs,
27  const char *LinkingOutput) const override;
28 };
29 
30 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
31 public:
32  Linker(const ToolChain &TC) : GnuTool("NaCl::Linker", "linker", TC) {}
33 
34  bool hasIntegratedCPP() const override { return false; }
35  bool isLinkJob() const override { return true; }
36 
37  void ConstructJob(Compilation &C, const JobAction &JA,
38  const InputInfo &Output, const InputInfoList &Inputs,
39  const llvm::opt::ArgList &TCArgs,
40  const char *LinkingOutput) const override;
41 };
42 } // end namespace nacltools
43 } // end namespace tools
44 
45 namespace toolchains {
46 
47 class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
48 public:
49  NaClToolChain(const Driver &D, const llvm::Triple &Triple,
50  const llvm::opt::ArgList &Args);
51 
52  void
53  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
54  llvm::opt::ArgStringList &CC1Args) const override;
55  void addLibCxxIncludePaths(
56  const llvm::opt::ArgList &DriverArgs,
57  llvm::opt::ArgStringList &CC1Args) const override;
58 
59  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
60 
61  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
62  llvm::opt::ArgStringList &CmdArgs) const override;
63 
64  bool IsIntegratedAssemblerDefault() const override {
65  return getTriple().getArch() == llvm::Triple::mipsel;
66  }
67 
68  // Get the path to the file containing NaCl's ARM macros.
69  // It lives in NaClToolChain because the ARMAssembler tool needs a
70  // const char * that it can pass around,
71  const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); }
72 
73  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
74  types::ID InputType) const override;
75 
76 protected:
77  Tool *buildLinker() const override;
78  Tool *buildAssembler() const override;
79 
80 private:
81  std::string NaClArmMacrosPath;
82 };
83 
84 } // end namespace toolchains
85 } // end namespace driver
86 } // end namespace clang
87 
88 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
bool isLinkJob() const override
Definition: NaCl.h:35
bool hasIntegratedCPP() const override
Definition: NaCl.h:34
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: NaCl.h:64
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
Base class for all GNU tools that provide the same behavior when it comes to response files support...
Definition: Gnu.h:40
const char * GetNaClArmMacrosPath() const
Definition: NaCl.h:71
Dataflow Directional Tag Classes.
Linker(const ToolChain &TC)
Definition: NaCl.h:32
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88