From 8cf8a3c4a48bdaac480c38605c4ed4a96a64f74a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 14 Jun 2020 23:13:09 -0700 Subject: [PATCH] Disable PCH reading/writing --- src/clang_tu.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/clang_tu.cc b/src/clang_tu.cc index 131adcc0..8e2ff3fc 100644 --- a/src/clang_tu.cc +++ b/src/clang_tu.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -148,6 +149,11 @@ buildCompilerInvocation(const std::string &main, std::vector args, auto &isec = ci->getFrontendOpts().Inputs; if (isec.size()) isec[0] = FrontendInputFile(main, isec[0].getKind(), isec[0].isSystem()); + // clangSerialization has an unstable format. Disable PCH reading/writing + // to work around PCH mismatch problems. + ci->getPreprocessorOpts().ImplicitPCHInclude.clear(); + ci->getPreprocessorOpts().PrecompiledPreambleBytes = {0, false}; + ci->getPreprocessorOpts().PCHThroughHeader.clear(); return ci; }