[PATCH] D61739: check_clang_tidy.py now passes `-format-style=none` to clang_tidy
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 10:08:03 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360358: check_clang_tidy.py now passes `-format-style=none` to clang_tidy (authored by gribozavr, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D61739?vs=198845&id=198865#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61739/new/
https://reviews.llvm.org/D61739
Files:
clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
Index: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
+++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
@@ -69,20 +69,32 @@
temp_file_name = temp_file_name + extension
clang_tidy_extra_args = extra_args
- if len(clang_tidy_extra_args) == 0:
- clang_tidy_extra_args = ['--']
+ clang_extra_args = []
+ if '--' in extra_args:
+ i = clang_tidy_extra_args.index('--')
+ clang_extra_args = clang_tidy_extra_args[i + 1:]
+ clang_tidy_extra_args = clang_tidy_extra_args[:i]
+
+ # If the test does not specify a formatting style, force "none"; otherwise
+ # autodetection logic can discover a ".clang-tidy" file that is not related to
+ # the test.
+ if not any(
+ [arg.startswith('-format-style=') for arg in clang_tidy_extra_args]):
+ clang_tidy_extra_args.append('-format-style=none')
+
+ if len(clang_extra_args) == 0:
if extension in ['.cpp', '.hpp', '.mm']:
- clang_tidy_extra_args.append('--std=c++11')
+ clang_extra_args.append('--std=c++11')
if extension in ['.m', '.mm']:
- clang_tidy_extra_args.extend(
+ clang_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.
- clang_tidy_extra_args.append('-nostdinc++')
+ clang_extra_args.append('-nostdinc++')
if resource_dir is not None:
- clang_tidy_extra_args.append('-resource-dir=%s' % resource_dir)
+ clang_extra_args.append('-resource-dir=%s' % resource_dir)
with open(input_file_name, 'r') as input_file:
input_text = input_file.read()
@@ -138,7 +150,7 @@
write_file(original_file_name, cleaned_test)
args = ['clang-tidy', temp_file_name, '-fix', '--checks=-*,' + check_name] + \
- clang_tidy_extra_args
+ clang_tidy_extra_args + ['--'] + clang_extra_args
if expect_clang_tidy_error:
args.insert(0, 'not')
print('Running ' + repr(args) + '...')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61739.198865.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190509/e2f565eb/attachment.bin>
More information about the cfe-commits
mailing list