diff options
author | Graydon Hoare <ghoare@apple.com> | 2017-01-18 20:36:59 +0000 |
---|---|---|
committer | Graydon Hoare <ghoare@apple.com> | 2017-01-18 20:36:59 +0000 |
commit | 9c982440a22f2212d749bc9550bf991a3896d7a6 (patch) | |
tree | 5106726a7e823628879063b8ffb2ca4caad2d410 /clang | |
parent | dc0405f74ce8e39a2a5f851cff03b8991085a7f1 (diff) | |
download | bcm5719-llvm-9c982440a22f2212d749bc9550bf991a3896d7a6.tar.gz bcm5719-llvm-9c982440a22f2212d749bc9550bf991a3896d7a6.zip |
[ASTReader] Add a DeserializationListener callback for IMPORTED_MODULES
Summary:
Add a callback from ASTReader to DeserializationListener when the former
reads an IMPORTED_MODULES block. This supports Swift in using PCH for
bridging headers.
Reviewers: doug.gregor, manmanren, bruno
Reviewed By: manmanren
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D28779
llvm-svn: 292436
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Serialization/ASTDeserializationListener.h | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/include/clang/Serialization/ASTDeserializationListener.h b/clang/include/clang/Serialization/ASTDeserializationListener.h index 4b10c39d8fb..c26f3e0b425 100644 --- a/clang/include/clang/Serialization/ASTDeserializationListener.h +++ b/clang/include/clang/Serialization/ASTDeserializationListener.h @@ -26,6 +26,7 @@ class QualType; class MacroDefinitionRecord; class MacroInfo; class Module; +class SourceLocation; class ASTDeserializationListener { public: @@ -52,6 +53,9 @@ public: 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) {} }; } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index cc78339aa7a..a4da0d2ebe2 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -3251,8 +3251,11 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { 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; |