Author: Walter Lee Date: 2025-09-04T08:00:42-04:00 New Revision: f1c9950cc8b628e6f0ba7dcd1b1c0b393c54e032
URL: https://github.com/llvm/llvm-project/commit/f1c9950cc8b628e6f0ba7dcd1b1c0b393c54e032 DIFF: https://github.com/llvm/llvm-project/commit/f1c9950cc8b628e6f0ba7dcd1b1c0b393c54e032.diff LOG: [clang-tidy] Fix file extension inconsistency (#156528) This fixes an issue with #150791. In CheckRunner, we treat files with unrecognized extensions as ".cpp", by forcefully assigning `extension = ".cpp"` if it's not already one of `".c", ".hpp", ".m", or ".mm"`. Make the new code which chooses the default `-std` argument be consistent with that, so that using other file extensions doesn't trigger an error message like `error: invalid argument '-std=c99' not allowed with 'C++'` Added: Modified: clang-tools-extra/test/clang-tidy/check_clang_tidy.py Removed: ################################################################################ diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index d80a28044ea0a..3eaba0e9dff3a 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -391,9 +391,7 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]: args, extra_args = parser.parse_known_args() if args.std is None: _, extension = os.path.splitext(args.assume_filename or args.input_file_name) - args.std = [ - "c++11-or-later" if extension in [".cpp", ".hpp", ".mm"] else "c99-or-later" - ] + args.std = ["c99-or-later" if extension in [".c", ".m"] else "c++11-or-later"] return (args, extra_args) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits