[clang] [clang-tools-extra] [RecursiveASTVisitor] Skip implicit instantiations. (PR #110899)
Harald van Dijk via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 23 15:39:52 PST 2024
hvdijk wrote:
ping @sdkrystian
FWIW, `getTemplateArgsAsWritten()` is implemented as
```c++
/// Retrieve the template argument list as written in the sources,
/// if any.
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
return Info->TemplateArgsAsWritten;
return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);
}
```
and `ExplicitInfo` is defined as
```
/// Further info for explicit template specialization/instantiation.
/// Does not apply to implicit specializations.
SpecializationOrInstantiationInfo ExplicitInfo = nullptr;
```
which does not say that this is guaranteed to be `nullptr` for implicit specializations, and suggests to me that for implicit instantiations, ignoring it like I do in this PR is the right thing to do. However, maybe instead it would be better so that implicit specializations never have any `ExplicitInfo`?
https://github.com/llvm/llvm-project/pull/110899
More information about the cfe-commits
mailing list