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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits