clang 20.0.0git
OHOS.h
Go to the documentation of this file.
1//===--- OHOS.h - OHOS 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_OHOS_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H
11
12#include "Linux.h"
13#include "clang/Driver/Tool.h"
15
16namespace clang {
17namespace driver {
18namespace toolchains {
19
20class LLVM_LIBRARY_VISIBILITY OHOS : public Generic_ELF {
21public:
22 OHOS(const Driver &D, const llvm::Triple &Triple,
23 const llvm::opt::ArgList &Args);
24
25 bool HasNativeLLVMSupport() const override { return true; }
26
27 bool IsMathErrnoDefault() const override { return false; }
28
30 return ToolChain::RLT_CompilerRT;
31 }
33 return ToolChain::CST_Libcxx;
34 }
35 // Not add -funwind-tables by default
36 bool isPICDefault() const override { return false; }
37 bool isPIEDefault(const llvm::opt::ArgList &Args) const override { return true; }
38 bool isPICDefaultForced() const override { return false; }
39 UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const override;
40 UnwindLibType GetDefaultUnwindLibType() const override { return UNW_CompilerRT; }
41
42 RuntimeLibType
43 GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
44 CXXStdlibType
45 GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
46
47 void
48 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
49 llvm::opt::ArgStringList &CC1Args) const override;
50 void
51 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
52 llvm::opt::ArgStringList &CC1Args) const override;
53 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
54 llvm::opt::ArgStringList &CmdArgs) const override;
55
56 std::string computeSysRoot() const override;
57 std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override;
58
59 std::string
60 getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
61 FileType Type = ToolChain::FT_Static) const override;
62
63 const char *getDefaultLinker() const override {
64 return "ld.lld";
65 }
66
67 Tool *buildLinker() const override {
68 return new tools::gnutools::Linker(*this);
69 }
70 Tool *buildAssembler() const override {
71 return new tools::gnutools::Assembler(*this);
72 }
73
74 path_list getRuntimePaths() const;
75
76protected:
77 std::string getMultiarchTriple(const llvm::Triple &T) const;
78 std::string getMultiarchTriple(const Driver &D,
79 const llvm::Triple &TargetTriple,
80 StringRef SysRoot) const override;
81 void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override;
82 SanitizerMask getSupportedSanitizers() const override;
83 void addProfileRTLibs(const llvm::opt::ArgList &Args,
84 llvm::opt::ArgStringList &CmdArgs) const override;
85 path_list getArchSpecificLibPaths() const override;
86
87private:
88 Multilib SelectedMultilib;
89};
90
91} // end namespace toolchains
92} // end namespace driver
93} // end namespace clang
94
95#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H
const Decl * D
llvm::MachO::FileType FileType
Definition: MachO.h:46
The base class of the type hierarchy.
Definition: Type.h:1829
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Definition: Multilib.h:32
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
Tool * buildAssembler() const override
Definition: OHOS.h:70
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: OHOS.h:25
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: OHOS.h:29
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: OHOS.h:27
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: OHOS.h:36
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: OHOS.h:38
Tool * buildLinker() const override
Definition: OHOS.h:67
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: OHOS.h:32
UnwindLibType GetDefaultUnwindLibType() const override
Definition: OHOS.h:40
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: OHOS.h:63
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: OHOS.h:37
The JSON file list parser is used to communicate input to InstallAPI.