]> granicus.if.org Git - clang/commitdiff
Driver: hoist an assertion
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 19 Dec 2014 23:56:31 +0000 (23:56 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 19 Dec 2014 23:56:31 +0000 (23:56 +0000)
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

index 28e0a5baf6231bc8fd6091fa073d67c1750aa4c2..20d14bf36c4597a1ee1f7952416ae2d968e9437a 100644 (file)
@@ -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"));