diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:12 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-26 20:33:12 +0000 |
| commit | ef915aab0ac566c55bfb0d7a9f6635bb5d94d4af (patch) | |
| tree | ac935cfa19985d33098fc13e288b5ac830672dba /lib/AST/ASTImporter.cpp | |
| parent | 325377b57338e700317f5e423e5b0f1c08d99a39 (diff) | |
Notes
Diffstat (limited to 'lib/AST/ASTImporter.cpp')
| -rw-r--r-- | lib/AST/ASTImporter.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 493cb6df8b83..6e33b98d2f18 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -319,6 +319,9 @@ namespace clang { bool ImportArrayChecked(const InContainerTy &InContainer, OIter Obegin) { return ImportArrayChecked(InContainer.begin(), InContainer.end(), Obegin); } + + // Importing overrides. + void ImportOverrides(CXXMethodDecl *ToMethod, CXXMethodDecl *FromMethod); }; } @@ -2025,6 +2028,9 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { // Add this function to the lexical context. LexicalDC->addDeclInternal(ToFunction); + if (auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D)) + ImportOverrides(cast<CXXMethodDecl>(ToFunction), FromCXXMethod); + return ToFunction; } @@ -5499,6 +5505,14 @@ Expr *ASTNodeImporter::VisitSubstNonTypeTemplateParmExpr( Replacement); } +void ASTNodeImporter::ImportOverrides(CXXMethodDecl *ToMethod, + CXXMethodDecl *FromMethod) { + for (auto *FromOverriddenMethod : FromMethod->overridden_methods()) + ToMethod->addOverriddenMethod( + cast<CXXMethodDecl>(Importer.Import(const_cast<CXXMethodDecl*>( + FromOverriddenMethod)))); +} + ASTImporter::ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport) |
