Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]
Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
OpenBSD and DragonFly with matching isOS*BSD() methods. This should
improve the consistency of coding style without changing the behavior.
Direct getOS() comparisons were left whenever used in switch or switch-
like context.
Differential Revision: https://reviews.llvm.org/D55916
llvm-svn: 349752
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index cb202ea..16644ac 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/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 (IsNetBSD)
setABI("apcs-gnu");
- else if (Triple.getOS() == llvm::Triple::OpenBSD)
+ else if (IsOpenBSD)
setABI("aapcs-linux");
else
setABI("aapcs");