================
@@ -374,15 +373,23 @@ def parse_arguments() -> Tuple[argparse.Namespace,
List[str]]:
parser.add_argument(
"-std",
type=csv,
- default=["c++11-or-later"],
+ default=None,
help="Passed to clang. Special -or-later values are expanded.",
)
parser.add_argument(
"--match-partial-fixes",
action="store_true",
help="allow partial line matches for fixes",
)
- return parser.parse_known_args()
+
+ 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"
----------------
nicovank wrote:
I'm only a little worried since C++ headers may also be `.h` (even though
Clang-Tidy is not supposed to be run directly on headers anyway -- I think it
can still happen in some cases). What do you think?
Some C++ projects also use `.cxx`, what happens then? Will this list need to
stay updated for all common possible C++ file extensions?
https://github.com/llvm/llvm-project/pull/150791
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits