aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/ExternalASTMerger.h
blob: 51d0c30ad23bf5b7b897e126bd87229ba030e996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//===--- ExternalASTMerger.h - Merging External AST Interface ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file declares the ExternalASTMerger, which vends a combination of ASTs
//  from several different ASTContext/FileManager pairs
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_EXTERNALASTMERGER_H
#define LLVM_CLANG_AST_EXTERNALASTMERGER_H

#include "clang/AST/ASTImporter.h"
#include "clang/AST/ExternalASTSource.h"

namespace clang {

class ExternalASTMerger : public ExternalASTSource {
public:
  struct ImporterPair {
    std::unique_ptr<ASTImporter> Forward;
    std::unique_ptr<ASTImporter> Reverse;
  };

private:
  std::vector<ImporterPair> Importers;

public:
  struct ImporterEndpoint {
    ASTContext &AST;
    FileManager &FM;
  };
  ExternalASTMerger(const ImporterEndpoint &Target,
                    llvm::ArrayRef<ImporterEndpoint> Sources);

  bool FindExternalVisibleDeclsByName(const DeclContext *DC,
                                      DeclarationName Name) override;

  void
  FindExternalLexicalDecls(const DeclContext *DC,
                           llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
                           SmallVectorImpl<Decl *> &Result) override;
};

} // end namespace clang

#endif