[clang] [clang] Warn when builtin names are used outside of invocations (PR #96097)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 29 12:46:31 PDT 2024
Endilll wrote:
> Looks like !__is_identifier(<revertible type trait name>) is used instead of __has_builtin sometimes. With this patch, __is_identifier(<revertible type trait name>) is true because there's no lparen after the name
Thank you, I'll make `__is_identifier` work.
> Apparantly __has_feature(__is_abstract) is also supposed to be true (...), but that seems to be broken on main and not a new issue with this patch.
I can't make it work even on ancient version of Clang on Compiler Explorer, so I wonder if it ever worked.
> Also it doesn't seem ideal to not support things like:
>
> #define IS_CLASS __is_class
> static_assert(!IS_CLASS(void));
>
> Since these are supported by GCC and MSVC. Could you check again for an lparen after a macro expansion?
I think this would require us to abandon the lex approach implemented here. But read on...
> In libc++: https://github.com/llvm/llvm-project/commit/7f302f220e7b8727ed1bf8832dcc2d87b897e527 (Pretty easy fix to replace __has_keyword(__reference_binds_to_temporary) with __has_builtin(__reference_binds_to_temporary) again though)
Goodness, I think this usage makes lex approach non-viable. Even if libc++ fixes that now, it has been deployed in system headers.
https://github.com/llvm/llvm-project/pull/96097
More information about the cfe-commits
mailing list