]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Driver/ToolChains/AVR.cpp
Merge ^/head r318658 through r318963.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Driver / ToolChains / AVR.cpp
1 //===--- AVR.cpp - AVR 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 #include "AVR.h"
11 #include "CommonArgs.h"
12 #include "InputInfo.h"
13 #include "clang/Driver/Compilation.h"
14 #include "llvm/Option/ArgList.h"
15
16 using namespace clang::driver;
17 using namespace clang::driver::toolchains;
18 using namespace clang::driver::tools;
19 using namespace clang;
20 using namespace llvm::opt;
21
22 /// AVR Toolchain
23 AVRToolChain::AVRToolChain(const Driver &D, const llvm::Triple &Triple,
24                            const ArgList &Args)
25   : Generic_ELF(D, Triple, Args) { }
26 Tool *AVRToolChain::buildLinker() const {
27   return new tools::AVR::Linker(*this);
28 }
29
30 void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
31                                const InputInfo &Output,
32                                const InputInfoList &Inputs,
33                                const ArgList &Args,
34                                const char *LinkingOutput) const {
35
36   std::string Linker = getToolChain().GetProgramPath(getShortName());
37   ArgStringList CmdArgs;
38   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
39   CmdArgs.push_back("-o");
40   CmdArgs.push_back(Output.getFilename());
41   C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
42                                           CmdArgs, Inputs));
43 }
44 // AVR tools end.