[llvm] 30ce1aa - [utils] Fix utils/demangle_tree.py:parse_line to correctly check for closing parenthesis (#142153)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 02:31:13 PDT 2025
Author: SivanShani-Arm
Date: 2025-06-02T10:31:09+01:00
New Revision: 30ce1aaa18cef762dae7a31411469421c84b384b
URL: https://github.com/llvm/llvm-project/commit/30ce1aaa18cef762dae7a31411469421c84b384b
DIFF: https://github.com/llvm/llvm-project/commit/30ce1aaa18cef762dae7a31411469421c84b384b.diff
LOG: [utils] Fix utils/demangle_tree.py:parse_line to correctly check for closing parenthesis (#142153)
Previously, parse_line incorrectly repeated the check for open_paren
instead of verifying the presence of a closing parenthesis. This caused
inputs with an unmatched opening parenthesis to be parsed incorrectly.
For example:
print(parse_line('?foo (bar'))
→ before: ('?foo', 'ba') [incorrect]
→ after: (None, None) [correct]
Fixed the condition to properly check close_paren.
Added:
Modified:
llvm/utils/demangle_tree.py
Removed:
################################################################################
diff --git a/llvm/utils/demangle_tree.py b/llvm/utils/demangle_tree.py
index 9d9603e63b832..6fbb8c6a36ca3 100644
--- a/llvm/utils/demangle_tree.py
+++ b/llvm/utils/demangle_tree.py
@@ -28,7 +28,7 @@ def parse_line(line):
if open_paren == -1:
return None, None
close_paren = line.rfind(")", open_paren)
- if open_paren == -1:
+ if close_paren == -1:
return None, None
mangled = line[question:open_paren]
demangled = line[open_paren + 1 : close_paren]
More information about the llvm-commits
mailing list