[all-commits] [llvm/llvm-project] cff192: [clang-include-fixer] Fix incorrect ranking becaus...

Danila Kutenin via All-commits all-commits at lists.llvm.org
Mon Dec 20 07:04:43 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cff192739bb6dd67b2ec58f055af2ae2834c4348
      https://github.com/llvm/llvm-project/commit/cff192739bb6dd67b2ec58f055af2ae2834c4348
  Author: Danila Kutenin <kutdanila at yandex.ru>
  Date:   2021-12-20 (Mon, 20 Dec 2021)

  Changed paths:
    M clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp

  Log Message:
  -----------
  [clang-include-fixer] Fix incorrect ranking because of dangling references

SymbolAndSignals stores SymbolInfo which stores two std::strings. Then
the values are stored in a llvm::DenseMap<llvm::StringRef, double>. When
the sorting is happening, SymbolAndSignals are swapped and thus because
of small string optimization some strings may become invalid. This
results in incorrect ranking.

This was detected when running new std::sort algorithm against llvm
toolchain. This could have been prevented with running llvm::sort and
EXPENSIVE_CHECKS. Unfortunately, no sanitizer yelled.

I don't have commit rights, kutdanila at yandex.ru Danila Kutenin

Reviewed By: bkramer

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




More information about the All-commits mailing list