[clang] [clang] Fix sorting header paths (PR #73323)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 17:33:10 PST 2023


dwblaikie wrote:

> > So what breakage is caused by the sorting failure?
> 
> @dwblaikie This is not causing a breakage. It is just not working as designed because the sort function has been comparing `""` against `""` since commit [e6830b6](https://github.com/llvm/llvm-project/commit/e6830b6028ec5434ccf8dbebdd992918f67b1751) .
> 
> I found this while investigating issue #73145.
> 
> The way the code is behaving now, the sort function is acting as a NOP and could be removed. However, I don't think that was the intention of the author of [7ff2914](https://github.com/llvm/llvm-project/commit/7ff29148ac7883881e62dc9e1714057c68ad4436).
> 
> > Can that behavior be tested in some way to validate this change and ensure it doesn't regress in the future?
> 
> Possibly. Let me think on this.

Yeah, looks like this was undertested when originally committed. Perhaps @benlangmuir can help sort out a test for this?

Possibly creating a directory with a few headers & they'll appear in some arbitrary order from the OS in the `recursive_directory_iterator` - and then is there a way to print out the header map? We could print that out and demonstrate it is in the sorted order, not whatever order the iterator provided maybe.



https://github.com/llvm/llvm-project/pull/73323


More information about the cfe-commits mailing list