[ASTImporter] Import overrides before importing the rest of the chain
authorGabor Marton <martongabesz@gmail.com>
Mon, 29 Oct 2018 10:18:28 +0000 (10:18 +0000)
committerGabor Marton <martongabesz@gmail.com>
Mon, 29 Oct 2018 10:18:28 +0000 (10:18 +0000)
commit7a0841ef2f597d3f7bc36385288aedbd781cb80c
tree585859adb7a1ee5fee3065774271518d7cb8a3a5
parentb55b6587a56cd9f3767c47ea4183c497ccd47a42
[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
clang/lib/AST/ASTImporter.cpp