From 549d5bb6f2b1aed2e623096fdf683716f795bef5 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 19 Dec 2014 23:56:31 +0000 Subject: [PATCH] Driver: hoist an assertion Remove an unnecessary conditional, hoisting the assertion. Minor style tweaks/reflowing. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224654 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 28e0a5baf6..20d14bf36c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -7844,18 +7844,14 @@ void visualstudio::Link::ConstructJob(Compilation &C, const JobAction &JA, ArgStringList CmdArgs; const ToolChain &TC = getToolChain(); - if (Output.isFilename()) { + assert((Output.isFilename() || Output.isNothing()) && "invalid output"); + if (Output.isFilename()) CmdArgs.push_back(Args.MakeArgString(std::string("-out:") + Output.getFilename())); - } else { - assert(Output.isNothing() && "Invalid output."); - } if (!Args.hasArg(options::OPT_nostdlib) && - !Args.hasArg(options::OPT_nostartfiles) && - !C.getDriver().IsCLMode()) { + !Args.hasArg(options::OPT_nostartfiles) && !C.getDriver().IsCLMode()) CmdArgs.push_back("-defaultlib:libcmt"); - } if (!llvm::sys::Process::GetEnv("LIB")) { // If the VC environment hasn't been configured (perhaps because the user @@ -7892,12 +7888,10 @@ void visualstudio::Link::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-nologo"); - if (Args.hasArg(options::OPT_g_Group)) { + if (Args.hasArg(options::OPT_g_Group)) CmdArgs.push_back("-debug"); - } bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd); - if (DLL) { CmdArgs.push_back(Args.MakeArgString("-dll")); -- 2.40.0