[all-commits] [llvm/llvm-project] 8c0935: [libclang] Fix conversion from `StringRef` to `CXS...

Egor Zhdan via All-commits all-commits at lists.llvm.org
Wed Aug 31 09:40:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c0935238527622ba0a7e78e8a1ee2d36026961c
      https://github.com/llvm/llvm-project/commit/8c0935238527622ba0a7e78e8a1ee2d36026961c
  Author: Egor Zhdan <e_zhdan at apple.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M clang/test/Index/comment-lots-of-unknown-commands.c
    M clang/test/Index/comment-to-html-xml-conversion.cpp
    M clang/tools/libclang/CXString.cpp

  Log Message:
  -----------
  [libclang] Fix conversion from `StringRef` to `CXString`

`CXString createRef(StringRef String)` used to return an invalid string when invoked with some empty strings:

If a `StringRef` holds a non-nullptr pointer, for instance, pointing into contents of a larger string, and has a zero length, `createRef` previously returned the entire larger string, ignoring the fact that the actual string passed to it as a param is empty.

This was discovered when invoking `c-index-test` to dump the contents of documentation comments, in case the comment contains an empty HTML attribute, such as `src=""`.

Differential Revision: https://reviews.llvm.org/D133009




More information about the All-commits mailing list