clang  14.0.0git
AVR.h
Go to the documentation of this file.
1 //===--- AVR.h - AVR Tool and 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 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
11 
12 #include "Gnu.h"
13 #include "clang/Driver/InputInfo.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 
17 namespace clang {
18 namespace driver {
19 namespace toolchains {
20 
21 class LLVM_LIBRARY_VISIBILITY AVRToolChain : public Generic_ELF {
22 public:
23  AVRToolChain(const Driver &D, const llvm::Triple &Triple,
24  const llvm::opt::ArgList &Args);
25  void
26  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
27  llvm::opt::ArgStringList &CC1Args) const override;
28 
29  void
30  addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
31  llvm::opt::ArgStringList &CC1Args,
32  Action::OffloadKind DeviceOffloadKind) const override;
33 
34 protected:
35  Tool *buildLinker() const override;
36 
37 private:
38  /// Whether libgcc, libct, and friends should be linked.
39  ///
40  /// This is not done if the user does not specify a
41  /// microcontroller on the command line.
42  bool LinkStdlib;
43 
44  llvm::Optional<std::string> findAVRLibcInstallation() const;
45 };
46 
47 } // end namespace toolchains
48 
49 namespace tools {
50 namespace AVR {
51 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
52 public:
53  Linker(const llvm::Triple &Triple, const ToolChain &TC, bool LinkStdlib)
54  : Tool("AVR::Linker", "avr-ld", TC), Triple(Triple),
55  LinkStdlib(LinkStdlib) {}
56 
57  bool hasIntegratedCPP() const override { return false; }
58  bool isLinkJob() const override { return true; }
59  void ConstructJob(Compilation &C, const JobAction &JA,
60  const InputInfo &Output, const InputInfoList &Inputs,
61  const llvm::opt::ArgList &TCArgs,
62  const char *LinkingOutput) const override;
63 
64 protected:
65  const llvm::Triple &Triple;
66  bool LinkStdlib;
67 };
68 } // end namespace AVR
69 } // end namespace tools
70 } // end namespace driver
71 } // end namespace clang
72 
73 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
clang::driver::tools::AVR::Linker::Triple
const llvm::Triple & Triple
Definition: AVR.h:65
clang::driver::tools::AVR::Linker::LinkStdlib
bool LinkStdlib
Definition: AVR.h:66
clang::driver::tools::AVR::Linker::isLinkJob
bool isLinkJob() const override
Definition: AVR.h:58
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::tools::AVR::Linker::Linker
Linker(const llvm::Triple &Triple, const ToolChain &TC, bool LinkStdlib)
Definition: AVR.h:53
llvm::Optional< std::string >
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
InputInfo.h
clang::driver::tools::AVR::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: AVR.h:57
clang::driver::tools::AVR::Linker
Definition: AVR.h:51
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::toolchains::Generic_ELF
Definition: Gnu.h:362
Tool.h
ToolChain.h
clang::driver::toolchains::AVRToolChain
Definition: AVR.h:21
Gnu.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:85
clang::driver::JobAction
Definition: Action.h:380