hnakamura5 wrote:

This change certainly fixes the issue, but also seems specific for the reported 
code.
For example it does not work well for the case the line contains something else 
as,
```
#define FN(N) void fn(void *addr) { a + f(addr, 0, N * two); }
```

This results the annotations where `*` is PointerOrReference,
```
{(hash, "#" , Unknown), (identifier, "define" , Unknown), (identifier, "FN" , 
Unknown), (l_paren, "(" , Unknown),
(identifier, "N" , Unknown), (r_paren, ")" , Unknown), (void, "void" , 
Unknown), (identifier, "fn" , FunctionDeclarationName), 
(l_paren, "(" , FunctionDeclarationLParen), (void, "void" , Unknown), (star, 
"*" , PointerOrReference),
(identifier, "addr" , StartOfName), (r_paren, ")" , Unknown), (l_brace, "{" , 
FunctionLBrace)👈, (identifier, "a" , Unknown),
(plus, "+" , BinaryOperator), (identifier, "f" , Unknown), (l_paren, "(" , 
Unknown), (identifier, "addr" , Unknown),
(comma, "," , Unknown), (numeric_constant, "0" , Unknown), (comma, "," , 
Unknown), (identifier, "N" , Unknown),
(star, "*" , PointerOrReference) 👈, (identifier, "two" , StartOfName), 
(r_paren, ")" , Unknown), (semi, ";" , Unknown),
(r_brace, "}" , Unknown), (eof, "" , Unknown)}
```

How about judging whether the FunctionLBrace exists as the opener of the outer 
context?

https://github.com/llvm/llvm-project/pull/99433
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to