summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclang-tools-extra/test/clang-tidy/check_clang_tidy.py18
1 files changed, 10 insertions, 8 deletions
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 986b70be5e4..1ade4cdc745 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -26,6 +26,7 @@ Example:
"""
import argparse
+import os
import re
import subprocess
import sys
@@ -53,18 +54,19 @@ def main():
temp_file_name = args.temp_file_name
file_name_with_extension = assume_file_name or input_file_name
-
- extension = '.cpp'
- if (file_name_with_extension.endswith('.c')):
- extension = '.c'
- if (file_name_with_extension.endswith('.hpp')):
- extension = '.hpp'
+ _, extension = os.path.splitext(file_name_with_extension)
+ if extension not in ['.c', '.hpp', '.m', '.mm']:
+ extension = '.cpp'
temp_file_name = temp_file_name + extension
clang_tidy_extra_args = extra_args
if len(clang_tidy_extra_args) == 0:
- clang_tidy_extra_args = ['--', '--std=c++11'] \
- if extension == '.cpp' or extension == '.hpp' else ['--']
+ clang_tidy_extra_args = ['--']
+ if extension in ['.cpp', '.hpp', '.mm']:
+ clang_tidy_extra_args.append('--std=c++11')
+ if extension in ['.m', '.mm']:
+ clang_tidy_extra_args.extend(
+ ['-fobjc-abi-version=2', '-fobjc-arc'])
# Tests should not rely on STL being available, and instead provide mock
# implementations of relevant APIs.
OpenPOWER on IntegriCloud