[PATCH] D39375: [clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.

William Enright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 14:19:13 PST 2017


Nebiroth updated this revision to Diff 125815.
Nebiroth added a comment.

Reverted formatting changes to ASTUnit


Repository:
  rC Clang

https://reviews.llvm.org/D39375

Files:
  include/clang/Frontend/PrecompiledPreamble.h
  lib/Frontend/ASTUnit.cpp
  lib/Frontend/PrecompiledPreamble.cpp


Index: lib/Frontend/PrecompiledPreamble.cpp
===================================================================
--- lib/Frontend/PrecompiledPreamble.cpp
+++ lib/Frontend/PrecompiledPreamble.cpp
@@ -239,7 +239,7 @@
     const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
     DiagnosticsEngine &Diagnostics, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
     std::shared_ptr<PCHContainerOperations> PCHContainerOps, bool StoreInMemory,
-    PreambleCallbacks &Callbacks) {
+    PreambleCallbacks &Callbacks, std::unique_ptr<PPCallbacks> PPCallbacks) {
   assert(VFS && "VFS is null");
 
   if (!Bounds.Size)
@@ -351,6 +351,7 @@
   if (!Act->BeginSourceFile(*Clang.get(), Clang->getFrontendOpts().Inputs[0]))
     return BuildPreambleError::BeginSourceFileFailed;
 
+  Clang->getPreprocessor().addPPCallbacks(std::move(PPCallbacks));
   Act->Execute();
 
   // Run the callbacks.
Index: lib/Frontend/ASTUnit.cpp
===================================================================
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -1293,7 +1293,7 @@
 
     llvm::ErrorOr<PrecompiledPreamble> NewPreamble = PrecompiledPreamble::Build(
         PreambleInvocationIn, MainFileBuffer.get(), Bounds, *Diagnostics, VFS,
-        PCHContainerOps, /*StoreInMemory=*/false, Callbacks);
+        PCHContainerOps, /*StoreInMemory=*/false, Callbacks, nullptr);
     if (NewPreamble) {
       Preamble = std::move(*NewPreamble);
       PreambleRebuildCounter = 1;
Index: include/clang/Frontend/PrecompiledPreamble.h
===================================================================
--- include/clang/Frontend/PrecompiledPreamble.h
+++ include/clang/Frontend/PrecompiledPreamble.h
@@ -81,7 +81,7 @@
         const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
         DiagnosticsEngine &Diagnostics, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
         std::shared_ptr<PCHContainerOperations> PCHContainerOps,
-        bool StoreInMemory, PreambleCallbacks &Callbacks);
+        bool StoreInMemory, PreambleCallbacks &Callbacks, std::unique_ptr<PPCallbacks> PPCallbacks);
 
   PrecompiledPreamble(PrecompiledPreamble &&) = default;
   PrecompiledPreamble &operator=(PrecompiledPreamble &&) = default;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39375.125815.patch
Type: text/x-patch
Size: 2217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171206/e46ad10d/attachment.bin>


More information about the cfe-commits mailing list