Coverage Report

Created: 2021-01-23 06:44

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/ToolChains/BareMetal.h
Line
Count
Source (jump to first uncovered line)
1
//===--- BareMetal.h - Bare Metal Tool and ToolChain -------------*- 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_BAREMETAL_H
10
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_BAREMETAL_H
11
12
#include "clang/Driver/Tool.h"
13
#include "clang/Driver/ToolChain.h"
14
15
#include <string>
16
17
namespace clang {
18
namespace driver {
19
20
namespace toolchains {
21
22
class LLVM_LIBRARY_VISIBILITY BareMetal : public ToolChain {
23
public:
24
  BareMetal(const Driver &D, const llvm::Triple &Triple,
25
            const llvm::opt::ArgList &Args);
26
668
  ~BareMetal() override = default;
27
28
  static bool handlesTarget(const llvm::Triple &Triple);
29
30
  void findMultilibs(const Driver &D, const llvm::Triple &Triple,
31
                     const llvm::opt::ArgList &Args);
32
33
protected:
34
  Tool *buildLinker() const override;
35
36
public:
37
3.09k
  bool useIntegratedAs() const override { return true; }
38
187
  bool isCrossCompiling() const override { return true; }
39
658
  bool isPICDefault() const override { return false; }
40
658
  bool isPIEDefault() const override { return false; }
41
658
  bool isPICDefaultForced() const override { return false; }
42
628
  bool SupportsProfiling() const override { return false; }
43
44
0
  StringRef getOSLibName() const override { return "baremetal"; }
45
46
  std::string getCompilerRTPath() const override;
47
  std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
48
                                    StringRef Component,
49
                                    FileType Type = ToolChain::FT_Static,
50
                                    bool AddArch = true) const override;
51
52
183
  RuntimeLibType GetDefaultRuntimeLibType() const override {
53
183
    return ToolChain::RLT_CompilerRT;
54
183
  }
55
29
  CXXStdlibType GetDefaultCXXStdlibType() const override {
56
29
    return ToolChain::CST_Libcxx;
57
29
  }
58
59
187
  const char *getDefaultLinker() const override { return "ld.lld"; }
60
61
  std::string getRuntimesDir() const;
62
  void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
63
                                 llvm::opt::ArgStringList &CC1Args) const override;
64
  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
65
                             llvm::opt::ArgStringList &CC1Args,
66
                             Action::OffloadKind DeviceOffloadKind) const override;
67
  void AddClangCXXStdlibIncludeArgs(
68
      const llvm::opt::ArgList &DriverArgs,
69
      llvm::opt::ArgStringList &CC1Args) const override;
70
  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
71
                           llvm::opt::ArgStringList &CmdArgs) const override;
72
  void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
73
                         llvm::opt::ArgStringList &CmdArgs) const;
74
  std::string computeSysRoot() const override;
75
};
76
77
} // namespace toolchains
78
79
namespace tools {
80
namespace baremetal {
81
82
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
83
public:
84
187
  Linker(const ToolChain &TC) : Tool("baremetal::Linker", "ld.lld", TC) {}
85
0
  bool isLinkJob() const override { return true; }
86
187
  bool hasIntegratedCPP() const override { return false; }
87
  void ConstructJob(Compilation &C, const JobAction &JA,
88
                    const InputInfo &Output, const InputInfoList &Inputs,
89
                    const llvm::opt::ArgList &TCArgs,
90
                    const char *LinkingOutput) const override;
91
};
92
93
} // namespace baremetal
94
} // namespace tools
95
96
} // namespace driver
97
} // namespace clang
98
99
#endif