[clang] [llvm] Introduce Intra-procedural lifetime analysis in Clang (PR #142313)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 06:09:45 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r HEAD~1...HEAD clang/test/Sema/lifetime-safety-testcase-gen.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- lifetime-safety-testcase-gen.py 2025-06-02 13:01:57.000000 +0000
+++ lifetime-safety-testcase-gen.py 2025-06-02 13:09:12.981509 +0000
@@ -1,7 +1,8 @@
import sys
import argparse
+
def generate_cpp_test_data(n: int) -> str:
"""
Generates a C++ code snippet with a specified number of pointers in a cycle.
@@ -43,32 +44,36 @@
cpp_code += "}\n"
return cpp_code
+
if __name__ == "__main__":
# Set up the argument parser
parser = argparse.ArgumentParser(
description="Generate C++ test data with a variable number of pointers in a cycle."
)
-
+
# Add the '-n' argument
parser.add_argument(
- "-n", "--number",
+ "-n",
+ "--number",
type=int,
required=True,
- help="The number of pointers to generate in the cycle."
+ help="The number of pointers to generate in the cycle.",
)
# Parse the arguments from the command line
args = parser.parse_args()
-
+
number_of_pointers = args.number
# Validate the input
if number_of_pointers <= 0:
- print("Error: The number of pointers must be a positive integer.", file=sys.stderr)
- sys.exit(1)
+ print(
+ "Error: The number of pointers must be a positive integer.", file=sys.stderr
+ )
+ sys.exit(1)
# Generate and print the code
generated_code = generate_cpp_test_data(number_of_pointers)
print(generated_code)
``````````
</details>
https://github.com/llvm/llvm-project/pull/142313
More information about the llvm-commits
mailing list