[PATCH] D41365: [clang] Add BeforeExecute method to PrecompiledPreamble

William Enright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 11:29:17 PST 2017


Nebiroth created this revision.
Nebiroth added reviewers: malaperle, ilya-biryukov.

Adds BeforeExecute method to PrecompiledPreamble to be called before Execute(). This method can be overriden.


Repository:
  rC Clang

https://reviews.llvm.org/D41365

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


Index: lib/Frontend/PrecompiledPreamble.cpp
===================================================================
--- lib/Frontend/PrecompiledPreamble.cpp
+++ lib/Frontend/PrecompiledPreamble.cpp
@@ -328,6 +328,7 @@
   Clang->setSourceManager(
       new SourceManager(Diagnostics, Clang->getFileManager()));
 
+  Callbacks.BeforeExecute(*Clang);
   auto PreambleDepCollector = std::make_shared<DependencyCollector>();
   Clang->addDependencyCollector(PreambleDepCollector);
 
@@ -704,6 +705,7 @@
   }
 }
 
+void PreambleCallbacks::BeforeExecute(CompilerInstance &CI) {}
 void PreambleCallbacks::AfterExecute(CompilerInstance &CI) {}
 void PreambleCallbacks::AfterPCHEmitted(ASTWriter &Writer) {}
 void PreambleCallbacks::HandleTopLevelDecl(DeclGroupRef DG) {}
Index: include/clang/Frontend/PrecompiledPreamble.h
===================================================================
--- include/clang/Frontend/PrecompiledPreamble.h
+++ include/clang/Frontend/PrecompiledPreamble.h
@@ -244,6 +244,9 @@
 public:
   virtual ~PreambleCallbacks() = default;
 
+  /// Called before FrontendAction::Execute(). Can be used to assign a SourceManager
+  /// from a CompilerInstance.
+  virtual void BeforeExecute(CompilerInstance &CI);
   /// Called after FrontendAction::Execute(), but before
   /// FrontendAction::EndSourceFile(). Can be used to transfer ownership of
   /// various CompilerInstance fields before they are destroyed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41365.127396.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171218/dba643d9/attachment-0001.bin>


More information about the cfe-commits mailing list