//===--- ExternalASTMerger.h - Merging External AST Interface ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // 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/ASTImporterSharedState.h" #include "clang/AST/ExternalASTSource.h" #include "llvm/Support/raw_ostream.h" namespace clang { /// ExternalASTSource implementation that merges information from several /// ASTContexts. /// /// ExternalASTMerger maintains a vector of ASTImporters that it uses to import /// (potentially incomplete) Decls and DeclContexts from the source ASTContexts /// in response to ExternalASTSource API calls. /// /// When lookup occurs in the resulting imported DeclContexts, the original /// DeclContexts need to be queried. Roughly, there are three cases here: /// /// - The DeclContext of origin can be found by simple name lookup. In this /// case, no additional state is required. /// /// - The DeclContext of origin is different from what would be found by name /// lookup. In this case, Origins contains an entry overriding lookup and /// specifying the correct pair of DeclContext/ASTContext. /// /// - The DeclContext of origin was determined by another ExternalASTMerger. /// (This is possible when the source ASTContext for one of the Importers has /// its own ExternalASTMerger). The origin must be properly forwarded in this /// case. /// /// ExternalASTMerger's job is to maintain the data structures necessary to /// allow this. The data structures themselves can be extracted (read-only) and /// copied for re-use. class ExternalASTMerger : public ExternalASTSource { … }; } // end namespace clang #endif