[clang-tools-extra] [run-clang-tidy.py] Add option to ignore source files from compilation database (PR #82416)

Alexander Scholz via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 21 12:44:28 PST 2024


================
@@ -462,6 +469,19 @@ def main():
         [make_absolute(entry["file"], entry["directory"]) for entry in database]
     )
 
+    # Filter source files from compilation database.
+    if args.source_filter:
+        try:
+            source_filter_re = re.compile(args.source_filter)
+        except:
+            print(
+                "Error: unable to compile regex from arg -source-filter:",
+                file=sys.stderr,
+            )
+            traceback.print_exc()
+            sys.exit(1)
----------------
duddel wrote:

I used `traceback.print_exc()` for the sake of consistency as it is already used in two other `except` blocks in this file.

https://github.com/llvm/llvm-project/pull/82416


More information about the cfe-commits mailing list