clang  7.0.0svn
NaCl.h
Go to the documentation of this file.
1 //===--- NaCl.h - Native Client ToolChain Implementations -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
12 
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 namespace nacltools {
21 class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler {
22 public:
23  AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {}
24 
25  void ConstructJob(Compilation &C, const JobAction &JA,
26  const InputInfo &Output, const InputInfoList &Inputs,
27  const llvm::opt::ArgList &TCArgs,
28  const char *LinkingOutput) const override;
29 };
30 
31 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
32 public:
33  Linker(const ToolChain &TC) : GnuTool("NaCl::Linker", "linker", TC) {}
34 
35  bool hasIntegratedCPP() const override { return false; }
36  bool isLinkJob() const override { return true; }
37 
38  void ConstructJob(Compilation &C, const JobAction &JA,
39  const InputInfo &Output, const InputInfoList &Inputs,
40  const llvm::opt::ArgList &TCArgs,
41  const char *LinkingOutput) const override;
42 };
43 } // end namespace nacltools
44 } // end namespace tools
45 
46 namespace toolchains {
47 
48 class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
49 public:
50  NaClToolChain(const Driver &D, const llvm::Triple &Triple,
51  const llvm::opt::ArgList &Args);
52 
53  void
54  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
55  llvm::opt::ArgStringList &CC1Args) const override;
56  void addLibCxxIncludePaths(
57  const llvm::opt::ArgList &DriverArgs,
58  llvm::opt::ArgStringList &CC1Args) const override;
59 
60  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
61 
62  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
63  llvm::opt::ArgStringList &CmdArgs) const override;
64 
65  bool IsIntegratedAssemblerDefault() const override {
66  return getTriple().getArch() == llvm::Triple::mipsel;
67  }
68 
69  // Get the path to the file containing NaCl's ARM macros.
70  // It lives in NaClToolChain because the ARMAssembler tool needs a
71  // const char * that it can pass around,
72  const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); }
73 
74  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
75  types::ID InputType) const override;
76 
77 protected:
78  Tool *buildLinker() const override;
79  Tool *buildAssembler() const override;
80 
81 private:
82  std::string NaClArmMacrosPath;
83 };
84 
85 } // end namespace toolchains
86 } // end namespace driver
87 } // end namespace clang
88 
89 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
bool isLinkJob() const override
Definition: NaCl.h:36
bool hasIntegratedCPP() const override
Definition: NaCl.h:35
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: NaCl.h:65
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
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:41
const char * GetNaClArmMacrosPath() const
Definition: NaCl.h:72
Dataflow Directional Tag Classes.
Linker(const ToolChain &TC)
Definition: NaCl.h:33
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:46
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88