Index: lib/Basic/Targets/AArch64.cpp =================================================================== --- lib/Basic/Targets/AArch64.cpp +++ lib/Basic/Targets/AArch64.cpp @@ -37,11 +37,11 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple), ABI("aapcs") { - if (getTriple().getOS() == llvm::Triple::OpenBSD) { + if (getTriple().isOSOpenBSD()) { Int64Type = SignedLongLong; IntMaxType = SignedLongLong; } else { - if (!getTriple().isOSDarwin() && getTriple().getOS() != llvm::Triple::NetBSD) + if (!getTriple().isOSDarwin() && !getTriple().isOSNetBSD()) WCharType = UnsignedInt; Int64Type = SignedLong; Index: lib/Basic/Targets/ARM.cpp =================================================================== --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -28,8 +28,8 @@ DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64; const llvm::Triple &T = getTriple(); - bool IsNetBSD = T.getOS() == llvm::Triple::NetBSD; - bool IsOpenBSD = T.getOS() == llvm::Triple::OpenBSD; + bool IsNetBSD = T.isOSNetBSD(); + bool IsOpenBSD = T.isOSOpenBSD(); if (!T.isOSWindows() && !IsNetBSD && !IsOpenBSD) WCharType = UnsignedInt; @@ -217,8 +217,8 @@ const TargetOptions &Opts) : TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0), HW_FP(0) { - bool IsOpenBSD = Triple.getOS() == llvm::Triple::OpenBSD; - bool IsNetBSD = Triple.getOS() == llvm::Triple::NetBSD; + bool IsOpenBSD = Triple.isOSOpenBSD(); + bool IsNetBSD = Triple.isOSNetBSD(); // FIXME: the isOSBinFormatMachO is a workaround for identifying a Darwin-like // environment where size_t is `unsigned long` rather than `unsigned int` @@ -282,9 +282,9 @@ setABI("apcs-gnu"); break; default: - if (Triple.getOS() == llvm::Triple::NetBSD) + if (Triple.isOSNetBSD()) setABI("apcs-gnu"); - else if (Triple.getOS() == llvm::Triple::OpenBSD) + else if (Triple.isOSOpenBSD()) setABI("aapcs-linux"); else setABI("aapcs"); Index: lib/Basic/Targets/Mips.h =================================================================== --- lib/Basic/Targets/Mips.h +++ lib/Basic/Targets/Mips.h @@ -78,8 +78,8 @@ CPU = ABI == "o32" ? "mips32r2" : "mips64r2"; - CanUseBSDABICalls = Triple.getOS() == llvm::Triple::FreeBSD || - Triple.getOS() == llvm::Triple::OpenBSD; + CanUseBSDABICalls = Triple.isOSFreeBSD() || + Triple.isOSOpenBSD(); } bool isIEEE754_2008Default() const { @@ -132,7 +132,7 @@ void setN32N64ABITypes() { LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); - if (getTriple().getOS() == llvm::Triple::FreeBSD) { + if (getTriple().isOSFreeBSD()) { LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } @@ -142,7 +142,7 @@ void setN64ABITypes() { setN32N64ABITypes(); - if (getTriple().getOS() == llvm::Triple::OpenBSD) { + if (getTriple().isOSOpenBSD()) { Int64Type = SignedLongLong; } else { Int64Type = SignedLong; Index: lib/Basic/Targets/PPC.h =================================================================== --- lib/Basic/Targets/PPC.h +++ lib/Basic/Targets/PPC.h @@ -331,7 +331,7 @@ break; } - if (getTriple().getOS() == llvm::Triple::FreeBSD) { + if (getTriple().isOSFreeBSD()) { LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } Index: lib/Basic/Targets/PPC.cpp =================================================================== --- lib/Basic/Targets/PPC.cpp +++ lib/Basic/Targets/PPC.cpp @@ -83,8 +83,8 @@ if (getTriple().getArch() == llvm::Triple::ppc64le) { Builder.defineMacro("_LITTLE_ENDIAN"); } else { - if (getTriple().getOS() != llvm::Triple::NetBSD && - getTriple().getOS() != llvm::Triple::OpenBSD) + if (!getTriple().isOSNetBSD() && + !getTriple().isOSOpenBSD()) Builder.defineMacro("_BIG_ENDIAN"); } Index: lib/Basic/Targets/Sparc.h =================================================================== --- lib/Basic/Targets/Sparc.h +++ lib/Basic/Targets/Sparc.h @@ -199,7 +199,7 @@ LongWidth = LongAlign = PointerWidth = PointerAlign = 64; // OpenBSD uses long long for int64_t and intmax_t. - if (getTriple().getOS() == llvm::Triple::OpenBSD) + if (getTriple().isOSOpenBSD()) IntMaxType = SignedLongLong; else IntMaxType = SignedLong; Index: lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -47,12 +47,12 @@ } // MIPS3 is the default for mips64*-unknown-openbsd. - if (Triple.getOS() == llvm::Triple::OpenBSD) + if (Triple.isOSOpenBSD()) DefMips64CPU = "mips3"; // MIPS2 is the default for mips(el)?-unknown-freebsd. // MIPS3 is the default for mips64(el)?-unknown-freebsd. - if (Triple.getOS() == llvm::Triple::FreeBSD) { + if (Triple.isOSFreeBSD()) { DefMips32CPU = "mips2"; DefMips64CPU = "mips3"; } Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -526,7 +526,7 @@ break; } - if (Triple.getOS() == llvm::Triple::NetBSD) { + if (Triple.isOSNetBSD()) { return !areOptimizationsEnabled(Args); } @@ -2848,8 +2848,8 @@ } else { bool IsARM = T.isARM() || T.isThumb() || T.isAArch64(); CmdArgs.push_back("-fwchar-type=int"); - if (IsARM && !(T.isOSWindows() || T.getOS() == llvm::Triple::NetBSD || - T.getOS() == llvm::Triple::OpenBSD)) + if (IsARM && !(T.isOSWindows() || T.isOSNetBSD() || + T.isOSOpenBSD())) CmdArgs.push_back("-fno-signed-wchar"); else CmdArgs.push_back("-fsigned-wchar"); @@ -5274,8 +5274,8 @@ (TC.getTriple().isOSBinFormatELF() || TC.getTriple().isOSBinFormatCOFF()) && !TC.getTriple().isPS4() && - TC.useIntegratedAs() && - RawTriple.getOS() != llvm::Triple::NetBSD)) + !TC.getTriple().isOSNetBSD() && + TC.useIntegratedAs()) CmdArgs.push_back("-faddrsig"); // Finally add the compile command to the compilation. Index: lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -603,19 +603,19 @@ if (TC.getTriple().getOS() != llvm::Triple::RTEMS && !TC.getTriple().isAndroid()) { CmdArgs.push_back("-lpthread"); - if (TC.getTriple().getOS() != llvm::Triple::OpenBSD) + if (TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-lrt"); } CmdArgs.push_back("-lm"); // There's no libdl on all OSes. - if (TC.getTriple().getOS() != llvm::Triple::FreeBSD && - TC.getTriple().getOS() != llvm::Triple::NetBSD && - TC.getTriple().getOS() != llvm::Triple::OpenBSD && - TC.getTriple().getOS() != llvm::Triple::RTEMS) + if (!TC.getTriple().isOSFreeBSD() && + !TC.getTriple().isOSNetBSD() && + !TC.getTriple().isOSOpenBSD() && + TC.getTriple().getOS() != llvm::Triple::RTEMS) CmdArgs.push_back("-ldl"); // Required for backtrace on some OSes - if (TC.getTriple().getOS() == llvm::Triple::NetBSD || - TC.getTriple().getOS() == llvm::Triple::FreeBSD) + if (TC.getTriple().isOSFreeBSD() || + TC.getTriple().isOSNetBSD()) CmdArgs.push_back("-lexecinfo"); } @@ -790,13 +790,13 @@ void tools::linkXRayRuntimeDeps(const ToolChain &TC, ArgStringList &CmdArgs) { CmdArgs.push_back("--no-as-needed"); CmdArgs.push_back("-lpthread"); - if (TC.getTriple().getOS() != llvm::Triple::OpenBSD) + if (!TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-lrt"); CmdArgs.push_back("-lm"); - if (TC.getTriple().getOS() != llvm::Triple::FreeBSD && - TC.getTriple().getOS() != llvm::Triple::NetBSD && - TC.getTriple().getOS() != llvm::Triple::OpenBSD) + if (!TC.getTriple().isOSFreeBSD() && + !TC.getTriple().isOSNetBSD() && + !TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-ldl"); } @@ -933,7 +933,7 @@ } // OpenBSD-specific defaults for PIE - if (Triple.getOS() == llvm::Triple::OpenBSD) { + if (Triple.isOSOpenBSD()) { switch (ToolChain.getArch()) { case llvm::Triple::arm: case llvm::Triple::aarch64: Index: lib/Driver/ToolChains/Gnu.cpp =================================================================== --- lib/Driver/ToolChains/Gnu.cpp +++ lib/Driver/ToolChains/Gnu.cpp @@ -2597,7 +2597,7 @@ bool UseInitArrayDefault = getTriple().getArch() == llvm::Triple::aarch64 || getTriple().getArch() == llvm::Triple::aarch64_be || - (getTriple().getOS() == llvm::Triple::FreeBSD && + (getTriple().isOSFreeBSD() && getTriple().getOSMajorVersion() >= 12) || (getTriple().getOS() == llvm::Triple::Linux && ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) || Index: lib/Driver/XRayArgs.cpp =================================================================== --- lib/Driver/XRayArgs.cpp +++ lib/Driver/XRayArgs.cpp @@ -50,9 +50,9 @@ D.Diag(diag::err_drv_clang_unsupported) << (std::string(XRayInstrumentOption) + " on " + Triple.str()); } - } else if (Triple.getOS() == llvm::Triple::FreeBSD || - Triple.getOS() == llvm::Triple::OpenBSD || - Triple.getOS() == llvm::Triple::NetBSD || + } else if (Triple.isOSFreeBSD() || + Triple.isOSOpenBSD() || + Triple.isOSNetBSD() || Triple.getOS() == llvm::Triple::Darwin) { if (Triple.getArch() != llvm::Triple::x86_64) { D.Diag(diag::err_drv_clang_unsupported) Index: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -29,10 +29,10 @@ const llvm::Triple &T = Ctx.getTargetInfo().getTriple(); return T.getVendor() == llvm::Triple::Apple || T.getOS() == llvm::Triple::CloudABI || - T.getOS() == llvm::Triple::FreeBSD || - T.getOS() == llvm::Triple::NetBSD || - T.getOS() == llvm::Triple::OpenBSD || - T.getOS() == llvm::Triple::DragonFly; + T.isOSFreeBSD() || + T.isOSNetBSD() || + T.isOSOpenBSD() || + T.isOSDragonFly(); } namespace {