[clang] [webkit.NoUncountedMemberChecker] Warn a raw pointer member in a template instantiation (PR #240100)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 8 09:35:01 PST 2026


rniwa wrote:

Using `getPointOfInstantiation`, nested ones point inside the enclosing template: `Inner<RC>` → `Inner<T> inner;` in `Middle`, `Base<RC>` → `: Base<T>` in `Derived`, `Inner<UF>` → the local inside `useInner<T>()`.  Specialization decls only link downward or sideways (`getSpecializedTemplate`, `getTemplateInstantiationPattern`, `getInstantiatedFrom`, `MemberSpecializationInfo`). The one upward link is `getDeclContext()`, and it only helps for member classes like `Outer<RC>::In`. So a plain POI approach can't reach `Top<RC>` from `Inner<RC>`.

So reporting at the point of instantiation alone would put these warnings back in template code, which is what the PR is trying to avoid. A specialization can reach its primary template, partial specialization or pattern, but nothing in the AST points from `Inner<RC>` up to the `Middle<RC>` that caused it.

This is problematic because WebKit uses a lot of nested templates like `HashMap` → `HashTable` and `Vector` → `VectorBuffer`.

https://github.com/llvm/llvm-project/pull/240100


More information about the cfe-commits mailing list