/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Driver/Compilation.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- Compilation.h - Compilation Task Data Structure ----------*- 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_DRIVER_COMPILATION_H |
10 | | #define LLVM_CLANG_DRIVER_COMPILATION_H |
11 | | |
12 | | #include "clang/Basic/LLVM.h" |
13 | | #include "clang/Driver/Action.h" |
14 | | #include "clang/Driver/Job.h" |
15 | | #include "clang/Driver/Util.h" |
16 | | #include "llvm/ADT/ArrayRef.h" |
17 | | #include "llvm/ADT/DenseMap.h" |
18 | | #include "llvm/ADT/Optional.h" |
19 | | #include "llvm/ADT/StringRef.h" |
20 | | #include "llvm/Option/Option.h" |
21 | | #include <cassert> |
22 | | #include <iterator> |
23 | | #include <map> |
24 | | #include <memory> |
25 | | #include <utility> |
26 | | #include <vector> |
27 | | |
28 | | namespace llvm { |
29 | | namespace opt { |
30 | | |
31 | | class DerivedArgList; |
32 | | class InputArgList; |
33 | | |
34 | | } // namespace opt |
35 | | } // namespace llvm |
36 | | |
37 | | namespace clang { |
38 | | namespace driver { |
39 | | |
40 | | class Driver; |
41 | | class ToolChain; |
42 | | |
43 | | /// Compilation - A set of tasks to perform for a single driver |
44 | | /// invocation. |
45 | | class Compilation { |
46 | | /// The driver we were created by. |
47 | | const Driver &TheDriver; |
48 | | |
49 | | /// The default tool chain. |
50 | | const ToolChain &DefaultToolChain; |
51 | | |
52 | | /// A mask of all the programming models the host has to support in the |
53 | | /// current compilation. |
54 | | unsigned ActiveOffloadMask = 0; |
55 | | |
56 | | /// Array with the toolchains of offloading host and devices in the order they |
57 | | /// were requested by the user. We are preserving that order in case the code |
58 | | /// generation needs to derive a programming-model-specific semantic out of |
59 | | /// it. |
60 | | std::multimap<Action::OffloadKind, const ToolChain *> |
61 | | OrderedOffloadingToolchains; |
62 | | |
63 | | /// The original (untranslated) input argument list. |
64 | | llvm::opt::InputArgList *Args; |
65 | | |
66 | | /// The driver translated arguments. Note that toolchains may perform their |
67 | | /// own argument translation. |
68 | | llvm::opt::DerivedArgList *TranslatedArgs; |
69 | | |
70 | | /// The list of actions we've created via MakeAction. This is not accessible |
71 | | /// to consumers; it's here just to manage ownership. |
72 | | std::vector<std::unique_ptr<Action>> AllActions; |
73 | | |
74 | | /// The list of actions. This is maintained and modified by consumers, via |
75 | | /// getActions(). |
76 | | ActionList Actions; |
77 | | |
78 | | /// The root list of jobs. |
79 | | JobList Jobs; |
80 | | |
81 | | /// Cache of translated arguments for a particular tool chain, bound |
82 | | /// architecture, and device offload kind. |
83 | | struct TCArgsKey final { |
84 | | const ToolChain *TC = nullptr; |
85 | | StringRef BoundArch; |
86 | | Action::OffloadKind DeviceOffloadKind = Action::OFK_None; |
87 | | |
88 | | TCArgsKey(const ToolChain *TC, StringRef BoundArch, |
89 | | Action::OffloadKind DeviceOffloadKind) |
90 | 76.0k | : TC(TC), BoundArch(BoundArch), DeviceOffloadKind(DeviceOffloadKind) {} |
91 | | |
92 | 99.7k | bool operator<(const TCArgsKey &K) const { |
93 | 99.7k | if (TC < K.TC) |
94 | 4.34k | return true; |
95 | 95.3k | else if (TC == K.TC && BoundArch < K.BoundArch93.0k ) |
96 | 4.58k | return true; |
97 | 90.7k | else if (TC == K.TC && BoundArch == K.BoundArch88.4k && |
98 | 90.7k | DeviceOffloadKind < K.DeviceOffloadKind86.5k ) |
99 | 325 | return true; |
100 | 90.4k | return false; |
101 | 90.4k | } |
102 | | }; |
103 | | std::map<TCArgsKey, llvm::opt::DerivedArgList *> TCArgs; |
104 | | |
105 | | /// Temporary files which should be removed on exit. |
106 | | llvm::opt::ArgStringList TempFiles; |
107 | | |
108 | | /// Result files which should be removed on failure. |
109 | | ArgStringMap ResultFiles; |
110 | | |
111 | | /// Result files which are generated correctly on failure, and which should |
112 | | /// only be removed if we crash. |
113 | | ArgStringMap FailureResultFiles; |
114 | | |
115 | | /// Optional redirection for stdin, stdout, stderr. |
116 | | std::vector<Optional<StringRef>> Redirects; |
117 | | |
118 | | /// Whether we're compiling for diagnostic purposes. |
119 | | bool ForDiagnostics = false; |
120 | | |
121 | | /// Whether an error during the parsing of the input args. |
122 | | bool ContainsError; |
123 | | |
124 | | /// Whether to keep temporary files regardless of -save-temps. |
125 | | bool ForceKeepTempFiles = false; |
126 | | |
127 | | public: |
128 | | Compilation(const Driver &D, const ToolChain &DefaultToolChain, |
129 | | llvm::opt::InputArgList *Args, |
130 | | llvm::opt::DerivedArgList *TranslatedArgs, bool ContainsError); |
131 | | ~Compilation(); |
132 | | |
133 | 237k | const Driver &getDriver() const { return TheDriver; } |
134 | | |
135 | 222k | const ToolChain &getDefaultToolChain() const { return DefaultToolChain; } |
136 | | |
137 | 0 | unsigned isOffloadingHostKind(Action::OffloadKind Kind) const { |
138 | 0 | return ActiveOffloadMask & Kind; |
139 | 0 | } |
140 | | |
141 | | /// Iterator that visits device toolchains of a given kind. |
142 | | using const_offload_toolchains_iterator = |
143 | | const std::multimap<Action::OffloadKind, |
144 | | const ToolChain *>::const_iterator; |
145 | | using const_offload_toolchains_range = |
146 | | std::pair<const_offload_toolchains_iterator, |
147 | | const_offload_toolchains_iterator>; |
148 | | |
149 | | template <Action::OffloadKind Kind> |
150 | 33.5k | const_offload_toolchains_range getOffloadToolChains() const { |
151 | 33.5k | return OrderedOffloadingToolchains.equal_range(Kind); |
152 | 33.5k | } std::__1::pair<std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const, std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const> clang::driver::Compilation::getOffloadToolChains<(clang::driver::Action::OffloadKind)1>() const Line | Count | Source | 150 | 2.04k | const_offload_toolchains_range getOffloadToolChains() const { | 151 | 2.04k | return OrderedOffloadingToolchains.equal_range(Kind); | 152 | 2.04k | } |
std::__1::pair<std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const, std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const> clang::driver::Compilation::getOffloadToolChains<(clang::driver::Action::OffloadKind)2>() const Line | Count | Source | 150 | 1.05k | const_offload_toolchains_range getOffloadToolChains() const { | 151 | 1.05k | return OrderedOffloadingToolchains.equal_range(Kind); | 152 | 1.05k | } |
std::__1::pair<std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const, std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const> clang::driver::Compilation::getOffloadToolChains<(clang::driver::Action::OffloadKind)8>() const Line | Count | Source | 150 | 73 | const_offload_toolchains_range getOffloadToolChains() const { | 151 | 73 | return OrderedOffloadingToolchains.equal_range(Kind); | 152 | 73 | } |
std::__1::pair<std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const, std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, std::__1::__tree_node<std::__1::__value_type<clang::driver::Action::OffloadKind, clang::driver::ToolChain const*>, void*>*, long> > const> clang::driver::Compilation::getOffloadToolChains<(clang::driver::Action::OffloadKind)4>() const Line | Count | Source | 150 | 30.3k | const_offload_toolchains_range getOffloadToolChains() const { | 151 | 30.3k | return OrderedOffloadingToolchains.equal_range(Kind); | 152 | 30.3k | } |
|
153 | | |
154 | | /// Return true if an offloading tool chain of a given kind exists. |
155 | 60.4k | template <Action::OffloadKind Kind> bool hasOffloadToolChain() const { |
156 | 60.4k | return OrderedOffloadingToolchains.find(Kind) != |
157 | 60.4k | OrderedOffloadingToolchains.end(); |
158 | 60.4k | } bool clang::driver::Compilation::hasOffloadToolChain<(clang::driver::Action::OffloadKind)2>() const Line | Count | Source | 155 | 30.2k | template <Action::OffloadKind Kind> bool hasOffloadToolChain() const { | 156 | 30.2k | return OrderedOffloadingToolchains.find(Kind) != | 157 | 30.2k | OrderedOffloadingToolchains.end(); | 158 | 30.2k | } |
bool clang::driver::Compilation::hasOffloadToolChain<(clang::driver::Action::OffloadKind)8>() const Line | Count | Source | 155 | 30.2k | template <Action::OffloadKind Kind> bool hasOffloadToolChain() const { | 156 | 30.2k | return OrderedOffloadingToolchains.find(Kind) != | 157 | 30.2k | OrderedOffloadingToolchains.end(); | 158 | 30.2k | } |
|
159 | | |
160 | | /// Return an offload toolchain of the provided kind. Only one is expected to |
161 | | /// exist. |
162 | | template <Action::OffloadKind Kind> |
163 | 3.17k | const ToolChain *getSingleOffloadToolChain() const { |
164 | 3.17k | auto TCs = getOffloadToolChains<Kind>(); |
165 | 3.17k | |
166 | 3.17k | assert(TCs.first != TCs.second && |
167 | 3.17k | "No tool chains of the selected kind exist!"); |
168 | 3.17k | assert(std::next(TCs.first) == TCs.second && |
169 | 3.17k | "More than one tool chain of the this kind exist."); |
170 | 3.17k | return TCs.first->second; |
171 | 3.17k | } clang::driver::ToolChain const* clang::driver::Compilation::getSingleOffloadToolChain<(clang::driver::Action::OffloadKind)1>() const Line | Count | Source | 163 | 2.04k | const ToolChain *getSingleOffloadToolChain() const { | 164 | 2.04k | auto TCs = getOffloadToolChains<Kind>(); | 165 | 2.04k | | 166 | 2.04k | assert(TCs.first != TCs.second && | 167 | 2.04k | "No tool chains of the selected kind exist!"); | 168 | 2.04k | assert(std::next(TCs.first) == TCs.second && | 169 | 2.04k | "More than one tool chain of the this kind exist."); | 170 | 2.04k | return TCs.first->second; | 171 | 2.04k | } |
clang::driver::ToolChain const* clang::driver::Compilation::getSingleOffloadToolChain<(clang::driver::Action::OffloadKind)2>() const Line | Count | Source | 163 | 1.05k | const ToolChain *getSingleOffloadToolChain() const { | 164 | 1.05k | auto TCs = getOffloadToolChains<Kind>(); | 165 | 1.05k | | 166 | 1.05k | assert(TCs.first != TCs.second && | 167 | 1.05k | "No tool chains of the selected kind exist!"); | 168 | 1.05k | assert(std::next(TCs.first) == TCs.second && | 169 | 1.05k | "More than one tool chain of the this kind exist."); | 170 | 1.05k | return TCs.first->second; | 171 | 1.05k | } |
clang::driver::ToolChain const* clang::driver::Compilation::getSingleOffloadToolChain<(clang::driver::Action::OffloadKind)8>() const Line | Count | Source | 163 | 73 | const ToolChain *getSingleOffloadToolChain() const { | 164 | 73 | auto TCs = getOffloadToolChains<Kind>(); | 165 | 73 | | 166 | 73 | assert(TCs.first != TCs.second && | 167 | 73 | "No tool chains of the selected kind exist!"); | 168 | 73 | assert(std::next(TCs.first) == TCs.second && | 169 | 73 | "More than one tool chain of the this kind exist."); | 170 | 73 | return TCs.first->second; | 171 | 73 | } |
|
172 | | |
173 | | void addOffloadDeviceToolChain(const ToolChain *DeviceToolChain, |
174 | 396 | Action::OffloadKind OffloadKind) { |
175 | 396 | assert(OffloadKind != Action::OFK_Host && OffloadKind != Action::OFK_None && |
176 | 396 | "This is not a device tool chain!"); |
177 | 396 | |
178 | 396 | // Update the host offload kind to also contain this kind. |
179 | 396 | ActiveOffloadMask |= OffloadKind; |
180 | 396 | OrderedOffloadingToolchains.insert( |
181 | 396 | std::make_pair(OffloadKind, DeviceToolChain)); |
182 | 396 | } |
183 | | |
184 | 61.0k | const llvm::opt::InputArgList &getInputArgs() const { return *Args; } |
185 | | |
186 | 874k | const llvm::opt::DerivedArgList &getArgs() const { return *TranslatedArgs; } |
187 | | |
188 | 453k | llvm::opt::DerivedArgList &getArgs() { return *TranslatedArgs; } |
189 | | |
190 | 82.0k | ActionList &getActions() { return Actions; } |
191 | 62 | const ActionList &getActions() const { return Actions; } |
192 | | |
193 | | /// Creates a new Action owned by this Compilation. |
194 | | /// |
195 | | /// The new Action is *not* added to the list returned by getActions(). |
196 | 159k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { |
197 | 159k | T *RawPtr = new T(std::forward<Args>(Arg)...); |
198 | 159k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); |
199 | 159k | return RawPtr; |
200 | 159k | } clang::driver::OffloadAction* clang::driver::Compilation::MakeAction<clang::driver::OffloadAction, clang::driver::OffloadAction::DeviceDependences&, clang::driver::types::ID>(clang::driver::OffloadAction::DeviceDependences&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 503 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 503 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 503 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 503 | return RawPtr; | 200 | 503 | } |
clang::driver::InputAction* clang::driver::Compilation::MakeAction<clang::driver::InputAction, llvm::opt::Arg const&, clang::driver::types::ID>(llvm::opt::Arg const&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 100 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 100 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 100 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 100 | return RawPtr; | 200 | 100 | } |
clang::driver::OffloadAction* clang::driver::Compilation::MakeAction<clang::driver::OffloadAction, clang::driver::OffloadAction::HostDependence&, clang::driver::OffloadAction::DeviceDependences&>(clang::driver::OffloadAction::HostDependence&&&, clang::driver::OffloadAction::DeviceDependences&&&) Line | Count | Source | 196 | 344 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 344 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 344 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 344 | return RawPtr; | 200 | 344 | } |
clang::driver::OffloadUnbundlingJobAction* clang::driver::Compilation::MakeAction<clang::driver::OffloadUnbundlingJobAction, clang::driver::Action*&>(clang::driver::Action*&&&) Line | Count | Source | 196 | 20 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 20 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 20 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 20 | return RawPtr; | 200 | 20 | } |
clang::driver::OffloadBundlingJobAction* clang::driver::Compilation::MakeAction<clang::driver::OffloadBundlingJobAction, llvm::SmallVector<clang::driver::Action*, 3u>&>(llvm::SmallVector<clang::driver::Action*, 3u>&&&) Line | Count | Source | 196 | 30 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 30 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 30 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 30 | return RawPtr; | 200 | 30 | } |
clang::driver::BindArchAction* clang::driver::Compilation::MakeAction<clang::driver::BindArchAction, clang::driver::Action*&, char const*&>(clang::driver::Action*&&&, char const*&&&) Line | Count | Source | 196 | 22.9k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 22.9k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 22.9k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 22.9k | return RawPtr; | 200 | 22.9k | } |
clang::driver::LipoJobAction* clang::driver::Compilation::MakeAction<clang::driver::LipoJobAction, llvm::SmallVector<clang::driver::Action*, 3u>&, clang::driver::types::ID>(llvm::SmallVector<clang::driver::Action*, 3u>&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 862 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 862 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 862 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 862 | return RawPtr; | 200 | 862 | } |
clang::driver::DsymutilJobAction* clang::driver::Compilation::MakeAction<clang::driver::DsymutilJobAction, llvm::SmallVector<clang::driver::Action*, 3u>&, clang::driver::types::ID>(llvm::SmallVector<clang::driver::Action*, 3u>&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 37 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 37 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 37 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 37 | return RawPtr; | 200 | 37 | } |
clang::driver::VerifyDebugInfoJobAction* clang::driver::Compilation::MakeAction<clang::driver::VerifyDebugInfoJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 3 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 3 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 3 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 3 | return RawPtr; | 200 | 3 | } |
clang::driver::InputAction* clang::driver::Compilation::MakeAction<clang::driver::InputAction, llvm::opt::Arg const&, clang::driver::types::ID&>(llvm::opt::Arg const&&&, clang::driver::types::ID&&&) Line | Count | Source | 196 | 43.0k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 43.0k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 43.0k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 43.0k | return RawPtr; | 200 | 43.0k | } |
clang::driver::LinkJobAction* clang::driver::Compilation::MakeAction<clang::driver::LinkJobAction, llvm::SmallVector<clang::driver::Action*, 3u>&, clang::driver::types::ID>(llvm::SmallVector<clang::driver::Action*, 3u>&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 5.50k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 5.50k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 5.50k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 5.50k | return RawPtr; | 200 | 5.50k | } |
clang::driver::InputAction* clang::driver::Compilation::MakeAction<clang::driver::InputAction, llvm::opt::Arg const&, clang::driver::types::ID const&>(llvm::opt::Arg const&&&, clang::driver::types::ID const&&&) Line | Count | Source | 196 | 17 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 17 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 17 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 17 | return RawPtr; | 200 | 17 | } |
clang::driver::InputAction* clang::driver::Compilation::MakeAction<clang::driver::InputAction, llvm::opt::Arg&, clang::driver::types::ID>(llvm::opt::Arg&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 4 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 4 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 4 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 4 | return RawPtr; | 200 | 4 | } |
clang::driver::PrecompileJobAction* clang::driver::Compilation::MakeAction<clang::driver::PrecompileJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 4 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 4 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 4 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 4 | return RawPtr; | 200 | 4 | } |
clang::driver::PreprocessJobAction* clang::driver::Compilation::MakeAction<clang::driver::PreprocessJobAction, clang::driver::Action*&, clang::driver::types::ID&>(clang::driver::Action*&&&, clang::driver::types::ID&&&) Line | Count | Source | 196 | 23.9k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 23.9k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 23.9k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 23.9k | return RawPtr; | 200 | 23.9k | } |
clang::driver::HeaderModulePrecompileJobAction* clang::driver::Compilation::MakeAction<clang::driver::HeaderModulePrecompileJobAction, clang::driver::Action*&, clang::driver::types::ID&, char const*&>(clang::driver::Action*&&&, clang::driver::types::ID&&&, char const*&&&) Line | Count | Source | 196 | 3 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 3 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 3 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 3 | return RawPtr; | 200 | 3 | } |
clang::driver::PrecompileJobAction* clang::driver::Compilation::MakeAction<clang::driver::PrecompileJobAction, clang::driver::Action*&, clang::driver::types::ID&>(clang::driver::Action*&&&, clang::driver::types::ID&&&) Line | Count | Source | 196 | 62 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 62 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 62 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 62 | return RawPtr; | 200 | 62 | } |
clang::driver::CompileJobAction* clang::driver::Compilation::MakeAction<clang::driver::CompileJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 26.3k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 26.3k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 26.3k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 26.3k | return RawPtr; | 200 | 26.3k | } |
clang::driver::AnalyzeJobAction* clang::driver::Compilation::MakeAction<clang::driver::AnalyzeJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 18 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 18 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 18 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 18 | return RawPtr; | 200 | 18 | } |
Unexecuted instantiation: clang::driver::MigrateJobAction* clang::driver::Compilation::MakeAction<clang::driver::MigrateJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) clang::driver::VerifyPCHJobAction* clang::driver::Compilation::MakeAction<clang::driver::VerifyPCHJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 2 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 2 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 2 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 2 | return RawPtr; | 200 | 2 | } |
clang::driver::BackendJobAction* clang::driver::Compilation::MakeAction<clang::driver::BackendJobAction, clang::driver::Action*&, clang::driver::types::ID&>(clang::driver::Action*&&&, clang::driver::types::ID&&&) Line | Count | Source | 196 | 454 | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 454 | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 454 | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 454 | return RawPtr; | 200 | 454 | } |
clang::driver::BackendJobAction* clang::driver::Compilation::MakeAction<clang::driver::BackendJobAction, clang::driver::Action*&, clang::driver::types::ID>(clang::driver::Action*&&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 17.3k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 17.3k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 17.3k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 17.3k | return RawPtr; | 200 | 17.3k | } |
clang::driver::AssembleJobAction* clang::driver::Compilation::MakeAction<clang::driver::AssembleJobAction, clang::driver::Action*, clang::driver::types::ID>(clang::driver::Action*&&, clang::driver::types::ID&&) Line | Count | Source | 196 | 17.7k | template <typename T, typename... Args> T *MakeAction(Args &&... Arg) { | 197 | 17.7k | T *RawPtr = new T(std::forward<Args>(Arg)...); | 198 | 17.7k | AllActions.push_back(std::unique_ptr<Action>(RawPtr)); | 199 | 17.7k | return RawPtr; | 200 | 17.7k | } |
|
201 | | |
202 | 48.2k | JobList &getJobs() { return Jobs; } |
203 | 0 | const JobList &getJobs() const { return Jobs; } |
204 | | |
205 | 37.7k | void addCommand(std::unique_ptr<Command> C) { Jobs.addJob(std::move(C)); } |
206 | | |
207 | 22 | const llvm::opt::ArgStringList &getTempFiles() const { return TempFiles; } |
208 | | |
209 | 205 | const ArgStringMap &getResultFiles() const { return ResultFiles; } |
210 | | |
211 | 6 | const ArgStringMap &getFailureResultFiles() const { |
212 | 6 | return FailureResultFiles; |
213 | 6 | } |
214 | | |
215 | | /// Returns the sysroot path. |
216 | | StringRef getSysRoot() const; |
217 | | |
218 | | /// getArgsForToolChain - Return the derived argument list for the |
219 | | /// tool chain \p TC (or the default tool chain, if TC is not specified). |
220 | | /// If a device offloading kind is specified, a translation specific for that |
221 | | /// kind is performed, if any. |
222 | | /// |
223 | | /// \param BoundArch - The bound architecture name, or 0. |
224 | | /// \param DeviceOffloadKind - The offload device kind that should be used in |
225 | | /// the translation, if any. |
226 | | const llvm::opt::DerivedArgList & |
227 | | getArgsForToolChain(const ToolChain *TC, StringRef BoundArch, |
228 | | Action::OffloadKind DeviceOffloadKind); |
229 | | |
230 | | /// addTempFile - Add a file to remove on exit, and returns its |
231 | | /// argument. |
232 | 7.37k | const char *addTempFile(const char *Name) { |
233 | 7.37k | TempFiles.push_back(Name); |
234 | 7.37k | return Name; |
235 | 7.37k | } |
236 | | |
237 | | /// addResultFile - Add a file to remove on failure, and returns its |
238 | | /// argument. |
239 | 21.8k | const char *addResultFile(const char *Name, const JobAction *JA) { |
240 | 21.8k | ResultFiles[JA] = Name; |
241 | 21.8k | return Name; |
242 | 21.8k | } |
243 | | |
244 | | /// addFailureResultFile - Add a file to remove if we crash, and returns its |
245 | | /// argument. |
246 | 8.42k | const char *addFailureResultFile(const char *Name, const JobAction *JA) { |
247 | 8.42k | FailureResultFiles[JA] = Name; |
248 | 8.42k | return Name; |
249 | 8.42k | } |
250 | | |
251 | | /// CleanupFile - Delete a given file. |
252 | | /// |
253 | | /// \param IssueErrors - Report failures as errors. |
254 | | /// \return Whether the file was removed successfully. |
255 | | bool CleanupFile(const char *File, bool IssueErrors = false) const; |
256 | | |
257 | | /// CleanupFileList - Remove the files in the given list. |
258 | | /// |
259 | | /// \param IssueErrors - Report failures as errors. |
260 | | /// \return Whether all files were removed successfully. |
261 | | bool CleanupFileList(const llvm::opt::ArgStringList &Files, |
262 | | bool IssueErrors = false) const; |
263 | | |
264 | | /// CleanupFileMap - Remove the files in the given map. |
265 | | /// |
266 | | /// \param JA - If specified, only delete the files associated with this |
267 | | /// JobAction. Otherwise, delete all files in the map. |
268 | | /// \param IssueErrors - Report failures as errors. |
269 | | /// \return Whether all files were removed successfully. |
270 | | bool CleanupFileMap(const ArgStringMap &Files, |
271 | | const JobAction *JA, |
272 | | bool IssueErrors = false) const; |
273 | | |
274 | | /// ExecuteCommand - Execute an actual command. |
275 | | /// |
276 | | /// \param FailingCommand - For non-zero results, this will be set to the |
277 | | /// Command which failed, if any. |
278 | | /// \return The result code of the subprocess. |
279 | | int ExecuteCommand(const Command &C, const Command *&FailingCommand) const; |
280 | | |
281 | | /// ExecuteJob - Execute a single job. |
282 | | /// |
283 | | /// \param FailingCommands - For non-zero results, this will be a vector of |
284 | | /// failing commands and their associated result code. |
285 | | void ExecuteJobs( |
286 | | const JobList &Jobs, |
287 | | SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands) const; |
288 | | |
289 | | /// initCompilationForDiagnostics - Remove stale state and suppress output |
290 | | /// so compilation can be reexecuted to generate additional diagnostic |
291 | | /// information (e.g., preprocessed source(s)). |
292 | | void initCompilationForDiagnostics(); |
293 | | |
294 | | /// Return true if we're compiling for diagnostics. |
295 | 59.3k | bool isForDiagnostics() const { return ForDiagnostics; } |
296 | | |
297 | | /// Return whether an error during the parsing of the input args. |
298 | 22.1k | bool containsError() const { return ContainsError; } |
299 | | |
300 | | /// Redirect - Redirect output of this compilation. Can only be done once. |
301 | | /// |
302 | | /// \param Redirects - array of optional paths. The array should have a size |
303 | | /// of three. The inferior process's stdin(0), stdout(1), and stderr(2) will |
304 | | /// be redirected to the corresponding paths, if provided (not llvm::None). |
305 | | void Redirect(ArrayRef<Optional<StringRef>> Redirects); |
306 | | }; |
307 | | |
308 | | } // namespace driver |
309 | | } // namespace clang |
310 | | |
311 | | #endif // LLVM_CLANG_DRIVER_COMPILATION_H |