Skip to content
Commit b389a625 authored by Mike Crowe's avatar Mike Crowe Committed by Piotr Zegar
Browse files

[clang-tidy] Make MatchesAnyListedNameMatcher cope with unnamed Decl

If MatchesAnyListedNameMatcher::NameMatcher::match() is called in
MatchMode::MatchUnqualified mode with a NamedDecl that has no name then
calling NamedDecl::getName() will assert with:
 `Name.isIdentifier() && "Name is not a simple identifier"'

It seems unfair to force all matchers using
matchers::matchesAnyListedName to defend against this, particularly
since test cases are unlikely to provoke the problem. Let's just check
whether the identifier has a name before attempting to use it instead.

Add test case that reproduces the problem to the
use-std-print-custom.cpp lit check.

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D154884
parent 2ce765eb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment