llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.08k stars 11.99k forks source link

Better sorting in scan-build html report #18171

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 17797
Version unspecified
OS Linux
Attachments Use browser's builtin array sort for more stable sort result
Reporter LLVM Bugzilla Contributor
CC @belkadan

Extended Description

The sorting of bug table in the scan-build report is not very "stable". In the sense when sorting by "Bug Type", the file names are not grouped together. The filenames popup randomly for the same type of bug.

What will be better is that when sorting by "File" first and then sorting by "Bug Type", the bugs in the same file should be grouped together.

In the clang/tools/scan-build/sorttable.js, shaker_sort was used, but the sort does not preserve previous sort order.

While on the firefox, with the default array sorting function, the previous sort order will be preserved, i.e. after sorting by "File" then by "Bug Type", filenames are grouped up for the same bug type.

belkadan commented 10 years ago

It looks like shaker_sort is supposed to be stable (http://en.wikipedia.org/wiki/Cocktail_sort), and that the browser-provided sort() is not guaranteed to be stable (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). Patches welcome to fix or replace the sorting algorithm used, but relying on the browser sort is a no-go.

Also, please send patches to cfe-commits instead of posting them on bug reports. Thanks!

llvmbot commented 11 years ago

assigned to @tkremenek