[clang-tools-extra] [run-clang-tidy] Accept directory as value for -export-fixes (PR #69453)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 07:17:39 PDT 2023
================
@@ -384,14 +386,26 @@ def main():
clang_tidy_binary = find_binary(args.clang_tidy_binary, "clang-tidy", build_path)
- tmpdir = None
if args.fix:
clang_apply_replacements_binary = find_binary(
args.clang_apply_replacements_binary, "clang-apply-replacements", build_path
)
- if args.fix or (yaml and args.export_fixes):
- tmpdir = tempfile.mkdtemp()
+ combine_fixes = False
+ export_fixes_dir = None
+ delete_fixes_dir = True
+ if args.export_fixes is not None:
+ assert not args.export_fixes.endswith(os.path.sep) or os.path.isdir(args.export_fixes), "The export fixes directory does not exist."
+
+ if not os.path.isdir(args.export_fixes) and yaml:
+ combine_fixes = True
+
+ if os.path.isdir(args.export_fixes):
+ export_fixes_dir = args.export_fixes
+ delete_fixes_dir = False
+
+ if export_fixes_dir is None and (args.fix or combine_fixes):
+ export_fixes_dir = tempfile.mkdtemp()
----------------
PiotrZSL wrote:
set delete_fixes_dir by default to False, and under this if set it to True
https://github.com/llvm/llvm-project/pull/69453
More information about the cfe-commits
mailing list