xazax.hun accepted this revision. xazax.hun added a comment. This revision is now accepted and ready to land.
Thanks, this looks good to me! ================ Comment at: clang/include/clang/AST/ASTImporterSharedState.h:43 + /// Set of the newly created declarations. + llvm::DenseSet<Decl *> NewDecls; + ---------------- martong wrote: > xazax.hun wrote: > > ASTImporter already has something like `ImportedFromDecls`. Is that not > > sufficient to check if a declaration is new? > > > > Is it possible that we may want the "degree" of the imported definition? > > I.e., how many hops did we do to import it (is it imported as a result of > > evaluating an imported call?). > What we need here is a list of those declarations that have been **created** > and linked into the destination TU by the ASTImporter. > > `ImportedFromDecls` is a mapping of declarations from the "source" context to > the "destination" context. It might happen that we do not create a new > declaration during the import, however, the mapping is still updated, so next > time we can just simply get that from there (it's a cache). > > E.g. during the import of `foo` from `b.cpp` to `a.cpp` we are going to > import `X` as well. But during the import of `X` we find the existing > definition and then we just simply update the mapping to that. This happens > all the time when we include the same header to two different translation > units. > ``` > // a.cpp > struct X {}; > // b.cpp > struct X {}; > void foo(X); > ``` > > > Is it possible that we may want the "degree" of the imported definition? > > I.e., how many hops did we do to import it > I am not sure how that would be useful, I mean how and for what could we use > that information? > I am not sure how that would be useful, I mean how and for what could we use > that information? It could be part of the heuristics whether we want something inlined during the analysis, but we might not need this information at all. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123685/new/ https://reviews.llvm.org/D123685 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits