clang 20.0.0git
|
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate. More...
#include "clang/AST/ASTImporter.h"
Classes | |
class | ImportPathTy |
Public Types | |
enum class | ODRHandlingType { Conservative , Liberal } |
using | NonEquivalentDeclSet = llvm::DenseSet< std::tuple< Decl *, Decl *, int > > |
using | ImportedCXXBaseSpecifierMap = llvm::DenseMap< const CXXBaseSpecifier *, CXXBaseSpecifier * > |
Public Member Functions | |
ASTImporter (ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, std::shared_ptr< ASTImporterSharedState > SharedState=nullptr) | |
virtual | ~ASTImporter () |
bool | isMinimalImport () const |
Whether the importer will perform a minimal import, creating to-be-completed forward declarations when possible. | |
void | setODRHandling (ODRHandlingType T) |
template<typename ImportT > | |
llvm::Error | importInto (ImportT &To, const ImportT &From) |
Import the given object, returns the result. | |
llvm::Expected< ExprWithCleanups::CleanupObject > | Import (ExprWithCleanups::CleanupObject From) |
Import cleanup objects owned by ExprWithCleanup. | |
llvm::Expected< const Type * > | Import (const Type *FromT) |
Import the given type from the "from" context into the "to" context. | |
llvm::Expected< QualType > | Import (QualType FromT) |
Import the given qualified type from the "from" context into the "to" context. | |
llvm::Expected< TypeSourceInfo * > | Import (TypeSourceInfo *FromTSI) |
Import the given type source information from the "from" context into the "to" context. | |
llvm::Expected< Attr * > | Import (const Attr *FromAttr) |
Import the given attribute from the "from" context into the "to" context. | |
llvm::Expected< Decl * > | Import (Decl *FromD) |
Import the given declaration from the "from" context into the "to" context. | |
llvm::Expected< const Decl * > | Import (const Decl *FromD) |
llvm::Expected< InheritedConstructor > | Import (const InheritedConstructor &From) |
Decl * | GetAlreadyImportedOrNull (const Decl *FromD) const |
Return the copy of the given declaration in the "to" context if it has already been imported from the "from" context. | |
TranslationUnitDecl * | GetFromTU (Decl *ToD) |
Return the translation unit from where the declaration was imported. | |
template<typename DeclT > | |
std::optional< DeclT * > | getImportedFromDecl (const DeclT *ToD) const |
Return the declaration in the "from" context from which the declaration in the "to" context was imported. | |
llvm::Expected< DeclContext * > | ImportContext (DeclContext *FromDC) |
Import the given declaration context from the "from" AST context into the "to" AST context. | |
llvm::Expected< Expr * > | Import (Expr *FromE) |
Import the given expression from the "from" context into the "to" context. | |
llvm::Expected< Stmt * > | Import (Stmt *FromS) |
Import the given statement from the "from" context into the "to" context. | |
llvm::Expected< NestedNameSpecifier * > | Import (NestedNameSpecifier *FromNNS) |
Import the given nested-name-specifier from the "from" context into the "to" context. | |
llvm::Expected< NestedNameSpecifierLoc > | Import (NestedNameSpecifierLoc FromNNS) |
Import the given nested-name-specifier-loc from the "from" context into the "to" context. | |
llvm::Expected< TemplateName > | Import (TemplateName From) |
Import the given template name from the "from" context into the "to" context, or the import error. | |
llvm::Expected< SourceLocation > | Import (SourceLocation FromLoc) |
Import the given source location from the "from" context into the "to" context. | |
llvm::Expected< SourceRange > | Import (SourceRange FromRange) |
Import the given source range from the "from" context into the "to" context. | |
llvm::Expected< DeclarationName > | Import (DeclarationName FromName) |
Import the given declaration name from the "from" context into the "to" context. | |
IdentifierInfo * | Import (const IdentifierInfo *FromId) |
Import the given identifier from the "from" context into the "to" context. | |
llvm::Expected< Selector > | Import (Selector FromSel) |
Import the given Objective-C selector from the "from" context into the "to" context. | |
llvm::Expected< FileID > | Import (FileID, bool IsBuiltin=false) |
Import the given file ID from the "from" context into the "to" context. | |
llvm::Expected< CXXCtorInitializer * > | Import (CXXCtorInitializer *FromInit) |
Import the given C++ constructor initializer from the "from" context into the "to" context. | |
llvm::Expected< CXXBaseSpecifier * > | Import (const CXXBaseSpecifier *FromSpec) |
Import the given CXXBaseSpecifier from the "from" context into the "to" context. | |
llvm::Expected< APValue > | Import (const APValue &FromValue) |
Import the given APValue from the "from" context into the "to" context. | |
llvm::Error | ImportDefinition (Decl *From) |
Import the definition of the given declaration, including all of the declarations it contains. | |
llvm::Error | ImportTemplateArguments (ArrayRef< TemplateArgument > FromArgs, SmallVectorImpl< TemplateArgument > &ToArgs) |
Expected< TemplateArgument > | Import (const TemplateArgument &From) |
virtual Expected< DeclarationName > | HandleNameConflict (DeclarationName Name, DeclContext *DC, unsigned IDNS, NamedDecl **Decls, unsigned NumDecls) |
Cope with a name conflict when importing a declaration into the given context. | |
ASTContext & | getToContext () const |
Retrieve the context that AST nodes are being imported into. | |
ASTContext & | getFromContext () const |
Retrieve the context that AST nodes are being imported from. | |
FileManager & | getToFileManager () const |
Retrieve the file manager that AST nodes are being imported into. | |
FileManager & | getFromFileManager () const |
Retrieve the file manager that AST nodes are being imported from. | |
DiagnosticBuilder | ToDiag (SourceLocation Loc, unsigned DiagID) |
Report a diagnostic in the "to" context. | |
DiagnosticBuilder | FromDiag (SourceLocation Loc, unsigned DiagID) |
Report a diagnostic in the "from" context. | |
NonEquivalentDeclSet & | getNonEquivalentDecls () |
Return the set of declarations that we know are not equivalent. | |
virtual void | CompleteDecl (Decl *D) |
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl. | |
virtual void | Imported (Decl *From, Decl *To) |
Subclasses can override this function to observe all of the From -> To declaration mappings as they are imported. | |
void | RegisterImportedDecl (Decl *FromD, Decl *ToD) |
Decl * | MapImported (Decl *From, Decl *To) |
Store and assign the imported declaration to its counterpart. | |
virtual Decl * | GetOriginalDecl (Decl *To) |
Called by StructuralEquivalenceContext. | |
std::optional< ASTImportError > | getImportDeclErrorIfAny (Decl *FromD) const |
Return if import of the given declaration has failed and if yes the kind of the problem. | |
void | setImportDeclError (Decl *From, ASTImportError Error) |
Mark (newly) imported declaration with error. | |
bool | IsStructurallyEquivalent (QualType From, QualType To, bool Complain=true) |
Determine whether the given types are structurally equivalent. | |
Static Public Member Functions | |
static std::optional< unsigned > | getFieldIndex (Decl *F) |
Determine the index of a field in its parent record. | |
Protected Member Functions | |
virtual Expected< Decl * > | ImportImpl (Decl *From) |
Can be overwritten by subclasses to implement their own import logic. | |
virtual bool | returnWithErrorInTest () |
Used only in unittests to verify the behaviour of the error handling. | |
Friends | |
class | ASTNodeImporter |
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate.
Definition at line 62 of file ASTImporter.h.
using clang::ASTImporter::ImportedCXXBaseSpecifierMap = llvm::DenseMap<const CXXBaseSpecifier *, CXXBaseSpecifier *> |
Definition at line 67 of file ASTImporter.h.
using clang::ASTImporter::NonEquivalentDeclSet = llvm::DenseSet<std::tuple<Decl *, Decl *, int> > |
Definition at line 65 of file ASTImporter.h.
|
strong |
Enumerator | |
---|---|
Conservative | |
Liberal |
Definition at line 70 of file ASTImporter.h.
ASTImporter::ASTImporter | ( | ASTContext & | ToContext, |
FileManager & | ToFileManager, | ||
ASTContext & | FromContext, | ||
FileManager & | FromFileManager, | ||
bool | MinimalImport, | ||
std::shared_ptr< ASTImporterSharedState > | SharedState = nullptr |
||
) |
ToContext | The context we'll be importing into. |
ToFileManager | The file manager we'll be importing into. |
FromContext | The context we'll be importing from. |
FromFileManager | The file manager we'll be importing into. |
MinimalImport | If true, the importer will attempt to import as little as it can, e.g., by importing declarations as forward declarations that can be completed at a later point. |
SharedState | The importer specific lookup table which may be shared amongst several ASTImporter objects. If not set then the original C/C++ lookup is used. |
Definition at line 9015 of file ASTImporter.cpp.
References clang::ASTContext::getTranslationUnitDecl().
|
virtualdefault |
|
virtual |
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
Mark the Decl as complete, filling it in as much as possible.
D | A declaration in the "to" context. |
Definition at line 10482 of file ASTImporter.cpp.
References D.
Referenced by ImportContext().
DiagnosticBuilder ASTImporter::FromDiag | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Report a diagnostic in the "from" context.
Definition at line 10474 of file ASTImporter.cpp.
References clang::ASTContext::getDiagnostics(), Loc, clang::DiagnosticsEngine::notePriorDiagnosticFrom(), and clang::DiagnosticsEngine::Report().
Referenced by clang::ASTNodeImporter::ImportDeclParts(), clang::ASTNodeImporter::ImportDefinition(), clang::ASTNodeImporter::VisitDecl(), clang::ASTNodeImporter::VisitExpr(), clang::ASTNodeImporter::VisitImportDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTNodeImporter::VisitObjCMethodDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTNodeImporter::VisitStmt(), and clang::ASTNodeImporter::VisitType().
Return the copy of the given declaration in the "to" context if it has already been imported from the "from" context.
Otherwise return nullptr.
Definition at line 9447 of file ASTImporter.cpp.
Referenced by Import(), clang::ASTNodeImporter::ImportDeclContext(), clang::ASTNodeImporter::ImportDeclParts(), and clang::ASTNodeImporter::VisitTypedefNameDecl().
Determine the index of a field in its parent record.
F should be a field (or indirect field) declaration.
std::nullopt
is returned (parent context is non-record). Definition at line 9034 of file ASTImporter.cpp.
References D, and clang::Decl::getDeclContext().
Referenced by clang::ASTNodeImporter::VisitFieldDecl(), and clang::ASTNodeImporter::VisitIndirectFieldDecl().
|
inline |
Retrieve the context that AST nodes are being imported from.
Definition at line 528 of file ASTImporter.h.
Referenced by clang::ASTNodeImporter::ImportDefinition(), clang::ASTNodeImporter::IsStructuralMatch(), clang::ASTNodeImporter::VisitFunctionDecl(), clang::ASTNodeImporter::VisitUsingDecl(), clang::ASTNodeImporter::VisitUsingEnumDecl(), and clang::ASTNodeImporter::VisitUsingShadowDecl().
|
inline |
Retrieve the file manager that AST nodes are being imported from.
Definition at line 534 of file ASTImporter.h.
TranslationUnitDecl * ASTImporter::GetFromTU | ( | Decl * | ToD | ) |
Return the translation unit from where the declaration was imported.
If it does not exist nullptr is returned.
Definition at line 9451 of file ASTImporter.cpp.
Referenced by clang::ASTNodeImporter::hasSameVisibilityContextAndLinkage().
std::optional< ASTImportError > ASTImporter::getImportDeclErrorIfAny | ( | Decl * | FromD | ) | const |
Return if import of the given declaration has failed and if yes the kind of the problem.
This gives the first error encountered with the node.
Definition at line 10521 of file ASTImporter.cpp.
Referenced by Import().
|
inline |
Return the declaration in the "from" context from which the declaration in the "to" context was imported.
If it was not imported or of the wrong type a null value is returned.
Definition at line 371 of file ASTImporter.h.
Referenced by clang::ASTNodeImporter::VisitCXXDefaultArgExpr().
|
inline |
Return the set of declarations that we know are not equivalent.
Definition at line 543 of file ASTImporter.h.
Referenced by clang::ASTNodeImporter::IsStructuralMatch().
Called by StructuralEquivalenceContext.
If a RecordDecl is being compared to another RecordDecl as part of import, completing the other RecordDecl may trigger importation of the first RecordDecl. This happens especially for anonymous structs. If the original of the second RecordDecl can be found, we can complete it without the need for importation, eliminating this loop.
Definition at line 568 of file ASTImporter.h.
Referenced by clang::ASTNodeImporter::IsStructuralMatch().
|
inline |
Retrieve the context that AST nodes are being imported into.
Definition at line 525 of file ASTImporter.h.
Referenced by Import(), clang::ASTNodeImporter::import(), clang::ASTNodeImporter::ImportDefinition(), clang::ASTNodeImporter::ImportObjCTypeParamList(), clang::ASTNodeImporter::ImportTemplateInformation(), clang::ASTNodeImporter::IsStructuralMatch(), clang::ASTNodeImporter::VisitAccessSpecDecl(), clang::ASTNodeImporter::VisitAddrLabelExpr(), clang::ASTNodeImporter::VisitArrayInitIndexExpr(), clang::ASTNodeImporter::VisitArrayInitLoopExpr(), clang::ASTNodeImporter::VisitArraySubscriptExpr(), clang::ASTNodeImporter::VisitArrayTypeTraitExpr(), clang::ASTNodeImporter::VisitAtomicExpr(), clang::ASTNodeImporter::VisitAttributedStmt(), clang::ASTNodeImporter::VisitBinaryConditionalOperator(), clang::ASTNodeImporter::VisitBinaryOperator(), clang::ASTNodeImporter::VisitBindingDecl(), clang::ASTNodeImporter::VisitBreakStmt(), clang::ASTNodeImporter::VisitBuiltinTemplateDecl(), clang::ASTNodeImporter::VisitCallExpr(), clang::ASTNodeImporter::VisitCaseStmt(), clang::ASTNodeImporter::VisitCharacterLiteral(), clang::ASTNodeImporter::VisitChooseExpr(), clang::ASTNodeImporter::VisitClassTemplateDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTNodeImporter::VisitCompoundAssignOperator(), clang::ASTNodeImporter::VisitCompoundLiteralExpr(), clang::ASTNodeImporter::VisitCompoundStmt(), clang::ASTNodeImporter::VisitConditionalOperator(), clang::ASTNodeImporter::VisitConstantExpr(), clang::ASTNodeImporter::VisitContinueStmt(), clang::ASTNodeImporter::VisitConvertVectorExpr(), clang::ASTNodeImporter::VisitCXXBindTemporaryExpr(), clang::ASTNodeImporter::VisitCXXBoolLiteralExpr(), clang::ASTNodeImporter::VisitCXXCatchStmt(), clang::ASTNodeImporter::VisitCXXConstructExpr(), clang::ASTNodeImporter::VisitCXXDefaultArgExpr(), clang::ASTNodeImporter::VisitCXXDefaultInitExpr(), clang::ASTNodeImporter::VisitCXXDeleteExpr(), clang::ASTNodeImporter::VisitCXXDependentScopeMemberExpr(), clang::ASTNodeImporter::VisitCXXFoldExpr(), clang::ASTNodeImporter::VisitCXXForRangeStmt(), clang::ASTNodeImporter::VisitCXXInheritedCtorInitExpr(), clang::ASTNodeImporter::VisitCXXMemberCallExpr(), clang::ASTNodeImporter::VisitCXXNamedCastExpr(), clang::ASTNodeImporter::VisitCXXNewExpr(), clang::ASTNodeImporter::VisitCXXNoexceptExpr(), clang::ASTNodeImporter::VisitCXXNullPtrLiteralExpr(), clang::ASTNodeImporter::VisitCXXPseudoDestructorExpr(), clang::ASTNodeImporter::VisitCXXRewrittenBinaryOperator(), clang::ASTNodeImporter::VisitCXXScalarValueInitExpr(), clang::ASTNodeImporter::VisitCXXStdInitializerListExpr(), clang::ASTNodeImporter::VisitCXXTemporaryObjectExpr(), clang::ASTNodeImporter::VisitCXXThisExpr(), clang::ASTNodeImporter::VisitCXXThrowExpr(), clang::ASTNodeImporter::VisitCXXTryStmt(), clang::ASTNodeImporter::VisitCXXTypeidExpr(), clang::ASTNodeImporter::VisitCXXUnresolvedConstructExpr(), clang::ASTNodeImporter::VisitDeclRefExpr(), clang::ASTNodeImporter::VisitDeclStmt(), clang::ASTNodeImporter::VisitDefaultStmt(), clang::ASTNodeImporter::VisitDependentScopeDeclRefExpr(), clang::ASTNodeImporter::VisitDesignatedInitExpr(), clang::ASTNodeImporter::VisitDoStmt(), clang::ASTNodeImporter::VisitEmptyDecl(), clang::ASTNodeImporter::VisitEnumConstantDecl(), clang::ASTNodeImporter::VisitEnumDecl(), clang::ASTNodeImporter::VisitExplicitCastExpr(), clang::ASTNodeImporter::VisitExpressionTraitExpr(), clang::ASTNodeImporter::VisitExprWithCleanups(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTNodeImporter::VisitFixedPointLiteral(), clang::ASTNodeImporter::VisitFloatingLiteral(), clang::ASTNodeImporter::VisitForStmt(), clang::ASTNodeImporter::VisitFriendDecl(), clang::ASTNodeImporter::VisitFunctionDecl(), clang::ASTNodeImporter::VisitFunctionTemplateDecl(), clang::ASTNodeImporter::VisitGCCAsmStmt(), clang::ASTNodeImporter::VisitGenericSelectionExpr(), clang::ASTNodeImporter::VisitGNUNullExpr(), clang::ASTNodeImporter::VisitGotoStmt(), clang::ASTNodeImporter::VisitIfStmt(), clang::ASTNodeImporter::VisitImaginaryLiteral(), clang::ASTNodeImporter::VisitImplicitCastExpr(), clang::ASTNodeImporter::VisitImplicitParamDecl(), clang::ASTNodeImporter::VisitImplicitValueInitExpr(), clang::ASTNodeImporter::VisitIndirectFieldDecl(), clang::ASTNodeImporter::VisitIndirectGotoStmt(), clang::ASTNodeImporter::VisitInitListExpr(), clang::ASTNodeImporter::VisitIntegerLiteral(), clang::ASTNodeImporter::VisitLabelDecl(), clang::ASTNodeImporter::VisitLabelStmt(), clang::ASTNodeImporter::VisitLambdaExpr(), clang::ASTNodeImporter::VisitLinkageSpecDecl(), clang::ASTNodeImporter::VisitMaterializeTemporaryExpr(), clang::ASTNodeImporter::VisitMemberExpr(), clang::ASTNodeImporter::VisitNamespaceAliasDecl(), clang::ASTNodeImporter::VisitNamespaceDecl(), clang::ASTNodeImporter::VisitNonTypeTemplateParmDecl(), clang::ASTNodeImporter::VisitNullStmt(), clang::ASTNodeImporter::VisitObjCAtCatchStmt(), clang::ASTNodeImporter::VisitObjCAtFinallyStmt(), clang::ASTNodeImporter::VisitObjCAtSynchronizedStmt(), clang::ASTNodeImporter::VisitObjCAtThrowStmt(), clang::ASTNodeImporter::VisitObjCAtTryStmt(), clang::ASTNodeImporter::VisitObjCAutoreleasePoolStmt(), clang::ASTNodeImporter::VisitObjCCategoryDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitObjCForCollectionStmt(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTNodeImporter::VisitObjCInterfaceDecl(), clang::ASTNodeImporter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCMethodDecl(), clang::ASTNodeImporter::VisitObjCPropertyDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTNodeImporter::VisitObjCProtocolDecl(), clang::ASTNodeImporter::VisitObjCTypeParamDecl(), clang::ASTNodeImporter::VisitOffsetOfExpr(), clang::ASTNodeImporter::VisitOpaqueValueExpr(), clang::ASTNodeImporter::VisitPackExpansionExpr(), clang::ASTNodeImporter::VisitParenExpr(), clang::ASTNodeImporter::VisitParenListExpr(), clang::ASTNodeImporter::VisitParmVarDecl(), clang::ASTNodeImporter::VisitPredefinedExpr(), clang::ASTNodeImporter::VisitRecordDecl(), clang::ASTNodeImporter::VisitReturnStmt(), clang::ASTNodeImporter::VisitShuffleVectorExpr(), clang::ASTNodeImporter::VisitSizeOfPackExpr(), clang::ASTNodeImporter::VisitSourceLocExpr(), clang::ASTNodeImporter::VisitStaticAssertDecl(), clang::ASTNodeImporter::VisitStmtExpr(), clang::ASTNodeImporter::VisitStringLiteral(), clang::ASTNodeImporter::VisitSubstNonTypeTemplateParmExpr(), clang::ASTNodeImporter::VisitSwitchStmt(), clang::ASTNodeImporter::VisitTemplateTemplateParmDecl(), clang::ASTNodeImporter::VisitTemplateTypeParmDecl(), clang::ASTNodeImporter::VisitTranslationUnitDecl(), clang::ASTNodeImporter::VisitTypeAliasTemplateDecl(), clang::ASTNodeImporter::VisitTypedefNameDecl(), clang::ASTNodeImporter::VisitTypeTraitExpr(), clang::ASTNodeImporter::VisitUnaryExprOrTypeTraitExpr(), clang::ASTNodeImporter::VisitUnaryOperator(), clang::ASTNodeImporter::VisitUnresolvedLookupExpr(), clang::ASTNodeImporter::VisitUnresolvedMemberExpr(), clang::ASTNodeImporter::VisitUnresolvedUsingTypenameDecl(), clang::ASTNodeImporter::VisitUnresolvedUsingValueDecl(), clang::ASTNodeImporter::VisitUsingDecl(), clang::ASTNodeImporter::VisitUsingDirectiveDecl(), clang::ASTNodeImporter::VisitUsingEnumDecl(), clang::ASTNodeImporter::VisitUsingPackDecl(), clang::ASTNodeImporter::VisitUsingShadowDecl(), clang::ASTNodeImporter::VisitVAArgExpr(), clang::ASTNodeImporter::VisitVarDecl(), clang::ASTNodeImporter::VisitVarTemplateDecl(), clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitWhileStmt().
|
inline |
Retrieve the file manager that AST nodes are being imported into.
Definition at line 531 of file ASTImporter.h.
|
virtual |
Cope with a name conflict when importing a declaration into the given context.
This routine is invoked whenever there is a name conflict while importing a declaration. The returned name will become the name of the imported declaration. By default, the returned name is the same as the original name, leaving the conflict unresolve such that name lookup for this name is likely to find an ambiguity later.
Subclasses may override this routine to resolve the conflict, e.g., by renaming the declaration being imported.
Name | the name of the declaration being imported, which conflicts with other declarations. |
DC | the declaration context (in the "to" AST context) in which the name is being imported. |
IDNS | the identifier namespace in which the name will be found. |
Decls | the set of declarations with the same name as the declaration being imported. |
NumDecls | the number of conflicting declarations in Decls . |
Definition at line 10453 of file ASTImporter.cpp.
References Conservative, and clang::ASTImportError::NameConflict.
Referenced by clang::ASTNodeImporter::VisitClassTemplateDecl(), clang::ASTNodeImporter::VisitEnumConstantDecl(), clang::ASTNodeImporter::VisitEnumDecl(), clang::ASTNodeImporter::VisitFunctionDecl(), clang::ASTNodeImporter::VisitNamespaceDecl(), clang::ASTNodeImporter::VisitRecordDecl(), clang::ASTNodeImporter::VisitTypeAliasTemplateDecl(), clang::ASTNodeImporter::VisitTypedefNameDecl(), clang::ASTNodeImporter::VisitVarDecl(), and clang::ASTNodeImporter::VisitVarTemplateDecl().
llvm::Expected< APValue > ASTImporter::Import | ( | const APValue & | FromValue | ) |
Import the given APValue from the "from" context into the "to" context.
Definition at line 10157 of file ASTImporter.cpp.
References clang::ASTNodeImporter::ImportAPValue().
Import the given attribute from the "from" context into the "to" context.
Definition at line 9301 of file ASTImporter.cpp.
References clang::Attr::getKind(), and Import().
Expected< CXXBaseSpecifier * > ASTImporter::Import | ( | const CXXBaseSpecifier * | FromSpec | ) |
Import the given CXXBaseSpecifier from the "from" context into the "to" context.
Definition at line 10136 of file ASTImporter.cpp.
References clang::CXXBaseSpecifier::getAccessSpecifierAsWritten(), clang::CXXBaseSpecifier::getEllipsisLoc(), clang::CXXBaseSpecifier::getSourceRange(), clang::CXXBaseSpecifier::getTypeSourceInfo(), Import(), Imported(), clang::CXXBaseSpecifier::isBaseOfClass(), and clang::CXXBaseSpecifier::isVirtual().
|
inline |
Definition at line 351 of file ASTImporter.h.
References Import().
IdentifierInfo * ASTImporter::Import | ( | const IdentifierInfo * | FromId | ) |
Import the given identifier from the "from" context into the "to" context.
Definition at line 10269 of file ASTImporter.cpp.
References clang::IdentifierTable::get(), clang::IdentifierInfo::getBuiltinID(), clang::IdentifierInfo::getName(), clang::ASTContext::Idents, and clang::IdentifierInfo::setBuiltinID().
llvm::Expected< InheritedConstructor > ASTImporter::Import | ( | const InheritedConstructor & | From | ) |
Definition at line 9610 of file ASTImporter.cpp.
References ASTNodeImporter.
Expected< TemplateArgument > clang::ASTImporter::Import | ( | const TemplateArgument & | From | ) |
ExpectedTypePtr ASTImporter::Import | ( | const Type * | FromT | ) |
Import the given type from the "from" context into the "to" context.
Definition at line 9115 of file ASTImporter.cpp.
References clang::TypeVisitor< ImplClass, RetTy >::Visit().
Expected< CXXCtorInitializer * > ASTImporter::Import | ( | CXXCtorInitializer * | FromInit | ) |
Import the given C++ constructor initializer from the "from" context into the "to" context.
Definition at line 10071 of file ASTImporter.cpp.
References clang::CXXCtorInitializer::getEllipsisLoc(), clang::CXXCtorInitializer::getIndirectMember(), clang::CXXCtorInitializer::getInit(), clang::CXXCtorInitializer::getLParenLoc(), clang::CXXCtorInitializer::getMember(), clang::CXXCtorInitializer::getMemberLocation(), clang::CXXCtorInitializer::getRParenLoc(), clang::CXXCtorInitializer::getTypeSourceInfo(), Import(), importInto(), clang::CXXCtorInitializer::isBaseInitializer(), clang::CXXCtorInitializer::isBaseVirtual(), clang::CXXCtorInitializer::isDelegatingInitializer(), clang::CXXCtorInitializer::isIndirectMemberInitializer(), clang::CXXCtorInitializer::isMemberInitializer(), and clang::CXXCtorInitializer::isPackExpansion().
Import the given declaration from the "from" context into the "to" context.
Definition at line 9458 of file ASTImporter.cpp.
References clang::Decl::addAttr(), clang::ASTImporter::ImportPathTy::copyCycleAtBack(), E, GetAlreadyImportedOrNull(), clang::Decl::getAttrs(), clang::Decl::getDeclContext(), getImportDeclErrorIfAny(), clang::Decl::hasAttrs(), clang::ASTImporter::ImportPathTy::hasCycleAtBack(), Import(), Imported(), ImportImpl(), Path, clang::ASTImporter::ImportPathTy::pop(), clang::ASTImporter::ImportPathTy::push(), setImportDeclError(), and clang::updateFlags().
Expected< DeclarationName > ASTImporter::Import | ( | DeclarationName | FromName | ) |
Import the given declaration name from the "from" context into the "to" context.
Definition at line 10205 of file ASTImporter.cpp.
References clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXConversionFunctionName, clang::DeclarationName::CXXDeductionGuideName, clang::DeclarationName::CXXDestructorName, clang::DeclarationName::CXXLiteralOperatorName, clang::DeclarationName::CXXOperatorName, clang::DeclarationName::CXXUsingDirective, clang::ASTContext::DeclarationNames, clang::DeclarationName::getAsIdentifierInfo(), clang::ASTContext::getCanonicalType(), clang::DeclarationNameTable::getCXXConstructorName(), clang::DeclarationNameTable::getCXXConversionFunctionName(), clang::DeclarationNameTable::getCXXDeductionGuideName(), clang::DeclarationName::getCXXDeductionGuideTemplate(), clang::DeclarationNameTable::getCXXDestructorName(), clang::DeclarationName::getCXXLiteralIdentifier(), clang::DeclarationNameTable::getCXXLiteralOperatorName(), clang::DeclarationName::getCXXNameType(), clang::DeclarationNameTable::getCXXOperatorName(), clang::DeclarationName::getCXXOverloadedOperator(), clang::DeclarationName::getNameKind(), clang::DeclarationName::getObjCSelector(), clang::DeclarationName::getUsingDirectiveName(), clang::DeclarationName::Identifier, Import(), clang::DeclarationName::ObjCMultiArgSelector, clang::DeclarationName::ObjCOneArgSelector, and clang::DeclarationName::ObjCZeroArgSelector.
Import the given expression from the "from" context into the "to" context.
Definition at line 9681 of file ASTImporter.cpp.
References Import().
llvm::Expected< ExprWithCleanups::CleanupObject > ASTImporter::Import | ( | ExprWithCleanups::CleanupObject | From | ) |
Import cleanup objects owned by ExprWithCleanup.
Definition at line 9104 of file ASTImporter.cpp.
References Import(), and clang::ASTImportError::UnsupportedConstruct.
Referenced by clang::ASTMergeAction::ExecuteAction(), clang::ExternalASTMerger::FindExternalVisibleDeclsByName(), Import(), clang::ASTNodeImporter::import(), ImportContext(), ImportDefinition(), importInto(), importSpecializations(), IsStructurallyEquivalent(), setTypedefNameForAnonDecl(), clang::ASTNodeImporter::VisitCXXPseudoDestructorExpr(), clang::ASTNodeImporter::VisitGCCAsmStmt(), clang::ASTNodeImporter::VisitNamespaceAliasDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitOffsetOfExpr(), clang::ASTNodeImporter::VisitTemplateTypeParmDecl(), and clang::ASTNodeImporter::VisitUsingPackDecl().
Import the given file ID from the "from" context into the "to" context.
Definition at line 9984 of file ASTImporter.cpp.
References clang::SourceManager::createExpansionLoc(), clang::SourceManager::createFileID(), clang::SourceManager::createMacroArgExpansionLoc(), clang::SrcMgr::FileInfo::getContentCache(), clang::ASTContext::getDiagnostics(), clang::SrcMgr::SLocEntry::getExpansion(), clang::SrcMgr::ExpansionInfo::getExpansionLocEnd(), clang::SrcMgr::ExpansionInfo::getExpansionLocStart(), clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getFileCharacteristic(), clang::SourceManager::getFileID(), clang::SourceManager::getFileIDSize(), clang::SourceManager::getFileManager(), clang::SrcMgr::FileInfo::getIncludeLoc(), clang::SourceManager::getLocForStartOfFile(), clang::SourceManager::getMainFileID(), clang::FileManager::getOptionalFileRef(), clang::SourceManager::getSLocEntry(), clang::ASTContext::getSourceManager(), clang::SrcMgr::ExpansionInfo::getSpellingLoc(), Import(), clang::SrcMgr::SLocEntry::isExpansion(), clang::SrcMgr::ExpansionInfo::isExpansionTokenRange(), clang::FileID::isInvalid(), clang::SrcMgr::ExpansionInfo::isMacroArgExpansion(), clang::FileID::isValid(), and clang::ASTImportError::Unknown.
Expected< NestedNameSpecifier * > ASTImporter::Import | ( | NestedNameSpecifier * | FromNNS | ) |
Import the given nested-name-specifier from the "from" context into the "to" context.
Definition at line 9718 of file ASTImporter.cpp.
References clang::NestedNameSpecifier::Create(), clang::NestedNameSpecifier::getAsIdentifier(), clang::NestedNameSpecifier::getAsNamespace(), clang::NestedNameSpecifier::getAsNamespaceAlias(), clang::NestedNameSpecifier::getAsRecordDecl(), clang::NestedNameSpecifier::getAsType(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifier::getPrefix(), clang::NestedNameSpecifier::Global, clang::NestedNameSpecifier::GlobalSpecifier(), clang::NestedNameSpecifier::Identifier, Import(), importInto(), clang::NestedNameSpecifier::Namespace, clang::NestedNameSpecifier::NamespaceAlias, clang::NestedNameSpecifier::Super, clang::NestedNameSpecifier::SuperSpecifier(), clang::NestedNameSpecifier::TypeSpec, and clang::NestedNameSpecifier::TypeSpecWithTemplate.
Expected< NestedNameSpecifierLoc > ASTImporter::Import | ( | NestedNameSpecifierLoc | FromNNS | ) |
Import the given nested-name-specifier-loc from the "from" context into the "to" context.
Definition at line 9772 of file ASTImporter.cpp.
References clang::NestedNameSpecifier::getAsIdentifier(), clang::NestedNameSpecifier::getAsNamespace(), clang::NestedNameSpecifier::getAsNamespaceAlias(), clang::NestedNameSpecifier::getAsRecordDecl(), clang::NestedNameSpecifier::getAsType(), clang::TypeLoc::getBeginLoc(), clang::NestedNameSpecifier::getKind(), clang::NestedNameSpecifierLoc::getLocalBeginLoc(), clang::NestedNameSpecifierLoc::getLocalEndLoc(), clang::NestedNameSpecifierLoc::getNestedNameSpecifier(), clang::NestedNameSpecifierLoc::getPrefix(), clang::NestedNameSpecifierLoc::getSourceRange(), getToContext(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::TypeSourceInfo::getTypeLoc(), clang::NestedNameSpecifier::Global, clang::NestedNameSpecifier::Identifier, Import(), importInto(), clang::NestedNameSpecifier::Namespace, clang::NestedNameSpecifier::NamespaceAlias, clang::NestedNameSpecifier::Super, clang::NestedNameSpecifier::TypeSpec, and clang::NestedNameSpecifier::TypeSpecWithTemplate.
Import the given qualified type from the "from" context into the "to" context.
A null type is imported as a null type (no error).
Definition at line 9137 of file ASTImporter.cpp.
References clang::QualType::getLocalQualifiers(), clang::ASTContext::getQualifiedType(), clang::QualType::getTypePtr(), Import(), and clang::QualType::isNull().
Import the given Objective-C selector from the "from" context into the "to" context.
Definition at line 10281 of file ASTImporter.cpp.
References clang::Selector::getIdentifierInfoForSlot(), clang::Selector::getNumArgs(), clang::SelectorTable::getSelector(), Import(), clang::Selector::isNull(), and clang::ASTContext::Selectors.
Expected< SourceLocation > ASTImporter::Import | ( | SourceLocation | FromLoc | ) |
Import the given source location from the "from" context into the "to" context.
Definition at line 9959 of file ASTImporter.cpp.
References clang::SourceManager::getComposedLoc(), clang::SourceManager::getDecomposedLoc(), clang::ASTContext::getSourceManager(), Import(), clang::SourceLocation::isInvalid(), and clang::SourceManager::isWrittenInBuiltinFile().
Expected< SourceRange > ASTImporter::Import | ( | SourceRange | FromRange | ) |
Import the given source range from the "from" context into the "to" context.
Definition at line 9974 of file ASTImporter.cpp.
References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), and importInto().
Import the given statement from the "from" context into the "to" context.
Definition at line 9688 of file ASTImporter.cpp.
References clang::TypeVisitor< ImplClass, RetTy >::Visit().
Expected< TemplateName > ASTImporter::Import | ( | TemplateName | From | ) |
Import the given template name from the "from" context into the "to" context, or the import error.
Definition at line 9857 of file ASTImporter.cpp.
References clang::UnresolvedSetImpl::addDecl(), clang::TemplateName::AssumedTemplate, clang::UnresolvedSetImpl::begin(), clang::TemplateName::DeducedTemplate, clang::TemplateName::DependentTemplate, clang::UnresolvedSetImpl::end(), clang::SubstTemplateTemplateParmPackStorage::getArgumentPack(), clang::TemplateName::getAsAssumedTemplateName(), clang::TemplateName::getAsDependentTemplateName(), clang::TemplateName::getAsOverloadedTemplate(), clang::TemplateName::getAsQualifiedTemplateName(), clang::SubstTemplateTemplateParmPackStorage::getAssociatedDecl(), clang::SubstTemplateTemplateParmStorage::getAssociatedDecl(), clang::TemplateName::getAsSubstTemplateTemplateParm(), clang::TemplateName::getAsSubstTemplateTemplateParmPack(), clang::ASTContext::getAssumedTemplateName(), clang::TemplateName::getAsTemplateDecl(), clang::TemplateName::getAsUsingShadowDecl(), clang::AssumedTemplateStorage::getDeclName(), clang::ASTContext::getDependentTemplateName(), clang::SubstTemplateTemplateParmPackStorage::getFinal(), clang::DependentTemplateName::getIdentifier(), clang::SubstTemplateTemplateParmPackStorage::getIndex(), clang::SubstTemplateTemplateParmStorage::getIndex(), clang::TemplateName::getKind(), clang::DependentTemplateName::getOperator(), clang::ASTContext::getOverloadedTemplateName(), clang::SubstTemplateTemplateParmStorage::getPackIndex(), clang::ASTContext::getQualifiedTemplateName(), clang::QualifiedTemplateName::getQualifier(), clang::DependentTemplateName::getQualifier(), clang::SubstTemplateTemplateParmStorage::getReplacement(), clang::ASTContext::getSubstTemplateTemplateParm(), clang::ASTContext::getSubstTemplateTemplateParmPack(), clang::QualifiedTemplateName::getUnderlyingTemplate(), clang::QualifiedTemplateName::hasTemplateKeyword(), Import(), clang::ASTNodeImporter::ImportTemplateArgument(), clang::DependentTemplateName::isIdentifier(), clang::TemplateName::OverloadedTemplate, clang::TemplateName::QualifiedTemplate, clang::TemplateName::SubstTemplateTemplateParm, clang::TemplateName::SubstTemplateTemplateParmPack, clang::TemplateName::Template, and clang::TemplateName::UsingTemplate.
Expected< TypeSourceInfo * > ASTImporter::Import | ( | TypeSourceInfo * | FromTSI | ) |
Import the given type source information from the "from" context into the "to" context.
Definition at line 9148 of file ASTImporter.cpp.
References clang::TypeLoc::getBeginLoc(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), and Import().
Expected< DeclContext * > ASTImporter::ImportContext | ( | DeclContext * | FromDC | ) |
Import the given declaration context from the "from" AST context into the "to" AST context.
Definition at line 9614 of file ASTImporter.cpp.
References ASTNodeImporter, CompleteDecl(), clang::ObjCInterfaceDecl::getDefinition(), clang::ObjCProtocolDecl::getDefinition(), clang::ASTNodeImporter::IDK_Basic, and Import().
Referenced by clang::ASTNodeImporter::ImportDeclContext(), clang::ASTNodeImporter::VisitAccessSpecDecl(), clang::ASTNodeImporter::VisitCXXDefaultArgExpr(), clang::ASTNodeImporter::VisitCXXDefaultInitExpr(), clang::ASTNodeImporter::VisitSourceLocExpr(), clang::ASTNodeImporter::VisitStaticAssertDecl(), and clang::ASTNodeImporter::VisitUsingDirectiveDecl().
Error ASTImporter::ImportDefinition | ( | Decl * | From | ) |
Import the definition of the given declaration, including all of the declarations it contains.
Definition at line 10162 of file ASTImporter.cpp.
References clang::ASTNodeImporter::IDK_Everything, Import(), clang::ASTNodeImporter::ImportDeclContext(), and clang::ASTNodeImporter::ImportDefinition().
Referenced by clang::ExternalASTMerger::CompleteType().
Subclasses can override this function to observe all of the From
-> To
declaration mappings as they are imported.
Definition at line 553 of file ASTImporter.h.
Referenced by Import().
Can be overwritten by subclasses to implement their own import logic.
The overwritten method should call this method if it didn't import the decl on its own.
Definition at line 9093 of file ASTImporter.cpp.
References clang::TypeVisitor< ImplClass, RetTy >::Visit().
Referenced by Import().
|
inline |
Import the given object, returns the result.
To | Import the object into this variable. |
From | Object to import. |
Definition at line 308 of file ASTImporter.h.
References Import().
Referenced by Import(), and clang::ASTNodeImporter::VisitFieldDecl().
llvm::Error clang::ASTImporter::ImportTemplateArguments | ( | ArrayRef< TemplateArgument > | FromArgs, |
SmallVectorImpl< TemplateArgument > & | ToArgs | ||
) |
|
inline |
Whether the importer will perform a minimal import, creating to-be-completed forward declarations when possible.
Definition at line 298 of file ASTImporter.h.
References clang::Minimal.
Referenced by getStructuralEquivalenceKind(), clang::ASTNodeImporter::ImportDeclContext(), clang::ASTNodeImporter::ImportDefinition(), clang::ASTNodeImporter::shouldForceImportDeclContext(), and clang::ASTNodeImporter::VisitRecordDecl().
Determine whether the given types are structurally equivalent.
Definition at line 10537 of file ASTImporter.cpp.
References getStructuralEquivalenceKind(), clang::QualType::getTypePtr(), clang::ASTContext::hasSameType(), Import(), and clang::StructuralEquivalenceContext::IsEquivalent().
Referenced by IsEquivalentFriend(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTNodeImporter::VisitIndirectFieldDecl(), clang::ASTNodeImporter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCMethodDecl(), clang::ASTNodeImporter::VisitObjCPropertyDecl(), clang::ASTNodeImporter::VisitTypedefNameDecl(), and clang::ASTNodeImporter::VisitVarDecl().
Store and assign the imported declaration to its counterpart.
It may happen that several decls from the 'from' context are mapped to the same decl in the 'to' context.
Definition at line 10502 of file ASTImporter.cpp.
References clang::Decl::getDeclContext().
Referenced by clang::ExternalASTMerger::CompleteType(), RegisterImportedDecl(), clang::ASTNodeImporter::VisitBuiltinTemplateDecl(), clang::ASTNodeImporter::VisitClassTemplateDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTNodeImporter::VisitEnumConstantDecl(), clang::ASTNodeImporter::VisitEnumDecl(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTNodeImporter::VisitFriendDecl(), clang::ASTNodeImporter::VisitFunctionDecl(), clang::ASTNodeImporter::VisitFunctionTemplateDecl(), clang::ASTNodeImporter::VisitIndirectFieldDecl(), clang::ASTNodeImporter::VisitNamespaceDecl(), clang::ASTNodeImporter::VisitObjCCategoryDecl(), clang::ASTNodeImporter::VisitObjCCategoryImplDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTNodeImporter::VisitObjCInterfaceDecl(), clang::ASTNodeImporter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCMethodDecl(), clang::ASTNodeImporter::VisitObjCPropertyDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), clang::ASTNodeImporter::VisitObjCProtocolDecl(), clang::ASTNodeImporter::VisitRecordDecl(), clang::ASTNodeImporter::VisitTranslationUnitDecl(), clang::ASTNodeImporter::VisitTypeAliasTemplateDecl(), clang::ASTNodeImporter::VisitTypedefNameDecl(), clang::ASTNodeImporter::VisitVarDecl(), clang::ASTNodeImporter::VisitVarTemplateDecl(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
Definition at line 9099 of file ASTImporter.cpp.
References MapImported().
|
inlineprotectedvirtual |
Used only in unittests to verify the behaviour of the error handling.
Definition at line 270 of file ASTImporter.h.
Referenced by clang::ASTNodeImporter::VisitGCCAsmStmt().
void ASTImporter::setImportDeclError | ( | Decl * | From, |
ASTImportError | Error | ||
) |
Mark (newly) imported declaration with error.
Definition at line 10529 of file ASTImporter.cpp.
Referenced by Import().
|
inline |
Definition at line 300 of file ASTImporter.h.
References clang::T.
DiagnosticBuilder ASTImporter::ToDiag | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Report a diagnostic in the "to" context.
Definition at line 10466 of file ASTImporter.cpp.
References clang::ASTContext::getDiagnostics(), Loc, clang::DiagnosticsEngine::notePriorDiagnosticFrom(), and clang::DiagnosticsEngine::Report().
Referenced by clang::ASTNodeImporter::ImportDefinition(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTNodeImporter::VisitFunctionDecl(), clang::ASTNodeImporter::VisitIndirectFieldDecl(), clang::ASTNodeImporter::VisitObjCImplementationDecl(), clang::ASTNodeImporter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCMethodDecl(), clang::ASTNodeImporter::VisitObjCPropertyDecl(), clang::ASTNodeImporter::VisitObjCPropertyImplDecl(), and clang::ASTNodeImporter::VisitVarDecl().
|
friend |
Definition at line 63 of file ASTImporter.h.
Referenced by Import(), and ImportContext().