5ade17e broke __is_pointer for Objective-C pointer types. This patch fixes the builtin and re-applies the change to type_traits.
Details
- Reviewers
ldionne rsmith EricWF - Group Reviewers
Restricted Project - Commits
- rGb25ec45809fb: Fix __is_pointer builtin type trait to work with Objective-C pointer types.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for looking into this!
clang/test/SemaObjC/type-traits-is-pointer.mm | ||
---|---|---|
10 ↗ | (On Diff #255214) | You can just use static_assert directly here. |
libcxx/include/type_traits | ||
901 | 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. |
@ldionne of course!
libcxx/include/type_traits | ||
---|---|---|
901 | 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 |
Fix based on review:
- Use static_assert directly in the test
- Update run command to work on non-objc platforms (e.g. linux)
libcxx/include/type_traits | ||
---|---|---|
901 | Ah, you're right. There's no version of AppleClang to put here right now, so I'd say status quo is OK. I can add one later. |
clang/test/SemaObjCXX/type-traits-is-pointer.mm | ||
---|---|---|
2 | Why do you run this through -verify? Can't you just drop that and the // expected-no-diagnostics bit too? |
clang/test/SemaObjCXX/type-traits-is-pointer.mm | ||
---|---|---|
2 | Actually, never mind this. Someone pointed to me offline that using clang-verify has the benefit that no other diagnostics are going to be emitted, which is true. This is fine by me. |
libcxx/include/type_traits | ||
---|---|---|
901 | Sure! Thanks! |
Why do you run this through -verify? Can't you just drop that and the // expected-no-diagnostics bit too?