[PATCH] D28779: [ASTReader] Add a DeserializationListener callback for IMPORTED_MODULES

Graydon Hoare via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 18 12:47:58 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL292436: [ASTReader] Add a DeserializationListener callback for IMPORTED_MODULES (authored by graydon).

Changed prior to commit:
  https://reviews.llvm.org/D28779?vs=84594&id=84881#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28779

Files:
  cfe/trunk/include/clang/Serialization/ASTDeserializationListener.h
  cfe/trunk/lib/Serialization/ASTReader.cpp


Index: cfe/trunk/include/clang/Serialization/ASTDeserializationListener.h
===================================================================
--- cfe/trunk/include/clang/Serialization/ASTDeserializationListener.h
+++ cfe/trunk/include/clang/Serialization/ASTDeserializationListener.h
@@ -26,6 +26,7 @@
 class MacroDefinitionRecord;
 class MacroInfo;
 class Module;
+class SourceLocation;
 
 class ASTDeserializationListener {
 public:
@@ -52,6 +53,9 @@
                                    MacroDefinitionRecord *MD) {}
   /// \brief A module definition was read from the AST file.
   virtual void ModuleRead(serialization::SubmoduleID ID, Module *Mod) {}
+  /// \brief A module import was read from the AST file.
+  virtual void ModuleImportRead(serialization::SubmoduleID ID,
+                                SourceLocation ImportLoc) {}
 };
 }
 
Index: cfe/trunk/lib/Serialization/ASTReader.cpp
===================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp
+++ cfe/trunk/lib/Serialization/ASTReader.cpp
@@ -3251,8 +3251,11 @@
         for (unsigned I = 0, N = Record.size(); I != N; /**/) {
           unsigned GlobalID = getGlobalSubmoduleID(F, Record[I++]);
           SourceLocation Loc = ReadSourceLocation(F, Record, I);
-          if (GlobalID)
+          if (GlobalID) {
             ImportedModules.push_back(ImportedSubmodule(GlobalID, Loc));
+            if (DeserializationListener)
+              DeserializationListener->ModuleImportRead(GlobalID, Loc);
+          }
         }
       }
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28779.84881.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170118/41146d4f/attachment.bin>


More information about the cfe-commits mailing list