LLDB mainline
HostInfo.h
Go to the documentation of this file.
1//===-- HostInfo.h ----------------------------------------------*- 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 LLDB_HOST_HOSTINFO_H
10#define LLDB_HOST_HOSTINFO_H
11
12/// \class HostInfo HostInfo.h "lldb/Host/HostInfo.h"
13/// A class that provides host computer information.
14///
15/// HostInfo is a class that answers information about the host operating
16/// system. Note that HostInfo is NOT intended to be used to manipulate or
17/// control the operating system.
18///
19/// HostInfo is implemented in an OS-specific class (for example
20/// HostInfoWindows) in a separate file, and then typedefed to HostInfo here.
21/// Users of the class reference it as HostInfo::method().
22///
23/// Not all hosts provide the same functionality. It is important that
24/// methods only be implemented at the lowest level at which they make sense.
25/// It should be up to the clients of the class to ensure that they not
26/// attempt to call a method which doesn't make sense for a particular
27/// platform. For example, when implementing a method that only makes sense
28/// on a posix-compliant system, implement it on HostInfoPosix, and not on
29/// HostInfoBase with a default implementation. This way, users of HostInfo
30/// are required to think about the implications of calling a particular
31/// method and if used in a context where the method doesn't make sense, will
32/// generate a compiler error.
33///
34
35#if defined(_WIN32)
37#define HOST_INFO_TYPE HostInfoWindows
38#elif defined(__linux__) || defined(__EMSCRIPTEN__)
39#if defined(__ANDROID__)
41#define HOST_INFO_TYPE HostInfoAndroid
42#else
44#define HOST_INFO_TYPE HostInfoLinux
45#endif
46#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
48#define HOST_INFO_TYPE HostInfoFreeBSD
49#elif defined(__NetBSD__)
51#define HOST_INFO_TYPE HostInfoNetBSD
52#elif defined(__OpenBSD__)
54#define HOST_INFO_TYPE HostInfoOpenBSD
55#elif defined(__APPLE__)
57#define HOST_INFO_TYPE HostInfoMacOSX
58#else
60#define HOST_INFO_TYPE HostInfoPosix
61#endif
62
63namespace lldb_private {
65}
66
67#undef HOST_INFO_TYPE
68
69#endif
#define HOST_INFO_TYPE
Definition: HostInfo.h:60
A class that represents a running process on the host machine.
HOST_INFO_TYPE HostInfo
Definition: HostInfo.h:64