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 origin/main...HEAD patch_checker.py patch_checker2.py 
patch_sema.py patch_sema2.py patch_sema3.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- patch_checker.py    2026-09-06 22:02:32.000000 +0000
+++ patch_checker.py    2026-09-06 22:04:45.070349 +0000
@@ -1,24 +1,27 @@
 import re
 
-with open('clang/lib/Analysis/LifetimeSafety/Checker.cpp', 'r') as f:
+with open("clang/lib/Analysis/LifetimeSafety/Checker.cpp", "r") as f:
     orig = f.read()
 
 # Replace the calls in `check()` function
-orig = orig.replace("""    issuePendingWarnings();
+orig = orig.replace(
+    """    issuePendingWarnings();
     suggestAnnotations();
     reportNoescapeViolations();
     reportLifetimeboundViolations();
     reportMisplacedLifetimebound();
-    reportInapplicableLifetimebound();""", """    issuePendingWarnings();
+    reportInapplicableLifetimebound();""",
+    """    issuePendingWarnings();
     suggestAnnotations();
     if (LSOpts.CheckNoescapeViolations)
       reportNoescapeViolations();
     if (LSOpts.CheckLifetimeboundViolations)
       reportLifetimeboundViolations();
     if (LSOpts.CheckMisplacedLifetimebound)
       reportMisplacedLifetimebound();
     if (LSOpts.CheckInapplicableLifetimebound)
-      reportInapplicableLifetimebound();""")
+      reportInapplicableLifetimebound();""",
+)
 
-with open('clang/lib/Analysis/LifetimeSafety/Checker.cpp', 'w') as f:
+with open("clang/lib/Analysis/LifetimeSafety/Checker.cpp", "w") as f:
     f.write(orig)
--- patch_checker2.py   2026-09-06 22:02:32.000000 +0000
+++ patch_checker2.py   2026-09-06 22:04:45.079715 +0000
@@ -1,43 +1,43 @@
 import re
 
-with open('clang/lib/Analysis/LifetimeSafety/Checker.cpp', 'r') as f:
+with open("clang/lib/Analysis/LifetimeSafety/Checker.cpp", "r") as f:
     orig = f.read()
 
 # Add TimeTraceScope to reportNoescapeViolations
 orig = re.sub(
-    r'(void reportNoescapeViolations\(\) {\n)',
+    r"(void reportNoescapeViolations\(\) {\n)",
     r'\1    llvm::TimeTraceScope TimeTrace("ReportNoescapeViolations");\n',
-    orig
+    orig,
 )
 
 # Add TimeTraceScope to reportLifetimeboundViolations
 orig = re.sub(
-    r'(void reportLifetimeboundViolations\(\) {\n)',
+    r"(void reportLifetimeboundViolations\(\) {\n)",
     r'\1    llvm::TimeTraceScope 
TimeTrace("ReportLifetimeboundViolations");\n',
-    orig
+    orig,
 )
 
 # Add TimeTraceScope to reportMisplacedLifetimebound
 orig = re.sub(
-    r'(void reportMisplacedLifetimebound\(\) {\n)',
+    r"(void reportMisplacedLifetimebound\(\) {\n)",
     r'\1    llvm::TimeTraceScope TimeTrace("ReportMisplacedLifetimebound");\n',
-    orig
+    orig,
 )
 
 # Add TimeTraceScope to reportInapplicableLifetimebound
 orig = re.sub(
-    r'(void reportInapplicableLifetimebound\(\) {\n)',
+    r"(void reportInapplicableLifetimebound\(\) {\n)",
     r'\1    llvm::TimeTraceScope 
TimeTrace("ReportInapplicableLifetimebound");\n',
-    orig
+    orig,
 )
 
 # Might as well do issuePendingWarnings
 orig = re.sub(
-    r'(void issuePendingWarnings\(\) {\n)',
+    r"(void issuePendingWarnings\(\) {\n)",
     r'\1    llvm::TimeTraceScope TimeTrace("IssuePendingWarnings");\n',
-    orig
+    orig,
 )
 
 
-with open('clang/lib/Analysis/LifetimeSafety/Checker.cpp', 'w') as f:
+with open("clang/lib/Analysis/LifetimeSafety/Checker.cpp", "w") as f:
     f.write(orig)
