================ @@ -11615,3 +11615,25 @@ void Sema::checkSpecializationReachability(SourceLocation Loc, Sema::AcceptableKind::Reachable) .check(Spec); } + +/// Returns the top most location responsible for the definition of \p N. +/// If \p N is a a template specialization, this is the location +/// of the top of the instantiation stack. +/// Otherwise, the location of \p N is returned. +SourceLocation Sema::getTopMostPointOfInstantiation(const NamedDecl *N) const { + if (!getLangOpts().CPlusPlus || CodeSynthesisContexts.empty()) + return N->getLocation(); + if (auto *FD = dyn_cast<FunctionDecl>(N)) { ---------------- AaronBallman wrote:
```suggestion if (const auto *FD = dyn_cast<FunctionDecl>(N)) { ``` https://github.com/llvm/llvm-project/pull/70353 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits