================
@@ -357,6 +357,7 @@ void Preprocessor::RegisterBuiltinMacros() {
   Ident__has_builtin = RegisterBuiltinMacro("__has_builtin");
   Ident__has_constexpr_builtin =
       RegisterBuiltinMacro("__has_constexpr_builtin");
+  Ident__has_target_builtin = RegisterBuiltinMacro("__has_target_builtin");
----------------
Artem-B wrote:

> My fear is that some C++ library headers start to use this macro 
> `__has_target_builtin` in place of `__has_builtin`, and we cannot modify such 
> headers.

IMO, now that we do document semantics of `__has_target_builtin()`, its misuse 
on the library side will be their problem to fix. The problem with 
`__has_builtin()` was that it was never intended to handle heterogeneous 
compilation, and that's what created the issue when CUDA/HIP made builtins from 
both host and device visible to the compiler, but not all of them codegen-able. 
`__has_target_builtin()` clearly states what to expect. Sure, it's possible to 
misuse it, but having it available unconditionally will make it much less 
cumbersome to use in the headers shared between CUDA and C++, and that's a 
fairly common use case.

I'd prefer to have `__has_target_builtin()` generally available.


https://github.com/llvm/llvm-project/pull/126324
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to