[PATCH] D40218: [Clang] Add __builtin_launder

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 19 14:12:32 PST 2017


EricWF added inline comments.


================
Comment at: include/clang/Basic/Builtins.def:480
 BUILTIN(__builtin_thread_pointer, "v*", "nc")
+BUILTIN(__builtin_launder, "v*v*", "nt")
 
----------------
jroelofs wrote:
> GCC's is type-generic:
> 
> ```
> #include <type_traits>
> 
> bool is_type_generic() {
>   int v;
>   return std::is_same<decltype(__builtin_launder(&v)),
>                       decltype(&v)>::value;
> }
> ```
> 
> However this `BUILTIN` line says that this one is not (yeah, I see it's being fixed up in Sema later in this patch). I think you need to use custom type checking here via `t`.
The `t` is specified. It's in the third argument. 


https://reviews.llvm.org/D40218





More information about the cfe-commits mailing list