r227409 - Ensure that -fsyntax-only with fortran 90 passes along silently

Eric Christopher echristo at gmail.com
Wed Jan 28 16:56:17 PST 2015


Author: echristo
Date: Wed Jan 28 18:56:17 2015
New Revision: 227409

URL: http://llvm.org/viewvc/llvm-project?rev=227409&view=rev
Log:
Ensure that -fsyntax-only with fortran 90 passes along silently
to the underlying gcc.
PR22234

Patch by Artem Belevich.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/gfortran.f90

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=227409&r1=227408&r2=227409&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 28 18:56:17 2015
@@ -5116,16 +5116,21 @@ void gcc::Compile::RenderExtraToolArgs(c
                                        ArgStringList &CmdArgs) const {
   const Driver &D = getToolChain().getDriver();
 
+  switch (JA.getType()) {
   // If -flto, etc. are present then make sure not to force assembly output.
-  if (JA.getType() == types::TY_LLVM_IR || JA.getType() == types::TY_LTO_IR ||
-      JA.getType() == types::TY_LLVM_BC || JA.getType() == types::TY_LTO_BC)
+  case types::TY_LLVM_IR:
+  case types::TY_LTO_IR:
+  case types::TY_LLVM_BC:
+  case types::TY_LTO_BC:
     CmdArgs.push_back("-c");
-  else {
-    if (JA.getType() != types::TY_PP_Asm)
-      D.Diag(diag::err_drv_invalid_gcc_output_type)
-        << getTypeName(JA.getType());
-
+    break;
+  case types::TY_PP_Asm:
     CmdArgs.push_back("-S");
+  case types::TY_Nothing:
+    CmdArgs.push_back("-fsyntax-only");
+    break;
+  default:
+    D.Diag(diag::err_drv_invalid_gcc_output_type) << getTypeName(JA.getType());
   }
 }
 

Modified: cfe/trunk/test/Driver/gfortran.f90
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/gfortran.f90?rev=227409&r1=227408&r2=227409&view=diff
==============================================================================
--- cfe/trunk/test/Driver/gfortran.f90 (original)
+++ cfe/trunk/test/Driver/gfortran.f90 Wed Jan 28 18:56:17 2015
@@ -242,3 +242,12 @@
 !
 ! Clang understands this one and orders it weirdly.
 ! CHECK: "-fsyntax-only"
+!
+! PR22234: Ensure that -fsyntax-only doesn't complain about output types and
+!          passes along correctly.
+! RUN: %clang -no-canonical-prefixes -target i386-linux -fsyntax-only -### %s -o %t 2>&1 | \
+! grep for error message and command-line
+! RUN: grep -e error: -e -fsyntax-only | FileCheck %s --check-prefix=CHECK-PR22234
+!
+! CHECK-PR22234-NOT: clang: error: invalid output type
+! CHECK-PR22234: "-fsyntax-only"





More information about the cfe-commits mailing list