================
@@ -67,6 +67,67 @@ def merge_fdata(args):
     return 0
 
 
+def perf(args):
+    parser = argparse.ArgumentParser(
+        prog="perf-helper perf", description="perf wrapper for BOLT profile 
collection"
+    )
+    parser.add_argument(
+        "--lbr", action="store_true", help="Use perf with branch stacks"
+    )
+    parser.add_argument("cmd", nargs="*", help="")
+
+    # Use python's arg parser to handle all leading option arguments, but pass
+    # everything else through to perf
+    first_cmd = next(arg for arg in args if not arg.startswith("--"))
----------------
petrhosek wrote:

You can use `parser.add_argument('cmd', nargs=argparse.REMAINDER)` to let 
`argparse` handle this for you.

https://github.com/llvm/llvm-project/pull/69133
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to