 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
21.5% |
20 / 93 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
43.0% |
40 / 93 |
| |
|
Line Coverage: |
76.2% |
77 / 101 |
| |
 |
|
 |
1 : //===--- Tools.h - Tool 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 CLANG_LIB_DRIVER_TOOLS_H_
11 : #define CLANG_LIB_DRIVER_TOOLS_H_
12 :
13 : #include "clang/Driver/Tool.h"
14 : #include "clang/Driver/Types.h"
15 : #include "clang/Driver/Util.h"
16 :
17 : #include "llvm/Support/Compiler.h"
18 :
19 : namespace clang {
20 : namespace driver {
21 : class Driver;
22 :
23 : namespace toolchains {
24 : class Darwin;
25 : }
26 :
27 : namespace tools {
28 :
192: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
29 192: class VISIBILITY_HIDDEN Clang : public Tool {
30 : void AddPreprocessingOptions(const Driver &D,
31 : const ArgList &Args,
32 : ArgStringList &CmdArgs,
33 : const InputInfo &Output,
34 : const InputInfoList &Inputs) const;
35 :
36 : void AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
37 : void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
38 :
39 : public:
40 192: Clang(const ToolChain &TC) : Tool("clang", TC) {}
41 :
42 195: virtual bool acceptsPipedInput() const { return true; }
43 193: virtual bool canPipeOutput() const { return true; }
44 0: virtual bool hasIntegratedAssembler() const { return true; }
45 145: virtual bool hasIntegratedCPP() const { return true; }
46 :
47 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
48 : Job &Dest,
49 : const InputInfo &Output,
50 : const InputInfoList &Inputs,
51 : const ArgList &TCArgs,
52 : const char *LinkingOutput) const;
53 : };
54 :
55 : /// gcc - Generic GCC tool implementations.
56 : namespace gcc {
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
0: branch 9 not taken
29: branch 10 taken
57 29: class VISIBILITY_HIDDEN Common : public Tool {
58 : public:
59 29: Common(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
60 :
61 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
62 : Job &Dest,
63 : const InputInfo &Output,
64 : const InputInfoList &Inputs,
65 : const ArgList &TCArgs,
66 : const char *LinkingOutput) const;
67 :
68 : /// RenderExtraToolArgs - Render any arguments necessary to force
69 : /// the particular tool mode.
70 : virtual void RenderExtraToolArgs(const JobAction &JA,
71 : ArgStringList &CmdArgs) const = 0;
72 : };
73 :
74 :
3: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
75 3: class VISIBILITY_HIDDEN Preprocess : public Common {
76 : public:
77 3: Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", TC) {}
78 :
79 3: virtual bool acceptsPipedInput() const { return true; }
80 3: virtual bool canPipeOutput() const { return true; }
81 0: virtual bool hasIntegratedCPP() const { return false; }
82 :
83 : virtual void RenderExtraToolArgs(const JobAction &JA,
84 : ArgStringList &CmdArgs) const;
85 : };
86 :
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
87 1: class VISIBILITY_HIDDEN Precompile : public Common {
88 : public:
89 1: Precompile(const ToolChain &TC) : Common("gcc::Precompile", TC) {}
90 :
91 1: virtual bool acceptsPipedInput() const { return true; }
92 1: virtual bool canPipeOutput() const { return false; }
93 1: virtual bool hasIntegratedCPP() const { return true; }
94 :
95 : virtual void RenderExtraToolArgs(const JobAction &JA,
96 : ArgStringList &CmdArgs) const;
97 : };
98 :
7: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
99 7: class VISIBILITY_HIDDEN Compile : public Common {
100 : public:
101 7: Compile(const ToolChain &TC) : Common("gcc::Compile", TC) {}
102 :
103 7: virtual bool acceptsPipedInput() const { return true; }
104 7: virtual bool canPipeOutput() const { return true; }
105 5: virtual bool hasIntegratedCPP() const { return true; }
106 :
107 : virtual void RenderExtraToolArgs(const JobAction &JA,
108 : ArgStringList &CmdArgs) const;
109 : };
110 :
10: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
111 10: class VISIBILITY_HIDDEN Assemble : public Common {
112 : public:
113 10: Assemble(const ToolChain &TC) : Common("gcc::Assemble", TC) {}
114 :
115 10: virtual bool acceptsPipedInput() const { return true; }
116 4: virtual bool canPipeOutput() const { return false; }
117 0: virtual bool hasIntegratedCPP() const { return false; }
118 :
119 : virtual void RenderExtraToolArgs(const JobAction &JA,
120 : ArgStringList &CmdArgs) const;
121 : };
122 :
8: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
123 8: class VISIBILITY_HIDDEN Link : public Common {
124 : public:
125 8: Link(const ToolChain &TC) : Common("gcc::Link", TC) {}
126 :
127 8: virtual bool acceptsPipedInput() const { return false; }
128 8: virtual bool canPipeOutput() const { return false; }
129 0: virtual bool hasIntegratedCPP() const { return false; }
130 :
131 : virtual void RenderExtraToolArgs(const JobAction &JA,
132 : ArgStringList &CmdArgs) const;
133 : };
134 : } // end namespace gcc
135 :
136 : namespace darwin {
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
0: branch 9 not taken
33: branch 10 taken
137 33: class VISIBILITY_HIDDEN DarwinTool : public Tool {
138 : protected:
139 : void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const;
140 :
141 162: const toolchains::Darwin &getDarwinToolChain() const {
142 162: return reinterpret_cast<const toolchains::Darwin&>(getToolChain());
143 : }
144 :
145 : public:
146 33: DarwinTool(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
147 : };
148 :
0: branch 1 not taken
3: branch 2 taken
0: branch 5 not taken
0: branch 6 not taken
0: branch 10 not taken
149 3: class VISIBILITY_HIDDEN CC1 : public DarwinTool {
150 : public:
151 : static const char *getBaseInputName(const ArgList &Args,
152 : const InputInfoList &Input);
153 : static const char *getBaseInputStem(const ArgList &Args,
154 : const InputInfoList &Input);
155 : static const char *getDependencyFileName(const ArgList &Args,
156 : const InputInfoList &Inputs);
157 :
158 : protected:
159 : const char *getCC1Name(types::ID Type) const;
160 :
161 : void AddCC1Args(const ArgList &Args, ArgStringList &CmdArgs) const;
162 : void AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
163 : const InputInfoList &Inputs,
164 : const ArgStringList &OutputArgs) const;
165 : void AddCPPOptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
166 : const InputInfoList &Inputs,
167 : const ArgStringList &OutputArgs) const;
168 : void AddCPPUniqueOptionsArgs(const ArgList &Args,
169 : ArgStringList &CmdArgs,
170 : const InputInfoList &Inputs) const;
171 : void AddCPPArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
172 :
173 : public:
174 3: CC1(const char *Name, const ToolChain &TC) : DarwinTool(Name, TC) {}
175 :
176 3: virtual bool acceptsPipedInput() const { return true; }
177 3: virtual bool canPipeOutput() const { return true; }
178 1: virtual bool hasIntegratedCPP() const { return true; }
179 : };
180 :
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
181 1: class VISIBILITY_HIDDEN Preprocess : public CC1 {
182 : public:
183 1: Preprocess(const ToolChain &TC) : CC1("darwin::Preprocess", TC) {}
184 :
185 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
186 : Job &Dest,
187 : const InputInfo &Output,
188 : const InputInfoList &Inputs,
189 : const ArgList &TCArgs,
190 : const char *LinkingOutput) const;
191 : };
192 :
2: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
193 2: class VISIBILITY_HIDDEN Compile : public CC1 {
194 : public:
195 2: Compile(const ToolChain &TC) : CC1("darwin::Compile", TC) {}
196 :
197 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
198 : Job &Dest,
199 : const InputInfo &Output,
200 : const InputInfoList &Inputs,
201 : const ArgList &TCArgs,
202 : const char *LinkingOutput) const;
203 : };
204 :
9: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
205 9: class VISIBILITY_HIDDEN Assemble : public DarwinTool {
206 : public:
207 9: Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble", TC) {}
208 :
209 9: virtual bool acceptsPipedInput() const { return true; }
210 2: virtual bool canPipeOutput() const { return false; }
211 0: virtual bool hasIntegratedCPP() const { return false; }
212 :
213 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
214 : Job &Dest,
215 : const InputInfo &Output,
216 : const InputInfoList &Inputs,
217 : const ArgList &TCArgs,
218 : const char *LinkingOutput) const;
219 : };
220 :
19: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
221 19: class VISIBILITY_HIDDEN Link : public DarwinTool {
222 : void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
223 :
224 : public:
225 19: Link(const ToolChain &TC) : DarwinTool("darwin::Link", TC) {}
226 :
227 18: virtual bool acceptsPipedInput() const { return false; }
228 15: virtual bool canPipeOutput() const { return false; }
229 0: virtual bool hasIntegratedCPP() const { return false; }
230 :
231 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
232 : Job &Dest,
233 : const InputInfo &Output,
234 : const InputInfoList &Inputs,
235 : const ArgList &TCArgs,
236 : const char *LinkingOutput) const;
237 : };
238 :
2: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
239 2: class VISIBILITY_HIDDEN Lipo : public DarwinTool {
240 : public:
241 2: Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", TC) {}
242 :
243 0: virtual bool acceptsPipedInput() const { return false; }
244 2: virtual bool canPipeOutput() const { return false; }
245 0: virtual bool hasIntegratedCPP() const { return false; }
246 :
247 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
248 : Job &Dest,
249 : const InputInfo &Output,
250 : const InputInfoList &Inputs,
251 : const ArgList &TCArgs,
252 : const char *LinkingOutput) const;
253 : };
254 : }
255 :
256 : /// openbsd -- Directly call GNU Binutils assembler and linker
257 : namespace openbsd {
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
258 1: class VISIBILITY_HIDDEN Assemble : public Tool {
259 : public:
260 1: Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", TC) {}
261 :
262 1: virtual bool acceptsPipedInput() const { return true; }
263 1: virtual bool canPipeOutput() const { return true; }
264 0: virtual bool hasIntegratedCPP() const { return false; }
265 :
266 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
267 : Job &Dest,
268 : const InputInfo &Output,
269 : const InputInfoList &Inputs,
270 : const ArgList &TCArgs,
271 : const char *LinkingOutput) const;
272 : };
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
273 1: class VISIBILITY_HIDDEN Link : public Tool {
274 : public:
275 1: Link(const ToolChain &TC) : Tool("openbsd::Link", TC) {}
276 :
277 1: virtual bool acceptsPipedInput() const { return true; }
278 1: virtual bool canPipeOutput() const { return true; }
279 0: virtual bool hasIntegratedCPP() const { return false; }
280 :
281 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
282 : Job &Dest,
283 : const InputInfo &Output,
284 : const InputInfoList &Inputs,
285 : const ArgList &TCArgs,
286 : const char *LinkingOutput) const;
287 : };
288 : } // end namespace openbsd
289 :
290 : /// freebsd -- Directly call GNU Binutils assembler and linker
291 : namespace freebsd {
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
292 1: class VISIBILITY_HIDDEN Assemble : public Tool {
293 : public:
294 1: Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", TC) {}
295 :
296 1: virtual bool acceptsPipedInput() const { return true; }
297 1: virtual bool canPipeOutput() const { return true; }
298 0: virtual bool hasIntegratedCPP() const { return false; }
299 :
300 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
301 : Job &Dest,
302 : const InputInfo &Output,
303 : const InputInfoList &Inputs,
304 : const ArgList &TCArgs,
305 : const char *LinkingOutput) const;
306 : };
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
307 1: class VISIBILITY_HIDDEN Link : public Tool {
308 : public:
309 1: Link(const ToolChain &TC) : Tool("freebsd::Link", TC) {}
310 :
311 1: virtual bool acceptsPipedInput() const { return true; }
312 1: virtual bool canPipeOutput() const { return true; }
313 0: virtual bool hasIntegratedCPP() const { return false; }
314 :
315 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
316 : Job &Dest,
317 : const InputInfo &Output,
318 : const InputInfoList &Inputs,
319 : const ArgList &TCArgs,
320 : const char *LinkingOutput) const;
321 : };
322 : } // end namespace freebsd
323 :
324 : /// auroraux -- Directly call GNU Binutils assembler and linker
325 : namespace auroraux {
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
326 0: class VISIBILITY_HIDDEN Assemble : public Tool {
327 : public:
328 0: Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", TC) {}
329 :
330 0: virtual bool acceptsPipedInput() const { return true; }
331 0: virtual bool canPipeOutput() const { return true; }
332 0: virtual bool hasIntegratedCPP() const { return false; }
333 :
334 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
335 : Job &Dest,
336 : const InputInfo &Output,
337 : const InputInfoList &Inputs,
338 : const ArgList &TCArgs,
339 : const char *LinkingOutput) const;
340 : };
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
341 0: class VISIBILITY_HIDDEN Link : public Tool {
342 : public:
343 0: Link(const ToolChain &TC) : Tool("auroraux::Link", TC) {}
344 :
345 0: virtual bool acceptsPipedInput() const { return true; }
346 0: virtual bool canPipeOutput() const { return true; }
347 0: virtual bool hasIntegratedCPP() const { return false; }
348 :
349 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
350 : Job &Dest,
351 : const InputInfo &Output,
352 : const InputInfoList &Inputs,
353 : const ArgList &TCArgs,
354 : const char *LinkingOutput) const;
355 : };
356 : } // end namespace auroraux
357 :
358 : /// dragonfly -- Directly call GNU Binutils assembler and linker
359 : namespace dragonfly {
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
360 1: class VISIBILITY_HIDDEN Assemble : public Tool {
361 : public:
362 1: Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", TC) {}
363 :
364 1: virtual bool acceptsPipedInput() const { return true; }
365 1: virtual bool canPipeOutput() const { return true; }
366 0: virtual bool hasIntegratedCPP() const { return false; }
367 :
368 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
369 : Job &Dest,
370 : const InputInfo &Output,
371 : const InputInfoList &Inputs,
372 : const ArgList &TCArgs,
373 : const char *LinkingOutput) const;
374 : };
1: branch 1 taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
375 1: class VISIBILITY_HIDDEN Link : public Tool {
376 : public:
377 1: Link(const ToolChain &TC) : Tool("dragonfly::Link", TC) {}
378 :
379 1: virtual bool acceptsPipedInput() const { return true; }
380 1: virtual bool canPipeOutput() const { return true; }
381 0: virtual bool hasIntegratedCPP() const { return false; }
382 :
383 : virtual void ConstructJob(Compilation &C, const JobAction &JA,
384 : Job &Dest,
385 : const InputInfo &Output,
386 : const InputInfoList &Inputs,
387 : const ArgList &TCArgs,
388 : const char *LinkingOutput) const;
389 : };
390 : } // end namespace dragonfly
391 :
392 : } // end namespace toolchains
393 : } // end namespace driver
394 : } // end namespace clang
395 :
396 : #endif // CLANG_LIB_DRIVER_TOOLS_H_
Generated: 2010-02-10 01:31 by zcov