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());
}
}
!
! 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"