[PATCH] D142704: [C++20][Modules] Handle template declarations in header units.
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 30 22:32:52 PST 2023
ChuanqiXu added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:15265
FD->getFormalLinkage() == Linkage::ExternalLinkage &&
- !FD->isInvalidDecl() && BodyKind != FnBodyKind::Delete &&
+ !FD->isInvalidDecl() && !IsFnTemplate && BodyKind != FnBodyKind::Delete &&
BodyKind != FnBodyKind::Default && !FD->isInlined()) {
----------------
iains wrote:
> rsmith wrote:
> > Would it make sense to use `!isa<FunctionTemplateDecl>(D)` here instead of adding `IsFnTemplate`?
> > Would it make sense to use `!isa<FunctionTemplateDecl>(D)` here instead of adding `IsFnTemplate`?
>
> I have changed this to use FD->isTemplated() to match the changes for VarDecls - where the template decl is not available. Would it be better to use the isa<>() ?
>
It looks not bad to me to use `isTemplated ()`. And it looks like `!FD->isTemplateInstantiation()` is not tested? And it looks a little bit odd since the instantiated template should be implicitly inline.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142704/new/
https://reviews.llvm.org/D142704
More information about the cfe-commits
mailing list