[clang] [Clang] Warn on deprecated specializations used in system headers. (PR #70353)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 17 07:38:25 PST 2023


================
@@ -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


More information about the cfe-commits mailing list