Hi, this is a fairly simple query I think? Bourne of some client code in the “Clang importer” part of the Swift compiler. That importer reads the above function to decide how to interpret macros.
I noticed that it was not treating _Bool as a simple type, but from C99 onward, it is, right?
tok::kw_bool returns true.
To patch my code, I added
tok::kw__Bool locally in my source code copy into the same part of the case statement so that it returns true.
Is that right?? Am I missing some subtleties? Should I submit a suggested patch?
I think this is a known deficiency; at least, we’ve got a FIXME comment about it in the source code:
We can call
getLangOpts() to get a more accurate answer (we do that for some of the other tokens already).
That makes perfect sense.
bool is … only native to C++ too? I might be wrong on that and I definitely wouldn’t want to get into an argument on it.
I’ll submit a PR then. Or at least attempt one. It looks like it’s all on GitHub now, instead of Phabricator, which makes it easier for me to understand!
bool as a keyword exists in all versions of C++ and in C23 and later.
_Bool exists as a keyword in all C language modes (standard feature of C99 and an extension in C89, not exposed in C++).
Thank you for the PR! I’ll think about the testing question as I review the patch; hopefully we can devise a way to test these changes specifically.