[PATCH] D103792: [clang][AST] Set correct DeclContext in ASTImporter lookup table for template params.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 14 09:04:03 PDT 2021
balazske added inline comments.
================
Comment at: clang/lib/AST/ASTImporter.cpp:5961-5962
if (Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
return std::move(Err);
----------------
martong wrote:
> Do you think that the alternative approach that is used with `TypedefNameDecl` could work here?
> ```
> // Do not import the DeclContext, we will import it once the TypedefNameDecl
> // is created.
> if (Error Err = ImportDeclParts(D, Name, ToD, Loc))
> return std::move(Err);
> ```
> With that perhaps we could avoid the hassle with the `update`. Could you please investigate that?
The problem is not with the DC of the `FunctionTemplateDecl`, it is with the template parameters. It looks not safe to pass nullptr as `DeclContext` for these, this is only possible if the import is done. (Probably the solution in `TypedefNameDecl` is not perfect: If something exists already in the "To TU" that was not imported, specially a namespace that contains a typedef with same name, it may not be found before the import.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103792/new/
https://reviews.llvm.org/D103792
More information about the cfe-commits
mailing list