Author: ehsan Date: Wed Feb 8 11:50:24 2017 New Revision: 294491 URL: http://llvm.org/viewvc/llvm-project?rev=294491&view=rev Log: [clang-tidy] Add -extra-arg and -extra-arg-before to clang-tidy-diff.py
Summary: These flags allow specifying extra arguments to the tool's command line which don't appear in the compilation database. Reviewers: alexfh, klimek, bkramer Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29699 Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=294491&r1=294490&r2=294491&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original) +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Wed Feb 8 11:50:24 2017 @@ -55,6 +55,14 @@ def main(): help='checks filter, when not specified, use clang-tidy ' 'default', default='') + parser.add_argument('-extra-arg', dest='extra_arg', + action='append', default=[], + help='Additional argument to append to the compiler ' + 'command line.') + parser.add_argument('-extra-arg-before', dest='extra_arg_before', + action='append', default=[], + help='Additional argument to prepend to the compiler ' + 'command line.') clang_tidy_args = [] argv = sys.argv[1:] if '--' in argv: @@ -113,6 +121,10 @@ def main(): if args.checks != '': command.append('-checks=' + quote + args.checks + quote) command.extend(lines_by_file.keys()) + for arg in args.extra_arg: + command.append('-extra-arg=%s' % arg) + for arg in args.extra_arg_before: + command.append('-extra-arg-before=%s' % arg) command.extend(clang_tidy_args) sys.exit(subprocess.call(' '.join(command), shell=True)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits