[PATCH] D131651: [AST] [Modules] Introduce Decl::getNonTransparentDeclContext to handle exported friends

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 23:18:28 PDT 2022


ChuanqiXu created this revision.
ChuanqiXu added reviewers: aaron.ballman, erichkeane, ilya-biryukov, iains.
ChuanqiXu added a project: clang.
Herald added a project: All.
ChuanqiXu requested review of this revision.
Herald added a subscriber: cfe-commits.

Closing https://github.com/llvm/llvm-project/issues/56826.

The root cause for pr56826 is: when we collect the template args for the friend, we need to judge if the friend lives in file context. However, if the friend lives in ExportDecl lexically, the judgement here is invalid.

The solution is easy. We should judge the non transparent context and the ExportDecl is transparent context. So the solution should be good.

A main concern may be the patch doesn't handle all the places of the same defect. I think it might not be bad since the patch itself should be innocent.

Another alternative may let the `Decl::getContext()` return non transparent context but I feel it changes too drastically.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131651

Files:
  clang/include/clang/AST/DeclBase.h
  clang/lib/AST/DeclBase.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/Modules/pr56826.cppm
  clang/unittests/AST/DeclTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131651.451733.patch
Type: text/x-patch
Size: 4617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220811/29634f6f/attachment-0001.bin>


More information about the cfe-commits mailing list