From 025d620ce92f559aeaba326605ce1b70d09295d1 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Mon, 22 Jan 2018 15:27:25 +0000 Subject: [PATCH] [modules] Correctly overload getModule in the MultiplexExternalSemaSource Summary: The MultiplexExternalSemaSource doesn't correctly overload the `getModule` function, causing the multiplexer to not forward this call as intended. Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39416 llvm-svn: 323122 --- clang/include/clang/Sema/MultiplexExternalSemaSource.h | 6 ++++-- clang/lib/Sema/MultiplexExternalSemaSource.cpp | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h b/clang/include/clang/Sema/MultiplexExternalSemaSource.h index 1d681a0..4de36af 100644 --- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h +++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h @@ -148,8 +148,10 @@ public: /// \brief Print any statistics that have been gathered regarding /// the external AST source. void PrintStats() override; - - + + /// \brief Retrieve the module that corresponds to the given module ID. + Module *getModule(unsigned ID) override; + /// \brief Perform layout on the given record. /// /// This routine allows the external AST source to provide an specific diff --git a/clang/lib/Sema/MultiplexExternalSemaSource.cpp b/clang/lib/Sema/MultiplexExternalSemaSource.cpp index 77ace0c..46238fb 100644 --- a/clang/lib/Sema/MultiplexExternalSemaSource.cpp +++ b/clang/lib/Sema/MultiplexExternalSemaSource.cpp @@ -164,6 +164,13 @@ void MultiplexExternalSemaSource::PrintStats() { Sources[i]->PrintStats(); } +Module *MultiplexExternalSemaSource::getModule(unsigned ID) { + for (size_t i = 0; i < Sources.size(); ++i) + if (auto M = Sources[i]->getModule(ID)) + return M; + return nullptr; +} + bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, -- 2.7.4