No longer emitting a PCH file when using -fsyntax-only on a header file. Fixes PR13343.
llvm-svn: 161019
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5be60b8..671c0ac 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1210,8 +1210,14 @@
}
return new PreprocessJobAction(Input, OutputTy);
}
- case phases::Precompile:
- return new PrecompileJobAction(Input, types::TY_PCH);
+ case phases::Precompile: {
+ types::ID OutputTy = types::TY_PCH;
+ if (Args.hasArg(options::OPT_fsyntax_only)) {
+ // Syntax checks should not emit a PCH file
+ OutputTy = types::TY_Nothing;
+ }
+ return new PrecompileJobAction(Input, OutputTy);
+ }
case phases::Compile: {
if (Args.hasArg(options::OPT_fsyntax_only)) {
return new CompileJobAction(Input, types::TY_Nothing);