[all-commits] [llvm/llvm-project] a24a75: [libc][hdrgen] Sort identifiers with leading under...

Roland McGrath via All-commits all-commits at lists.llvm.org
Thu Oct 30 11:49:44 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a24a7548b845eba93d8c03079f8c6fcd923306a6
      https://github.com/llvm/llvm-project/commit/a24a7548b845eba93d8c03079f8c6fcd923306a6
  Author: Roland McGrath <mcgrathr at google.com>
  Date:   2025-10-30 (Thu, 30 Oct 2025)

  Changed paths:
    M libc/include/locale.yaml
    M libc/include/stdio.yaml
    M libc/include/stdlib.yaml
    M libc/include/string.yaml
    M libc/include/time.yaml
    M libc/include/wchar.yaml
    M libc/utils/hdrgen/hdrgen/enumeration.py
    M libc/utils/hdrgen/hdrgen/function.py
    M libc/utils/hdrgen/hdrgen/header.py
    M libc/utils/hdrgen/hdrgen/macro.py
    M libc/utils/hdrgen/hdrgen/main.py
    M libc/utils/hdrgen/hdrgen/object.py
    A libc/utils/hdrgen/hdrgen/symbol.py
    M libc/utils/hdrgen/hdrgen/type.py
    A libc/utils/hdrgen/tests/expected_output/sorting.h
    A libc/utils/hdrgen/tests/input/sorting.yaml
    M libc/utils/hdrgen/tests/test_integration.py

  Log Message:
  -----------
  [libc][hdrgen] Sort identifiers with leading underscores specially (#165745)

This makes the sorting behavior more uniform: functions and
macros are always sorted (separately), not only when merging.

This changes the sort order used for functions and other things
sorted by their symbol names.  Symbols are sorted alphabetically
without regard to leading underscores, and then for identifiers
that differ only in the number of leading underscores, the fewer
underscores the earlier in the sort order.  For the functions
declared in a generated header, adjacent names with and without
underscores will be grouped together without blank lines.

This is implemented by factoring the name field, equality, and
sorting support out of the various entity classes into a new
common superclass (hdrgen.Symbol).

This uncovered YAML's requirement to quote the string "NULL" to
avoid pyyaml parsing it as None (equivalent to Javascript null)
rather than a string.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list