[clang-tools-extra] r245567 - Tweak clang-tidy-diff.py to pass JSON argument correctly to clang-tidy on win32 arg parser.

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 08:04:46 PDT 2015


Author: chapuni
Date: Thu Aug 20 10:04:46 2015
New Revision: 245567

URL: http://llvm.org/viewvc/llvm-project?rev=245567&view=rev
Log:
Tweak clang-tidy-diff.py to pass JSON argument correctly to clang-tidy on win32 arg parser.

  - Single quotation is not recognized.
  - Use """ to pass a double quotation.

It also reverts r211831.

Modified:
    clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
    clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp

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=245567&r1=245566&r2=245567&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 Thu Aug 20 10:04:46 2015
@@ -99,13 +99,19 @@ def main():
     [{"name" : name, "lines" : lines_by_file[name]} for name in lines_by_file],
     separators = (',', ':'))
 
+  quote = "";
+  if sys.platform == 'win32':
+    line_filter_json=re.sub(r'"', r'"""', line_filter_json)
+  else:
+    quote = "'";
+
   # Run clang-tidy on files containing changes.
   command = [args.clang_tidy_binary]
-  command.append('-line-filter=\'' + line_filter_json + '\'')
+  command.append('-line-filter=' + quote + line_filter_json + quote)
   if args.fix:
     command.append('-fix')
   if args.checks != '':
-    command.append('-checks=\'' + args.checks + '\'')
+    command.append('-checks=' + quote + args.checks + quote)
   command.extend(lines_by_file.keys())
   command.extend(clang_tidy_args)
 

Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp?rev=245567&r1=245566&r2=245567&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp Thu Aug 20 10:04:46 2015
@@ -16,6 +16,3 @@ struct B : public A {
 };
 // CHECK-SANITY-NOT: Suppressed
 // CHECK: Suppressed 1 warnings (1 due to line filter).
-
-// FIXME: clang-tidy-diff.py is incompatible to dos path. Excluding win32.
-// REQUIRES: shell




More information about the cfe-commits mailing list