clang  9.0.0svn
AVR.cpp
Go to the documentation of this file.
1 //===--- AVR.cpp - AVR ToolChain Implementations ----------------*- 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 #include "AVR.h"
10 #include "CommonArgs.h"
11 #include "InputInfo.h"
13 #include "llvm/Option/ArgList.h"
14 
15 using namespace clang::driver;
16 using namespace clang::driver::toolchains;
17 using namespace clang::driver::tools;
18 using namespace clang;
19 using namespace llvm::opt;
20 
21 /// AVR Toolchain
22 AVRToolChain::AVRToolChain(const Driver &D, const llvm::Triple &Triple,
23  const ArgList &Args)
24  : Generic_ELF(D, Triple, Args) { }
26  return new tools::AVR::Linker(*this);
27 }
28 
29 void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
30  const InputInfo &Output,
31  const InputInfoList &Inputs,
32  const ArgList &Args,
33  const char *LinkingOutput) const {
34 
35  std::string Linker = getToolChain().GetProgramPath(getShortName());
36  ArgStringList CmdArgs;
37  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
38  CmdArgs.push_back("-o");
39  CmdArgs.push_back(Output.getFilename());
40  C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
41  CmdArgs, Inputs));
42 }
43 // AVR tools end.
AVRToolChain(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
AVR Toolchain.
Definition: AVR.cpp:22
const char * getFilename() const
Definition: InputInfo.h:83
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:57
void addCommand(std::unique_ptr< Command > C)
Definition: Compilation.h:205
Dataflow Directional Tag Classes.
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
Tool * buildLinker() const override
Definition: AVR.cpp:25
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45