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
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;
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
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
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/
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.
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:
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">;
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
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}}
+}
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 *'
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}}
+}
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
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}}
+}
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:
> >
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
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
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:
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(),
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
20 matches
Mail list logo