diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2012-07-31 01:21:00 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2012-07-31 01:21:00 +0000 |
commit | 1f10cc5eb4c30f8082ac1d23d9d7f07e8a6d9f97 (patch) | |
tree | 409894c0d2aa11ba4c24e53448e395c6121157ea /clang/lib | |
parent | 2b6a0dfd4ce1f8cf6b1f4a1bcb8fb13c39efb347 (diff) | |
download | bcm5719-llvm-1f10cc5eb4c30f8082ac1d23d9d7f07e8a6d9f97.tar.gz bcm5719-llvm-1f10cc5eb4c30f8082ac1d23d9d7f07e8a6d9f97.zip |
No longer emitting a PCH file when using -fsyntax-only on a header file. Fixes PR13343.
llvm-svn: 161019
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 5be60b8806f..671c0acaab2 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1210,8 +1210,14 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, } 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); diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index e13f709185f..189ff5954a8 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1537,7 +1537,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // Use PCH if the user requested it. bool UsePCH = D.CCCUsePCH; - if (UsePCH) + if (JA.getType() == types::TY_Nothing) + CmdArgs.push_back("-fsyntax-only"); + else if (UsePCH) CmdArgs.push_back("-emit-pch"); else CmdArgs.push_back("-emit-pth"); |