/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/ToolChains/Haiku.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===--- Haiku.cpp - Haiku 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 "Haiku.h" |
10 | | #include "CommonArgs.h" |
11 | | #include "clang/Config/config.h" |
12 | | #include "llvm/Support/Path.h" |
13 | | |
14 | | using namespace clang::driver; |
15 | | using namespace clang::driver::toolchains; |
16 | | using namespace clang; |
17 | | using namespace llvm::opt; |
18 | | |
19 | | /// Haiku - Haiku tool chain which can call as(1) and ld(1) directly. |
20 | | |
21 | | Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) |
22 | 10 | : Generic_ELF(D, Triple, Args) { |
23 | | |
24 | 10 | getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib")); |
25 | 10 | getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib")); |
26 | 10 | } |
27 | | |
28 | | void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, |
29 | 10 | llvm::opt::ArgStringList &CC1Args) const { |
30 | 10 | const Driver &D = getDriver(); |
31 | | |
32 | 10 | if (DriverArgs.hasArg(options::OPT_nostdinc)) |
33 | 0 | return; |
34 | | |
35 | 10 | if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { |
36 | 10 | SmallString<128> Dir(D.ResourceDir); |
37 | 10 | llvm::sys::path::append(Dir, "include"); |
38 | 10 | addSystemInclude(DriverArgs, CC1Args, Dir.str()); |
39 | 10 | } |
40 | | |
41 | 10 | if (DriverArgs.hasArg(options::OPT_nostdlibinc)) |
42 | 0 | return; |
43 | | |
44 | | // Add dirs specified via 'configure --with-c-include-dirs'. |
45 | 10 | StringRef CIncludeDirs(C_INCLUDE_DIRS); |
46 | 10 | if (!CIncludeDirs.empty()) { |
47 | 0 | SmallVector<StringRef, 5> dirs; |
48 | 0 | CIncludeDirs.split(dirs, ":"); |
49 | 0 | for (StringRef dir : dirs) { |
50 | 0 | StringRef Prefix = |
51 | 0 | llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : ""; |
52 | 0 | addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir); |
53 | 0 | } |
54 | 0 | return; |
55 | 0 | } |
56 | | |
57 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
58 | 10 | "/boot/system/non-packaged/develop/headers")); |
59 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
60 | 10 | "/boot/system/develop/headers/os")); |
61 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
62 | 10 | "/boot/system/develop/headers/os/app")); |
63 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
64 | 10 | "/boot/system/develop/headers/os/device")); |
65 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
66 | 10 | "/boot/system/develop/headers/os/drivers")); |
67 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
68 | 10 | "/boot/system/develop/headers/os/game")); |
69 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
70 | 10 | "/boot/system/develop/headers/os/interface")); |
71 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
72 | 10 | "/boot/system/develop/headers/os/kernel")); |
73 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
74 | 10 | "/boot/system/develop/headers/os/locale")); |
75 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
76 | 10 | "/boot/system/develop/headers/os/mail")); |
77 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
78 | 10 | "/boot/system/develop/headers/os/media")); |
79 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
80 | 10 | "/boot/system/develop/headers/os/midi")); |
81 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
82 | 10 | "/boot/system/develop/headers/os/midi2")); |
83 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
84 | 10 | "/boot/system/develop/headers/os/net")); |
85 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
86 | 10 | "/boot/system/develop/headers/os/opengl")); |
87 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
88 | 10 | "/boot/system/develop/headers/os/storage")); |
89 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
90 | 10 | "/boot/system/develop/headers/os/support")); |
91 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
92 | 10 | "/boot/system/develop/headers/os/translation")); |
93 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
94 | 10 | "/boot/system/develop/headers/os/add-ons/graphics")); |
95 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
96 | 10 | "/boot/system/develop/headers/os/add-ons/input_server")); |
97 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
98 | 10 | "/boot/system/develop/headers/os/add-ons/mail_daemon")); |
99 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
100 | 10 | "/boot/system/develop/headers/os/add-ons/registrar")); |
101 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
102 | 10 | "/boot/system/develop/headers/os/add-ons/screen_saver")); |
103 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
104 | 10 | "/boot/system/develop/headers/os/add-ons/tracker")); |
105 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
106 | 10 | "/boot/system/develop/headers/os/be_apps/Deskbar")); |
107 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
108 | 10 | "/boot/system/develop/headers/os/be_apps/NetPositive")); |
109 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
110 | 10 | "/boot/system/develop/headers/os/be_apps/Tracker")); |
111 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
112 | 10 | "/boot/system/develop/headers/3rdparty")); |
113 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
114 | 10 | "/boot/system/develop/headers/bsd")); |
115 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
116 | 10 | "/boot/system/develop/headers/glibc")); |
117 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
118 | 10 | "/boot/system/develop/headers/gnu")); |
119 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
120 | 10 | "/boot/system/develop/headers/posix")); |
121 | 10 | addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, |
122 | 10 | "/boot/system/develop/headers")); |
123 | 10 | } |
124 | | |
125 | | void Haiku::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, |
126 | 1 | llvm::opt::ArgStringList &CC1Args) const { |
127 | 1 | addSystemInclude(DriverArgs, CC1Args, |
128 | 1 | concat(getDriver().SysRoot, "/boot/system/develop/headers/c++/v1")); |
129 | 1 | } |
130 | | |
131 | | void Haiku::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, |
132 | 1 | llvm::opt::ArgStringList &CC1Args) const { |
133 | 1 | addLibStdCXXIncludePaths(concat(getDriver().SysRoot, "/boot/system/develop/headers/c++"), |
134 | 1 | getTriple().str(), "", DriverArgs, CC1Args); |
135 | 1 | } |