The filename affects the sorting result. Therefore check(),
which normalizes the filename, detects an invalid sorting
of includes, but fix() fails to fix the corresponding includes.
Change-Id: I7d5a941c9ebea853004922d19e3b84f8ded2afa6
Signed-off-by: Georg Kotheimer <georg.kotheimer@mailbox.tu-dresden.de>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/10742
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
@safefix
def fix(self, filename, regions=all_regions):
f = self.open(filename, 'r+')
+ norm_fname = self.normalize_filename(filename)
old = f.readlines()
lines = [ l.rstrip('\n') for l in old ]
language = lang_type(filename, lines[0])
- sort_lines = list(self.sort_includes(lines, filename, language))
+ sort_lines = list(self.sort_includes(lines, norm_fname, language))
new = ''.join(line + '\n' for line in sort_lines)
f.seek(0)