forked from OSchip/llvm-project
[ASTImporter] Import overrides before importing the rest of the chain
Summary: During method import we check for structural eq of two methods. In the structural eq check we check for their isVirtual() flag. That flag, however, may depend on the number of overrides. Before this change we imported the overrides *after* we had imported the rest of the redecl chain. So, during the import of another decl from the chain IsVirtual() gave false result. Writing tests for this is not really possible, because there is no way to remove an overridden method via the AST API. (We should access the private ASTContext::OverriddenMethods container.) Also, we should do the remove in the middle of the import process. Reviewers: a_sidorin, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53704 llvm-svn: 345496
This commit is contained in:
parent
b55b6587a5
commit
7a0841ef2f
|
@ -3258,6 +3258,9 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
DC->makeDeclVisibleInContext(ToFunction);
|
||||
}
|
||||
|
||||
if (auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
|
||||
ImportOverrides(cast<CXXMethodDecl>(ToFunction), FromCXXMethod);
|
||||
|
||||
// Import the rest of the chain. I.e. import all subsequent declarations.
|
||||
for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
|
||||
ExpectedDecl ToRedeclOrErr = import(*RedeclIt);
|
||||
|
@ -3265,9 +3268,6 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
return ToRedeclOrErr.takeError();
|
||||
}
|
||||
|
||||
if (auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
|
||||
ImportOverrides(cast<CXXMethodDecl>(ToFunction), FromCXXMethod);
|
||||
|
||||
return ToFunction;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue