[all-commits] [llvm/llvm-project] 9f6b13: [Support] Fix behavior of StringRef::count with ov...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Tue Dec 24 16:31:28 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f6b13e5cce96066d7262d224c971d93c2724795
      https://github.com/llvm/llvm-project/commit/9f6b13e5cce96066d7262d224c971d93c2724795
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2019-12-24 (Tue, 24 Dec 2019)

  Changed paths:
    M llvm/lib/Support/StringRef.cpp
    M llvm/unittests/ADT/StringRefTest.cpp

  Log Message:
  -----------
  [Support] Fix behavior of StringRef::count with overlapping occurrences, add tests

Summary:
Fix the behavior of StringRef::count(StringRef) to not count overlapping occurrences, as is stated in the documentation.
Fixes bug https://bugs.llvm.org/show_bug.cgi?id=44072

I added Krzysztof Parzyszek to review this change because a use of this function in HexagonInstrInfo::getInlineAsmLength might depend on the overlapping-behavior. I don't have enough domain knowledge to tell if this change could break anything there.

All other uses of this method in LLVM (besides the unit tests) only use single-character search strings. In those cases, search occurrences can not overlap anyway.

Patch by Benno (@Bensge)

Reviewed By: jdoerfert

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




More information about the All-commits mailing list