clang currently emits an expression like @("abc") as a message send to stringWithUTF8String. This patch makes changes so that a compile-time constant is emitted instead when the expression inside the parentheses is a string literal. I think it's possible to do the same optimization for constant expressions that evaluate to zero-terminated strings (see the example below), but I'm leaving that for future work.
constexpr const char *foo() { return "abc"; } void test() { NSString *s = @(foo()); }
The original motivation for the patch is to silence the -Wnullable-to-nonnull-conversion warning that clang started emitting after r317727:
The https://oleb.net/2018/@keypath/.
rdar://problem/42684601
IgnoreParens.