]> granicus.if.org Git - clang/commitdiff
Ensure that -fsyntax-only with fortran 90 passes along silently
authorEric Christopher <echristo@gmail.com>
Thu, 29 Jan 2015 00:56:17 +0000 (00:56 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 29 Jan 2015 00:56:17 +0000 (00:56 +0000)
to the underlying gcc.
PR22234

Patch by Artem Belevich.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227409 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/gfortran.f90

index a2b494de74c3ff288f96801ad768b2a4e7a91290..1ff5be7b034bfbc8273864522106917229cda272 100644 (file)
@@ -5116,16 +5116,21 @@ void gcc::Compile::RenderExtraToolArgs(const JobAction &JA,
                                        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());
   }
 }
 
index d531f59cd35b5e81ca885a6552ba4461e1744286..3631f8c9f4c19375ffc60f022330127f9600dcad 100644 (file)
 !
 ! 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"