]> granicus.if.org Git - clang/commitdiff
[modules] Correctly overload getModule in the MultiplexExternalSemaSource
authorRaphael Isemann <teemperor@gmail.com>
Mon, 22 Jan 2018 15:27:25 +0000 (15:27 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Mon, 22 Jan 2018 15:27:25 +0000 (15:27 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323122 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/MultiplexExternalSemaSource.h
lib/Sema/MultiplexExternalSemaSource.cpp

index 1d681a00552fc6fa1b8a9e4b4399cbc3056e5f50..4de36afbcb974e2269b5c39450351ac2d77c8a28 100644 (file)
@@ -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 
index 77ace0cfa579f9baa98f74a42edbbc738d3f5163..46238fb3e40bdfc07859d244d015176544b5a255 100644 (file)
@@ -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,