clang  6.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  std::string findLibCxxIncludePath() const override;
57 
58  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
59 
60  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
61  llvm::opt::ArgStringList &CmdArgs) const override;
62 
63  bool IsIntegratedAssemblerDefault() const override {
64  return getTriple().getArch() == llvm::Triple::mipsel;
65  }
66 
67  // Get the path to the file containing NaCl's ARM macros.
68  // It lives in NaClToolChain because the ARMAssembler tool needs a
69  // const char * that it can pass around,
70  const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); }
71 
72  std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
73  types::ID InputType) const override;
74 
75 protected:
76  Tool *buildLinker() const override;
77  Tool *buildAssembler() const override;
78 
79 private:
80  std::string NaClArmMacrosPath;
81 };
82 
83 } // end namespace toolchains
84 } // end namespace driver
85 } // end namespace clang
86 
87 #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:63
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:65
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:70
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:34
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:73