[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL355662: [ObjC] Emit a boxed expression as a compile-time constant if the (authored by ahatanak, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:922 +def warn_objc_boxing_invalid_utf8_string : Warning< + "string is ill-formed as UTF-8 and will become a null NSString* when boxed">, + InGroup;

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added inline comments. This revision is now accepted and ready to land. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:922 +def warn_objc_boxing_invalid_utf8_string : Warning< + "string is ill-formed as UTF-8 and will become a

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:922 +def warn_objc_boxing_invalid_utf8_string : Warning< + "string is ill-formed as UTF-8 and will become a null NSString* when boxed">, + InGroup; rjmccall wrote: > Might

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 189809. ahatanak marked an inline comment as done. ahatanak added a comment. Use the type of `NSStringPointer` in the diagnostic string. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58729/new/

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-07 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/DiagnosticGroups.td:407 def ObjCFlexibleArray : DiagGroup<"objc-flexible-array">; +def ObjCBoxing : DiagGroup<"objc-boxing">; def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">; Sure.

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 189657. ahatanak marked 2 inline comments as done. ahatanak added a comment. Improve diagnostic message. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58729/new/ https://reviews.llvm.org/D58729 Files:

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-06 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: include/clang/Basic/DiagnosticGroups.td:322 def InvalidSourceEncoding : DiagGroup<"invalid-source-encoding">; +def InvalidUTF8String : DiagGroup<"invalid-utf8-string">; def KNRPromotedParameter : DiagGroup<"knr-promoted-parameter">;

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 189630. ahatanak added a comment. Diagnose invalid UTF-8 strings in boxed expressions. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58729/new/ https://reviews.llvm.org/D58729 Files: include/clang/AST/ExprObjC.h

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-05 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: test/SemaObjC/boxing-illegal.m:70 + s = @(L"abc"); // expected-error {{illegal type 'int *' used in a boxed expression}} + s = @("\pabc"); // expected-error {{illegal type 'unsigned char *' used in a boxed expression}} +}

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: test/SemaObjC/boxing-illegal.m:70 + s = @(L"abc"); // expected-error {{illegal type 'int *' used in a boxed expression}} + s = @("\pabc"); // expected-error {{illegal type 'unsigned char *'

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: test/SemaObjC/boxing-illegal.m:70 + s = @(L"abc"); // expected-error {{illegal type 'int *' used in a boxed expression}} + s = @("\pabc"); // expected-error {{illegal type 'unsigned char *' used in a boxed expression}} +}

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-05 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 189436. ahatanak marked 2 inline comments as done. ahatanak added a comment. If the string literal used for the boxed expression isn't a valid UTF-8 string, don't emit a compile-time constant. Repository: rC Clang CHANGES SINCE LAST ACTION

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-03-04 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: test/SemaObjC/boxing-illegal.m:70 + s = @(L"abc"); // expected-error {{illegal type 'int *' used in a boxed expression}} + s = @("\pabc"); // expected-error {{illegal type 'unsigned char *' used in a boxed expression}} +}

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments. Comment at: lib/Sema/SemaExprObjC.cpp:534 +NSStringPointer, NSStringPointer); +return new (Context) ObjCBoxedExpr(SL, BoxedType, nullptr, SR); + } rjmccall wrote: > ahatanak wrote: > > rjmccall wrote: > >

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-28 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 188794. ahatanak marked 4 inline comments as done. ahatanak added a comment. Address review comments. - Preserve sugar when creating an `ObjCBoxedExpr` in `Sema::BuildObjCBoxedExpr`. - Add a test case to test/SemaObjC/boxing-illegal.m that shows clang

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-27 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/Sema/SemaExprObjC.cpp:534 +NSStringPointer, NSStringPointer); +return new (Context) ObjCBoxedExpr(SL, BoxedType, nullptr, SR); + } ahatanak wrote: > rjmccall wrote: > > You're implicitly

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak marked an inline comment as done. ahatanak added inline comments. Comment at: lib/Sema/SemaExprObjC.cpp:534 +NSStringPointer, NSStringPointer); +return new (Context) ObjCBoxedExpr(SL, BoxedType, nullptr, SR); + } rjmccall wrote:

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-27 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments. Comment at: lib/CodeGen/CGExprConstant.cpp:1793 + "this boxed expression can't be emitted as a compile-time constant"); + return emitConstantObjCStringLiteral(cast(E->getSubExpr()), + E->getType(),

[PATCH] D58729: Emit boxed expression as a compile-time constant if the expression inside the parentheses is a string literal

2019-02-27 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rjmccall, arphaman. ahatanak added a project: clang. Herald added subscribers: jdoerfert, dexonsmith, jkorous. clang currently emits an expression like `@("abc")` as a message send to `stringWithUTF8String`. This patch makes changes so