You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with custom attributes for a serializer, and for readability purposes I'd like to have attributes on the line before the function the attribute is for, eg:
[[test::attr]]
void myFunc();
Unfortunately, CppAst cannot correctly identify the attribute in that case.
However, if I put the attribute on the same line:
[[test::attr]] void myFunc();
it works fine. As far as I know, the standard does allow the attributes to be before as per the former example. I'm not sure if this is an issue with CppAst or with libclang itself, but it would be great if attributes could be on the line before the function.
The text was updated successfully, but these errors were encountered:
javster101
changed the title
Function attributes not on the same line are not parsed
Attributes on line preceding the function are not parsed
Nov 30, 2021
Definitely possible, as attributes have to be parsed manually, so there might be some bugs.
Yes, it seems custom attribute is act as a ignore cursor here, but in now version of ClangSharp, it has no feature to query custom attribute here. I'm try to do it by manual use SourceLocation and offset. The on the line feature is important for not let code easy to read. Our project is try to use annoute with custom string to do this, but it will need many macros, and it is not controllable. It used looks like struct RCLASS(Ignore=true, DisplayName="abc") MyClass, where RCLASS is a macro at last will replace to a annotate attribute here.
I'm working with custom attributes for a serializer, and for readability purposes I'd like to have attributes on the line before the function the attribute is for, eg:
Unfortunately, CppAst cannot correctly identify the attribute in that case.
However, if I put the attribute on the same line:
it works fine. As far as I know, the standard does allow the attributes to be before as per the former example. I'm not sure if this is an issue with CppAst or with libclang itself, but it would be great if attributes could be on the line before the function.
The text was updated successfully, but these errors were encountered: