This saves some duplicated code (in buildPreamble and buildAST).
CI->getPreprocessorOpts().PCHThroughHeader.clear();
CI->getPreprocessorOpts().PCHWithHdrStop = false;
CI->getPreprocessorOpts().PCHWithHdrStopCreate = false;
+
+ // Recovery expression currently only works for C++.
+ if (CI->getLangOpts()->CPlusPlus)
+ CI->getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
return CI;
}
const PrecompiledPreamble *PreamblePCH =
Preamble ? &Preamble->Preamble : nullptr;
- // Recovery expression currently only works for C++.
- if (CI->getLangOpts()->CPlusPlus)
- CI->getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
// This is on-by-default in windows to allow parsing SDK headers, but it
// breaks many features. Disable it for the main-file (not preamble).
CI->getLangOpts()->DelayedTemplateParsing = false;
// to read back. We rely on dynamic index for the comments instead.
CI.getPreprocessorOpts().WriteCommentListToPCH = false;
- // Recovery expression currently only works for C++.
- if (CI.getLangOpts()->CPlusPlus)
- CI.getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
-
CppFilePreambleCallbacks SerializedDeclsCollector(FileName, PreambleCallback);
if (Inputs.FS->setCurrentWorkingDirectory(Inputs.CompileCommand.Directory)) {
log("Couldn't set working directory when building the preamble.");