[all-commits] [llvm/llvm-project] e80b81: [Support] Fix formatted_raw_ostream for UTF-8

ostannard via All-commits all-commits at lists.llvm.org
Mon Jul 6 08:29:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e80b81d1cbf85dcd427759369978afdb48f0998f
      https://github.com/llvm/llvm-project/commit/e80b81d1cbf85dcd427759369978afdb48f0998f
  Author: Oliver Stannard <oliver.stannard at linaro.org>
  Date:   2020-07-06 (Mon, 06 Jul 2020)

  Changed paths:
    M clang/test/Analysis/checker-plugins.c
    M llvm/include/llvm/Support/FormattedStream.h
    M llvm/lib/Support/FormattedStream.cpp
    M llvm/test/MC/ARM/lsl-zero.s
    M llvm/unittests/Support/formatted_raw_ostream_test.cpp

  Log Message:
  -----------
  [Support] Fix formatted_raw_ostream for UTF-8

* The getLine and getColumn functions need to update the position, or
  they will return stale data for buffered streams. This fixes a bug in
  the clang -analyzer-checker-option-help option, which was not wrapping
  the help text correctly when stdout is not a TTY.
* If the stream contains multi-byte UTF-8 sequences, then the whole
  sequence needs to be considered to be a single character. This has the
  edge case that the buffer might fill up and be flushed part way
  through a character.
* If the stream contains East Asian wide characters, these will be
  rendered twice as wide as other characters, so we need to increase the
  column count to match.

This doesn't attempt to handle everything unicode can do (combining
characters, right-to-left markers, ...), but hopefully covers most
things likely to be common in messages and source code we might want to
print.

Differential revision: https://reviews.llvm.org/D76291




More information about the All-commits mailing list