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)
36#include "lldb/Host/windows/HostInfoWindows.h"
37#define HOST_INFO_TYPE HostInfoWindows
38#elif defined(__linux__) || defined(__EMSCRIPTEN__)
39#if defined(__ANDROID__)
40#include "lldb/Host/android/HostInfoAndroid.h"
41#define HOST_INFO_TYPE HostInfoAndroid
42#else
43#include "lldb/Host/linux/HostInfoLinux.h"
44#define HOST_INFO_TYPE HostInfoLinux
45#endif
46#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
47#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
48#define HOST_INFO_TYPE HostInfoFreeBSD
49#elif defined(__NetBSD__)
50#include "lldb/Host/netbsd/HostInfoNetBSD.h"
51#define HOST_INFO_TYPE HostInfoNetBSD
52#elif defined(__OpenBSD__)
53#include "lldb/Host/openbsd/HostInfoOpenBSD.h"
54#define HOST_INFO_TYPE HostInfoOpenBSD
55#elif defined(__APPLE__)
56#include "lldb/Host/macosx/HostInfoMacOSX.h"
57#define HOST_INFO_TYPE HostInfoMacOSX
58#else
59#include "lldb/Host/posix/HostInfoPosix.h"
60#define HOST_INFO_TYPE HostInfoPosix
61#endif
62
63namespace lldb_private {
64typedef HOST_INFO_TYPE HostInfo;
65}
66
67#undef HOST_INFO_TYPE
68
69#endif
70

source code of lldb/include/lldb/Host/HostInfo.h