[PATCH] D31378: [PCH] Attach instance's dependency collectors to PCH external AST sources.

Graydon Hoare via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 29 10:45:46 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299009: [PCH] Attach instance's dependency collectors to PCH external AST sources. (authored by graydon).

Changed prior to commit:
  https://reviews.llvm.org/D31378?vs=93089&id=93387#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31378

Files:
  cfe/trunk/include/clang/Frontend/CompilerInstance.h
  cfe/trunk/lib/Frontend/CompilerInstance.cpp
  cfe/trunk/test/PCH/emit-dependencies.c


Index: cfe/trunk/lib/Frontend/CompilerInstance.cpp
===================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp
@@ -497,6 +497,8 @@
       AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(),
       getPCHContainerReader(),
       getFrontendOpts().ModuleFileExtensions,
+      TheDependencyFileGenerator.get(),
+      DependencyCollectors,
       DeserializationListener,
       OwnDeserializationListener, Preamble,
       getFrontendOpts().UseGlobalModuleIndex);
@@ -507,6 +509,8 @@
     bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
     const PCHContainerReader &PCHContainerRdr,
     ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
+    DependencyFileGenerator *DependencyFile,
+    ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
     void *DeserializationListener, bool OwnDeserializationListener,
     bool Preamble, bool UseGlobalModuleIndex) {
   HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
@@ -524,6 +528,12 @@
   Reader->setDeserializationListener(
       static_cast<ASTDeserializationListener *>(DeserializationListener),
       /*TakeOwnership=*/OwnDeserializationListener);
+
+  if (DependencyFile)
+    DependencyFile->AttachToASTReader(*Reader);
+  for (auto &Listener : DependencyCollectors)
+    Listener->attachToASTReader(*Reader);
+
   switch (Reader->ReadAST(Path,
                           Preamble ? serialization::MK_Preamble
                                    : serialization::MK_PCH,
Index: cfe/trunk/include/clang/Frontend/CompilerInstance.h
===================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h
@@ -662,6 +662,8 @@
       bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
       const PCHContainerReader &PCHContainerRdr,
       ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
+      DependencyFileGenerator *DependencyFile,
+      ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
       void *DeserializationListener, bool OwnDeserializationListener,
       bool Preamble, bool UseGlobalModuleIndex);
 
Index: cfe/trunk/test/PCH/emit-dependencies.c
===================================================================
--- cfe/trunk/test/PCH/emit-dependencies.c
+++ cfe/trunk/test/PCH/emit-dependencies.c
@@ -0,0 +1,9 @@
+// RUN: rm -f %t.pch
+// RUN: %clang_cc1 -emit-pch -o %t.pch %S/Inputs/chain-decls1.h
+// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file - %s | FileCheck %s
+// CHECK: Inputs/chain-decls1.h
+
+int main() {
+  f();
+  return 0;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31378.93387.patch
Type: text/x-patch
Size: 2799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170329/56093614/attachment-0001.bin>


More information about the cfe-commits mailing list