[PATCH] D47532: [ASTImporter] Import the whole redecl chain of functions

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 30 06:13:59 PDT 2018


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

With this patch when any `FunctionDecl` of a redeclaration chain is imported
then we bring in the whole declaration chain.  This involves functions and
function template specializations.  Also friend functions are affected.  The
chain is imported as it is in the "from" tu, the order of the redeclarations
are kept.  I also changed the lookup logic in order to find friends, but first
making them visible in their declaration context.  We may have long
redeclaration chains if all TU contains the same prototype, but our
measurements shows no degradation in time of CTU analysis (Tmux, Xerces,
Bitcoin, Protobuf).  Also, as further work we could squash redundant
prototypes, but first ensure that functionality is working properly; then
should we optimize.

This may seem like a huge patch, sorry about that. But, most of the changes are
new tests, changes in the production code is not that much.  I also tried to
create a smaller patch which does not affect specializations, but that patch
failed to pass some of the `clang-import-test`s because there we import
function specializations. Also very importantly, we can't just change the
import of `FunctionDecl`s without changing the import of function template
specializations because they are handled as `FunctionDecl`s.


Repository:
  rC Clang

https://reviews.llvm.org/D47532

Files:
  include/clang/AST/ASTImporter.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclBase.cpp
  test/ASTMerge/class/test.cpp
  unittests/AST/ASTImporterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47532.149104.patch
Type: text/x-patch
Size: 41020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180530/4b649c38/attachment-0001.bin>


More information about the cfe-commits mailing list