[llvm] [llvm][utils] Improve the StringRef summary provider (PR #162298)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 10:06:38 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 origin/main...HEAD llvm/utils/lldbDataFormatters.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
--- lldbDataFormatters.py 2025-10-23 17:04:29.000000 +0000
+++ lldbDataFormatters.py 2025-10-23 17:06:02.540643 +0000
@@ -197,13 +197,11 @@
return '""'
data = data_pointer.deref
# StringRef may be uninitialized with length exceeding available memory,
# potentially causing bad_alloc exceptions. Limit the length to max string summary setting.
- limit_obj = (
- valobj.target.debugger.GetSetting("target.max-string-summary-length")
- )
+ limit_obj = valobj.target.debugger.GetSetting("target.max-string-summary-length")
if limit_obj:
length = min(length, limit_obj.GetUnsignedIntegerValue())
# Get a char[N] type, from the underlying char type.
array_type = data.type.GetArrayType(length)
# Cast the char* string data to a char[N] array.
``````````
</details>
https://github.com/llvm/llvm-project/pull/162298
More information about the llvm-commits
mailing list