[PATCH] D46835: [ASTImporter] Do not try to remove invisible Decls from DeclContext

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 14 09:40:28 PDT 2018


martong created this revision.
martong added reviewers: xazax.hun, a.sidorin.
Herald added subscribers: cfe-commits, dkrupp, rnkovacs.

`DeclContext` is essentially a list of `Decl`s and a lookup table (`LookupPtr`) but these are encapsulated.
E.g. `LookupPtr` is private. `DeclContext::removeDecl` has the responsibility to remove the given decl from the list and from the table too.
Template specializations cannot participate in normal (qualified) lookup.
Consequently no template specialization can be in the lookup table, but they will be in the list. When the lookup table is built or when a new `Decl` is added, then it is checked whether it is a template specialization and if so it is skipped from the lookup table.
Thus, whenever we want to remove a `Decl` from a `DeclContext` we must not reach the point to remove that from the lookup table (and that is what this patch do).

With respect to ASTImporter: At some point probably we will be reordering `FriendDecl`s and possibly `CXXMethodDecl`s in a `RecordDecl` at `importDeclContext` to be able to structurally compare two `RecordDecl`s.
When that happens we most probably want to remove all `Decls` from a `RecordDecl` and then we would add them in the proper order.


Repository:
  rC Clang

https://reviews.llvm.org/D46835

Files:
  lib/AST/DeclBase.cpp
  unittests/AST/ASTImporterTest.cpp
  unittests/AST/MatchVerifier.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46835.146633.patch
Type: text/x-patch
Size: 4230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180514/e38f4921/attachment-0001.bin>


More information about the cfe-commits mailing list