CppAst.NET icon indicating copy to clipboard operation
CppAst.NET copied to clipboard

suggested fix for span assignment related to forward declarations

Open jmkinzer opened this issue 1 year ago • 1 comments

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:

image

jmkinzer avatar May 19 '24 04:05 jmkinzer

Good to know, please make a PR if you want, thanks!

xoofx avatar May 20 '24 15:05 xoofx