[clang-tools-extra] 068fa35 - [clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.

Andi-Bogdan Postelnicu via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 02:21:33 PDT 2020


Author: Andi-Bogdan Postelnicu
Date: 2020-06-16T12:21:18+03:00
New Revision: 068fa35746637fde29355a43d17d554a92b32cdf

URL: https://github.com/llvm/llvm-project/commit/068fa35746637fde29355a43d17d554a92b32cdf
DIFF: https://github.com/llvm/llvm-project/commit/068fa35746637fde29355a43d17d554a92b32cdf.diff

LOG: [clang-tidy] For `run-clang-tidy.py` escape the paths that are used for analysis.
Some paths can have special chars like `file++c.cpp` in this case the regex will
fail if we don't escape it.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index 4272ae0957fe..2b5e78b38f01 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -277,6 +277,7 @@ def main():
     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


        


More information about the cfe-commits mailing list