[Frontend] when attaching a preamble, don't generate the long predefines buffer.
authorSam McCall <sam.mccall@gmail.com>
Sat, 7 May 2022 22:50:10 +0000 (00:50 +0200)
committerSam McCall <sam.mccall@gmail.com>
Mon, 9 May 2022 13:55:32 +0000 (15:55 +0200)
We know we're going to overwrite it anyway.
It'd be a bit of work to coordinate not generating it at all, but setting this
flag avoids generating ~10k of the 13k string.

Differential Revision: https://reviews.llvm.org/D125180

clang/lib/Frontend/PrecompiledPreamble.cpp

index d5aab4a..e3c3466 100644 (file)
@@ -765,6 +765,10 @@ void PrecompiledPreamble::configurePreamble(
   PreprocessorOpts.DisablePCHOrModuleValidation =
       DisableValidationForModuleKind::PCH;
 
+  // Don't bother generating the long version of the predefines buffer.
+  // The preamble is going to overwrite it anyway.
+  PreprocessorOpts.UsePredefines = false;
+
   setupPreambleStorage(*Storage, PreprocessorOpts, VFS);
 }