[PATCH] D81917: [clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.

Andi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 02:43:38 PDT 2020


Abpostelnicu created this revision.
Abpostelnicu added a reviewer: sylvestre.ledru.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.
Abpostelnicu edited reviewers, added: JonasToth; removed: sylvestre.ledru.

Some paths can have special chars like `file++c.cpp` in this case the regex will fail if we don't escape it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81917

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -277,6 +277,7 @@
     tmpdir = tempfile.mkdtemp()
 
   # Build up a big regexy filter from all command line arguments.
+  args.files = [re.escape(f) for f in args.files]
   file_name_re = re.compile('|'.join(args.files))
 
   return_code = 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81917.270998.patch
Type: text/x-patch
Size: 484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200616/cc572378/attachment.bin>


More information about the cfe-commits mailing list