1 //===--- ExternalASTMerger.h - Merging External AST Interface ---*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the ExternalASTMerger, which vends a combination of ASTs 11 // from several different ASTContext/FileManager pairs 12 // 13 //===----------------------------------------------------------------------===// 14 #ifndef LLVM_CLANG_AST_EXTERNALASTMERGER_H 15 #define LLVM_CLANG_AST_EXTERNALASTMERGER_H 16 17 #include "clang/AST/ASTImporter.h" 18 #include "clang/AST/ExternalASTSource.h" 19 20 namespace clang { 21 22 class ExternalASTMerger : public ExternalASTSource { 23 public: 24 struct ImporterPair { 25 std::unique_ptr<ASTImporter> Forward; 26 std::unique_ptr<ASTImporter> Reverse; 27 }; 28 29 private: 30 std::vector<ImporterPair> Importers; 31 32 public: 33 struct ImporterEndpoint { 34 ASTContext &AST; 35 FileManager &FM; 36 }; 37 ExternalASTMerger(const ImporterEndpoint &Target, 38 llvm::ArrayRef<ImporterEndpoint> Sources); 39 40 bool FindExternalVisibleDeclsByName(const DeclContext *DC, 41 DeclarationName Name) override; 42 43 void 44 FindExternalLexicalDecls(const DeclContext *DC, 45 llvm::function_ref<bool(Decl::Kind)> IsKindWeWant, 46 SmallVectorImpl<Decl *> &Result) override; 47 }; 48 49 } // end namespace clang 50 51 #endif 52