[PATCH] D131858: [clang] Track the templated entity in type substitution.

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 23:31:04 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: clang/lib/Serialization/ASTWriterDecl.cpp:623-626
+  VisitDeclaratorDecl(D);
+  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
+  Record.push_back(D->getIdentifierNamespace());
+
----------------
ChuanqiXu wrote:
> mizvekov wrote:
> > ChuanqiXu wrote:
> > > I still don't get the reason for the move. What's the benefit? Or why is it necessary?
> > Yeah, now the type can reference the template decl, so without moving this, it can happen during import of the type that we try to read this function template bits without having imported them yet.
> Oh, I guess I met the problem before (D129748 ) and I made a workaround for it (https://reviews.llvm.org/D130331). If I understood right, the patch will solve that problem. I'll check it out later.
> 
> (This kind of code move looks dangerous you know and I'll take a double check)
After looking into the detailed change for the serialization part, I feel it is a not-so-good workaround indeed.. It looks like we need a better method to delay reading the type in the serializer. And I'm looking at it. @mizvekov would you like to rebase the series of patches to the main branch so that I can test it actually.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131858/new/

https://reviews.llvm.org/D131858



More information about the cfe-commits mailing list