Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py =================================================================== --- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -105,6 +105,16 @@ start.append(f) return start +# returns whether passed yaml Diagnostic (see mergekey) element contains FIX-IT +# FIX-IT replacements can be within the warning directly or within the notes. +def isAutoFixable(diag): + if diag["DiagnosticMessage"]["Replacements"]: return True + + for note in diag.get("Notes", []): + if note.get("Replacements", []): + return True + + return False def merge_replacement_files(tmpdir, mergefile): """Merge all replacement files in a directory into a single file""" @@ -116,7 +126,9 @@ content = yaml.safe_load(open(replacefile, 'r')) if not content: continue # Skip empty files. - merged.extend(content.get(mergekey, [])) + for d in content.get(mergekey, []): + if isAutoFixable(d): + merged.append(d) if merged: # MainSourceFile: The key is required by the definition inside