Skip to content

Commit

Permalink
Add missing const_cast in UTF16Stream.
Browse files Browse the repository at this point in the history
Summary:
The LLVM `ConvertUTF8ToUTF16` function takes a `llvm::UTF16 *` without
a `const` qualifier as the "end" argument. It is never written to.

Silence a warning in the build by adding an explicit `const_cast` to
show what's already happening implicitly.

Reviewed By: tmikov

Differential Revision: D19825240

fbshipit-source-id: 3ec4f2188c67e33977405a586cfff4698beb55b4
  • Loading branch information
avp authored and facebook-github-bot committed Feb 13, 2020
1 parent 58d1b3c commit ad7c419
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Support/UTF16Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool UTF16Stream::refill() {
&utf8Begin_,
utf8End_,
(llvm::UTF16 **)&out,
(llvm::UTF16 *)end_,
(llvm::UTF16 *)const_cast<char16_t *>(end_),
llvm::lenientConversion);

if (cRes != llvm::ConversionResult::targetExhausted) {
Expand Down

0 comments on commit ad7c419

Please sign in to comment.