Description
If you look at the keywords we add in AddKeywordsToConsumer
, you'll see we are missing quite a few: _Generic
, _BitInt
, _Static_assert
, _Thread_local
, nullptr
, constexpr
, etc are all missing and this shows up in our typo correction behavior: https://godbolt.org/z/9nsKKc4sq
However, it's not a simple matter of adding the keywords to the consumer. Clang supports implicit function declarations in C versions before C23, so _Genreic(
in an expression context is handled as though the user called an undeclared function rather than an unknown id expression. Similar for _BitInt
and _Static_assert
. Further, the typo filter for declaration contexts uses heuristics to determine whether something is a statement or a declaration, and so it doesn't correctly handle _Thrd_local int i
because the token after the typo _Thrd_local
is int
and not an identifier. This means static _Thrd_local int i
can correct the typo because the leading static
makes it clear that's a declaration and not a statement, but _Thrd_local static int i;
cannot correct the typo.