xoofx / xoofx/CppAst.NET

Attributes on line preceding the function are not parsed

Open
#53 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug PR Welcome
Dominant language
C#
Stars
620
Forks
79
Avg merge
14h 27m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the two attribute-placement examples from the report, then trace how CppAst.NET obtains attributes from libclang for function declarations. Determine whether the loss occurs in libclang or CppAst.NET; done means the preceding-line form is identified as reliably as the same-line form, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.