diff options
Diffstat (limited to 'compilerplugins/clang/virtualdead.py')
-rwxr-xr-x | compilerplugins/clang/virtualdead.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compilerplugins/clang/virtualdead.py b/compilerplugins/clang/virtualdead.py index 2966662ff8fc..e481127af75b 100755 --- a/compilerplugins/clang/virtualdead.py +++ b/compilerplugins/clang/virtualdead.py @@ -107,8 +107,12 @@ for name, bitfield in tmp2dict.iteritems(): def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, s)] -tmp1list.sort(key=lambda v: natural_sort_key(v[0])) -tmp2list.sort(key=lambda v: natural_sort_key(v[0])) +# sort by both the source-line and the datatype, so the output file ordering is stable +# when we have multiple items on the same source line +def v_sort_key(v): + return natural_sort_key(v[0]) + [v[1]] +tmp1list.sort(key=lambda v: v_sort_key(v)) +tmp2list.sort(key=lambda v: v_sort_key(v)) # print out the results with open("compilerplugins/clang/virtualdead.results", "wt") as f: |