[PATCH] D77519: Fix __is_pointer builtin type trait to work with Objective-C pointer types.

Zoe Carver via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 08:38:51 PDT 2020


zoecarver marked an inline comment as done.
zoecarver added a comment.

@ldionne of course!



================
Comment at: libcxx/include/type_traits:901
+// In clang 10.0.0 and earlier __is_pointer didn't work with Objective-C types.
+#if __has_keyword(__is_pointer) && _LIBCPP_CLANG_VER > 1000
+
----------------
ldionne wrote:
> Doesn't `__has_keyword` return a number that can be compared against? `#if __has_keyword(__is_pointer) > some-number` would be better if feasible, because it would handle Clang, AppleClang and any other potential derivative.
I don't think `__has_keyword` returns a comparable number. Libc++ defines `__has_keyword ` using `__is_identifier` [1] and, it seems like all the feature checking macros from clang (including `__is_identifier`) have bool return types [2]. I can add an AppleClang check too if you want. 

[1]:
```
#define __has_keyword(__x) !(__is_identifier(__x))
```

[2]: https://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77519/new/

https://reviews.llvm.org/D77519





More information about the cfe-commits mailing list