13 #ifndef LLVM_CLANG_AST_EXTERNALASTMERGER_H 14 #define LLVM_CLANG_AST_EXTERNALASTMERGER_H 19 #include "llvm/Support/raw_ostream.h" 57 typedef std::map<const DeclContext *, DCOrigin>
OriginMap;
61 ImporterVector Importers;
66 llvm::raw_ostream *LogStream;
97 : AST(AST), FM(FM), OM(OM), Temporary(Temporary), Merger(Merger) {}
112 std::shared_ptr<ASTImporterSharedState> SharedState;
149 llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
182 void SetLogStream(llvm::raw_string_ostream &Stream) { LogStream = &Stream; }
190 template <
typename CallbackType>
191 void ForEachMatchingDC(
const DeclContext *DC, CallbackType Callback);
195 llvm::raw_ostream &
logs() {
return *LogStream; }
void MaybeRecordOrigin(const DeclContext *ToDC, DCOrigin Origin)
Records an origin in Origins only if name lookup would find something different or nothing at all...
const OriginMap & GetOrigins()
Get a read-only view of the Origins map, for use in constructing an ImporterSource for another Extern...
Implements support for file system lookup, file system caching, and directory search management...
ExternalASTMerger * getMerger() const
ImporterSource(ASTContext &AST, FileManager &FM, const OriginMap &OM, bool Temporary=false, ExternalASTMerger *Merger=nullptr)
Decl - This represents one declaration (or definition), e.g.
bool HasImporterForOrigin(ASTContext &OriginContext)
Returns true if Importers contains an ASTImporter whose source is OriginContext.
void SetLogStream(llvm::raw_string_ostream &Stream)
Sets the current log stream.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void AddSources(llvm::ArrayRef< ImporterSource > Sources)
Add a set of ASTContexts as possible origins.
The target for an ExternalASTMerger.
const OriginMap & getOriginMap() const
FileManager & getFileManager() const
Represents an ObjC class declaration.
bool LoggingEnabled()
True if the log stream is not llvm::nulls();.
A single origin for a DeclContext.
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Implementation of the ExternalASTSource API.
ASTContext & getASTContext() const
The result type of a method or function.
Abstract interface for external sources of AST nodes.
ASTImporter & ImporterForOrigin(ASTContext &OriginContext)
Returns a reference to the ASTImporter from Importers whose origin is OriginContext.
Represents the declaration of a struct/union/class/enum.
std::map< const DeclContext *, DCOrigin > OriginMap
std::vector< std::unique_ptr< ASTImporter > > ImporterVector
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool CanComplete(DeclContext *DC)
Returns true if DC can be found in any source AST context.
The name of a declaration.
void RemoveSources(llvm::ArrayRef< ImporterSource > Sources)
Remove a set of ASTContexts as possible origins.
llvm::raw_ostream & logs()
Log something if there is a logging callback installed.
A source for an ExternalASTMerger.
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl *> &Result) override
Implementation of the ExternalASTSource API.
void CompleteType(TagDecl *Tag) override
Implementation of the ExternalASTSource API.
void ForceRecordOrigin(const DeclContext *ToDC, DCOrigin Origin)
Regardless of any checks, override the Origin for a DeclContext.
Kind
Lists the kind of concrete classes of Decl.
Decl * FindOriginalDecl(Decl *D)
Asks all connected ASTImporters if any of them imported the given declaration.
ExternalASTSource implementation that merges information from several ASTContexts.
ExternalASTMerger(const ImporterTarget &Target, llvm::ArrayRef< ImporterSource > Sources)