[clang-tools-extra] [clangd] Avoid crash on pseudo-destructor selection (PR #195939)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 10:11:21 PDT 2026


ArcsinX wrote:

> I'm surprised that the NamedTypeInfo is null. AFAIK there should be a `DecltypeTypeLoc`. I don't think this is the best approach.
> 
> > clangd crashes during textDocument/codeAction on malformed pseudo-destructor expressions like y->~decltype(A())(). ...
> 
> This expression is VALID.

It seems like `getNamedTypeInfo()` return value is checked almost everywhere. For example, if we remove `getNamedTypeInfo()` from SemanticHighlighting.cpp, we'll also get such a crash at this file opening.

Btw, do you known when `getNamedTypeInfo() == nullptr`, but `NameKind == CXXDestructorName`? Maybe we still need the check from this PR, but why `getNamedTypeInfo() == nullptr` for `y->~decltype(A())()` requires additional investigation.

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


More information about the cfe-commits mailing list