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