--- patch_sema.py       2026-09-06 22:02:32.000000 +0000
+++ patch_sema.py       2026-09-06 22:04:45.086560 +0000
@@ -1,8 +1,8 @@
 import re
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'r') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "r") as f:
     orig = f.read()
 
 replacement = """
 inline bool ShouldCheckSafety(Sema &S, const Decl *D) {
   DiagnosticsEngine &Diags = S.getDiagnostics();
@@ -104,13 +104,14 @@
   LSOpts.CheckInapplicableLifetimebound = 
ShouldCheckInapplicableLifetimebound(S, D);
   return LSOpts;
 }
 """
 
-start_idx = orig.find('inline bool IsLifetimeSafetyEnabled(Sema &S, const Decl 
*D) {')
-end_idx = orig.find('class LifetimeSafetySemaHelperImpl : public 
LifetimeSafetySemaHelper {')
+start_idx = orig.find("inline bool IsLifetimeSafetyEnabled(Sema &S, const Decl 
*D) {")
+end_idx = orig.find(
+    "class LifetimeSafetySemaHelperImpl : public LifetimeSafetySemaHelper {"
+)
 
 new_content = orig[:start_idx] + replacement + orig[end_idx:]
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'w') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "w") as f:
     f.write(new_content)
-
--- patch_sema2.py      2026-09-06 22:02:32.000000 +0000
+++ patch_sema2.py      2026-09-06 22:04:45.092244 +0000
@@ -1,8 +1,8 @@
 import re
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'r') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "r") as f:
     orig = f.read()
 
 replacement = """inline LifetimeSafetyOpts GetLifetimeSafetyOpts(Sema &S, 
const Decl *D) {
   LifetimeSafetyOpts LSOpts;
   LSOpts.MaxCFGBlocks = S.getLangOpts().LifetimeSafetyMaxCFGBlocks;
@@ -13,9 +13,14 @@
   LSOpts.CheckMisplacedLifetimebound = Debug || 
ShouldCheckMisplacedLifetimebound(S, D);
   LSOpts.CheckInapplicableLifetimebound = Debug || 
ShouldCheckInapplicableLifetimebound(S, D);
   return LSOpts;
 }"""
 
-orig = re.sub(r'inline LifetimeSafetyOpts GetLifetimeSafetyOpts\(Sema &S, 
const Decl \*D\) \{.*return LSOpts;\n}', replacement, orig, flags=re.DOTALL)
+orig = re.sub(
+    r"inline LifetimeSafetyOpts GetLifetimeSafetyOpts\(Sema &S, const Decl 
\*D\) \{.*return LSOpts;\n}",
+    replacement,
+    orig,
+    flags=re.DOTALL,
+)
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'w') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "w") as f:
     f.write(orig)
--- patch_sema3.py      2026-09-06 22:02:32.000000 +0000
+++ patch_sema3.py      2026-09-06 22:04:45.097638 +0000
@@ -1,8 +1,8 @@
 import re
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'r') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "r") as f:
     orig = f.read()
 
 replacement = """inline LifetimeSafetyOpts GetLifetimeSafetyOpts(Sema &S, 
const Decl *D) {
   LifetimeSafetyOpts LSOpts;
   LSOpts.MaxCFGBlocks = S.getLangOpts().LifetimeSafetyMaxCFGBlocks;
@@ -12,9 +12,14 @@
   LSOpts.CheckMisplacedLifetimebound = ShouldCheckMisplacedLifetimebound(S, D);
   LSOpts.CheckInapplicableLifetimebound = 
ShouldCheckInapplicableLifetimebound(S, D);
   return LSOpts;
 }"""
 
-orig = re.sub(r'inline LifetimeSafetyOpts GetLifetimeSafetyOpts\(Sema &S, 
const Decl \*D\) \{.*return LSOpts;\n}', replacement, orig, flags=re.DOTALL)
+orig = re.sub(
+    r"inline LifetimeSafetyOpts GetLifetimeSafetyOpts\(Sema &S, const Decl 
\*D\) \{.*return LSOpts;\n}",
+    replacement,
+    orig,
+    flags=re.DOTALL,
+)
 
-with open('clang/lib/Sema/SemaLifetimeSafety.h', 'w') as f:
+with open("clang/lib/Sema/SemaLifetimeSafety.h", "w") as f:
     f.write(orig)

``````````

</details>


https://github.com/llvm/llvm-project/pull/221610
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to