Skip to content

Commit ad6bf18

Browse files
committed
Anonymous variables are appropriately labeled.
Signed-off-by: Rahul Krishna <[email protected]>
1 parent fdd7627 commit ad6bf18

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cldk/analysis/c/clang/clang_analyzer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,15 @@ def _extract_parameter(self, param) -> CParameter:
166166
careful token handling since the tokens form a generator that can only
167167
be consumed once.
168168
"""
169-
# First, let's safely get any default value
170169
default_value = None
171170
try:
172-
# Convert the token generator to a list so we can examine it safely
173171
tokens = list(param.get_tokens())
174172
if tokens:
175-
# If we have tokens, the first one might be our default value
176173
default_value = tokens[0].spelling
177174
except Exception as e:
178-
# If anything goes wrong getting tokens, we'll log it and continue
179-
print(f"Warning: Could not extract default value for parameter {param.spelling}: {e}")
175+
logger.error(f"Warning: Could not extract default value for parameter {param.spelling}: {e}")
180176

181-
return CParameter(name=param.spelling or f"arg_{param.type.spelling.replace(' ', '_')}", type=param.type.spelling, default_value=default_value)
177+
return CParameter(name=param.spelling or f"placeholder_arg_{param.type.spelling.replace(' ', '_')}", type=param.type.spelling, default_value=default_value)
182178

183179
def _extract_variable(self, cursor) -> CVariable:
184180
"""Extracts detailed variable information from a cursor."""

0 commit comments

Comments
 (0)