CppAst.NET
CppAst.NET copied to clipboard
suggested fix for span assignment related to forward declarations
Hi,
There is an issue with how CppElement.Span is assigned in the case of headers containing forward declarations. The problem is that (in at least in some situations) the span will point to the forward declaration and not the real definition. The issue I believe lies here:
https://github.com/xoofx/CppAst.NET/blob/0fd2f5e157e6236cab8be6289c15ca6bfa5c8c39/src/CppAst/CppModelBuilder.cs#L437
Where cursor.IsDefinition does not always yield the result we want. I was able to get the correct behavior using this instead:
Good to know, please make a PR if you want, thanks!