Command clang-tidy --export-fixes=fixes.yml <sources>
generates a file fixes.yml
with stances like
---
Diagnostics:
- DiagnosticName: modernize-loop-convert
DiagnosticMessage:
Message: use range-based for loop instead
FilePath: 'Base/Util/StringUtils.cpp'
FileOffset: 1510
Replacements:
- FilePath: 'Base/Util/StringUtils.cpp'
Offset: 1514
Length: 37
ReplacementText: '(const auto & item : items)'
Level: Warning
BuildDirectory: 'tidy/Base'
which looks entirely reasonable.
How to apply these changes to the sources? man clang-apply-replacements
says
USAGE: clang-apply-replacements [options] <Search Root Directory>
None of the options are pertinent. Some web sources tell us we have just to put the change set into the root directory, which will be searched for any .yml
file.
Doesn’t work for me: clang-apply-replacements .
executes instantaneously, prints no message, and effectuates no changes.