From 1b35da0f2f19184147eb892cc860f996879180bd Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Tue, 21 Jan 2014 18:01:01 +0000 Subject: [PATCH] Fix -Wsometimes-uninitialized in r199754 Also make the -m16 check x86-specific. Other archs may have a different take on things. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199755 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Driver.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 17e6bfd2cc..ca3e50fd53 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1903,17 +1903,16 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple, // Handle pseudo-target flags '-m64', '-m32' and '-m16'. if (Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_m32, options::OPT_m16)) { - llvm::Triple::ArchType AT; + llvm::Triple::ArchType AT = llvm::Triple::UnknownArch; + if (A->getOption().matches(options::OPT_m64)) AT = Target.get64BitArchVariant().getArch(); else if (A->getOption().matches(options::OPT_m32)) AT = Target.get32BitArchVariant().getArch(); - else if (A->getOption().matches(options::OPT_m16)) { - AT = Target.get32BitArchVariant().getArch(); - if (AT == llvm::Triple::x86) - Target.setEnvironment(llvm::Triple::CODE16); - else - AT = llvm::Triple::UnknownArch; + else if (A->getOption().matches(options::OPT_m16) && + Target.get32BitArchVariant().getArch() == llvm::Triple::x86) { + AT = llvm::Triple::x86; + Target.setEnvironment(llvm::Triple::CODE16); } if (AT != llvm::Triple::UnknownArch) -- 2.40.0