r199755 - Fix -Wsometimes-uninitialized in r199754
Alp Toker
alp at nuanti.com
Tue Jan 21 10:01:01 PST 2014
Author: alp
Date: Tue Jan 21 12:01:01 2014
New Revision: 199755
URL: http://llvm.org/viewvc/llvm-project?rev=199755&view=rev
Log:
Fix -Wsometimes-uninitialized in r199754
Also make the -m16 check x86-specific. Other archs may have a different take on
things.
Modified:
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=199755&r1=199754&r2=199755&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jan 21 12:01:01 2014
@@ -1903,17 +1903,16 @@ static llvm::Triple computeTargetTriple(
// 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)
More information about the cfe-commits
mailing list