File indexing completed on 2026-05-10 08:36:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_DRIVER_DISTRO_H
0010 #define LLVM_CLANG_DRIVER_DISTRO_H
0011
0012 #include "llvm/Support/VirtualFileSystem.h"
0013 #include "llvm/TargetParser/Triple.h"
0014
0015 namespace clang {
0016 namespace driver {
0017
0018
0019
0020
0021
0022
0023 class Distro {
0024 public:
0025 enum DistroType {
0026
0027 UninitializedDistro,
0028
0029
0030
0031 AlpineLinux,
0032 ArchLinux,
0033 DebianLenny,
0034 DebianSqueeze,
0035 DebianWheezy,
0036 DebianJessie,
0037 DebianStretch,
0038 DebianBuster,
0039 DebianBullseye,
0040 DebianBookworm,
0041 DebianTrixie,
0042 DebianForky,
0043 DebianDuke,
0044 Exherbo,
0045 RHEL5,
0046 RHEL6,
0047 RHEL7,
0048 Fedora,
0049 Gentoo,
0050 OpenSUSE,
0051 UbuntuHardy,
0052 UbuntuIntrepid,
0053 UbuntuJaunty,
0054 UbuntuKarmic,
0055 UbuntuLucid,
0056 UbuntuMaverick,
0057 UbuntuNatty,
0058 UbuntuOneiric,
0059 UbuntuPrecise,
0060 UbuntuQuantal,
0061 UbuntuRaring,
0062 UbuntuSaucy,
0063 UbuntuTrusty,
0064 UbuntuUtopic,
0065 UbuntuVivid,
0066 UbuntuWily,
0067 UbuntuXenial,
0068 UbuntuYakkety,
0069 UbuntuZesty,
0070 UbuntuArtful,
0071 UbuntuBionic,
0072 UbuntuCosmic,
0073 UbuntuDisco,
0074 UbuntuEoan,
0075 UbuntuFocal,
0076 UbuntuGroovy,
0077 UbuntuHirsute,
0078 UbuntuImpish,
0079 UbuntuJammy,
0080 UbuntuKinetic,
0081 UbuntuLunar,
0082 UbuntuMantic,
0083 UbuntuNoble,
0084 UbuntuOracular,
0085 UbuntuPlucky,
0086 UnknownDistro
0087 };
0088
0089 private:
0090
0091 DistroType DistroVal;
0092
0093 public:
0094
0095
0096
0097
0098 Distro() : DistroVal() {}
0099
0100
0101 Distro(DistroType D) : DistroVal(D) {}
0102
0103
0104 explicit Distro(llvm::vfs::FileSystem &VFS, const llvm::Triple &TargetOrHost);
0105
0106 bool operator==(const Distro &Other) const {
0107 return DistroVal == Other.DistroVal;
0108 }
0109
0110 bool operator!=(const Distro &Other) const {
0111 return DistroVal != Other.DistroVal;
0112 }
0113
0114 bool operator>=(const Distro &Other) const {
0115 return DistroVal >= Other.DistroVal;
0116 }
0117
0118 bool operator<=(const Distro &Other) const {
0119 return DistroVal <= Other.DistroVal;
0120 }
0121
0122
0123
0124
0125
0126 bool IsRedhat() const {
0127 return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
0128 }
0129
0130 bool IsOpenSUSE() const { return DistroVal == OpenSUSE; }
0131
0132 bool IsDebian() const {
0133 return DistroVal >= DebianLenny && DistroVal <= DebianDuke;
0134 }
0135
0136 bool IsUbuntu() const {
0137 return DistroVal >= UbuntuHardy && DistroVal <= UbuntuPlucky;
0138 }
0139
0140 bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }
0141
0142 bool IsGentoo() const { return DistroVal == Gentoo; }
0143
0144
0145 };
0146
0147 }
0148 }
0149
0150 #endif