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 +def isAutoFixable(diag): + if diag["DiagnosticMessage"]["Replacements"]: return True + + if "Notes" in diag: + for note in diag["Notes"]: + if "Replacements" in note and note["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