From 025949c366c9015210eac09f11c0f846668b9992 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Mon, 4 Jul 2011 21:59:44 +0000 Subject: [PATCH] Use switch(os) style consistently. Add a bunch of NetBSD branches. llvm-svn: 134393 --- clang/lib/Basic/Targets.cpp | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 8479be9397bc..8f61e1fc3a08 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -2817,6 +2817,8 @@ static TargetInfo *AllocateTarget(const std::string &T) { return new LinuxTargetInfo(T); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(T); + case llvm::Triple::NetBSD: + return new NetBSDTargetInfo(T); case llvm::Triple::RTEMS: return new RTEMSTargetInfo(T); default: @@ -2852,20 +2854,30 @@ static TargetInfo *AllocateTarget(const std::string &T) { case llvm::Triple::ppc: if (Triple.isOSDarwin()) return new DarwinPPC32TargetInfo(T); - else if (os == llvm::Triple::FreeBSD) + switch (os) { + case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(T); - if ( os == llvm::Triple::RTEMS ) + case llvm::Triple::NetBSD: + return new NetBSDTargetInfo(T); + case llvm::Triple::RTEMS: return new RTEMSTargetInfo(T); - return new PPC32TargetInfo(T); + default: + return new PPC32TargetInfo(T); + } case llvm::Triple::ppc64: if (Triple.isOSDarwin()) return new DarwinPPC64TargetInfo(T); - else if (os == llvm::Triple::Lv2) + switch (os) { + case llvm::Triple::Lv2: return new PS3PPUTargetInfo(T); - else if (os == llvm::Triple::FreeBSD) + case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo(T); - return new PPC64TargetInfo(T); + case llvm::Triple::NetBSD: + return new NetBSDTargetInfo(T); + default: + return new PPC64TargetInfo(T); + } case llvm::Triple::ptx32: return new PTX32TargetInfo(T); @@ -2876,13 +2888,18 @@ static TargetInfo *AllocateTarget(const std::string &T) { return new MBlazeTargetInfo(T); case llvm::Triple::sparc: - if (os == llvm::Triple::AuroraUX) + switch (os) { + case llvm::Triple::AuroraUX: return new AuroraUXSparcV8TargetInfo(T); - if (os == llvm::Triple::Solaris) + case llvm::Triple::Solaris: return new SolarisSparcV8TargetInfo(T); - if ( os == llvm::Triple::RTEMS ) + case llvm::Triple::NetBSD: + return new NetBSDTargetInfo(T); + case llvm::Triple::RTEMS: return new RTEMSTargetInfo(T); - return new SparcV8TargetInfo(T); + default: + return new SparcV8TargetInfo(T); + } // FIXME: Need a real SPU target. case llvm::Triple::cellspu: