Skip to content

Fix/parser improvements #1919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 4, 2025
Merged

Conversation

duckdoom5
Copy link
Contributor

  • Reserve some memory to speedup the process
  • Link opts->verbose and opts->skipFunctionBodies to clang
  • Assign some properties that were not assigned

@tritao
Copy link
Collaborator

tritao commented Mar 3, 2025

Was ready to hit the merge button, except it doesn't pass CI 😄

@duckdoom5
Copy link
Contributor Author

duckdoom5 commented Mar 3, 2025

I'll check it out. See if I can figure out what makes it crash.
I think it's just crashing in some project I didn't test. My guess is this line needs to be added

@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from 1318d41 to aadbac9 Compare March 3, 2025 16:00
@duckdoom5
Copy link
Contributor Author

duckdoom5 commented Mar 3, 2025

Okay, so I fixed the two errors that popped up in test builds.
The first one seems to be caused by symbols now being generated for template args.
That was a simple fix.

Can't return T(); if T is a const reference type.

However the second error I'm thoroughly confused by. But I have one theory..
The issue was that the symbols code generator (see ImplementIfAbstract) would implement the function virtual ~PureImplementedDtor() = 0; (marked pure virtual)
as PureImplementedDtor::~PureImplementedDtor() {}

Which was already defined in code leading to an error.
I would argue implementing a function marked pure virtual anyway, is a bug, but let me know if you think it should be solved by looping through the available methods.

So my theory is this:
I noticed that when passing opts->skipFunctionBodies to ParseAST some elements in the AST got ordered differently. I'm guessing that previously, the destructor was parsed before the default constructor?

Edit: There seems to be a third error when building a test. Now somehow the FunctionTemplate function is missing 😅
Edit 2: Ah this must be why. It's missing explicit instantiations then.
image

@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from 3b3c04d to a11a28d Compare March 3, 2025 17:58
Can't return `T();` if `T` is a const reference type.
It's kinda weird to call it pure virtual and then implement it anyway no?
Don't skip function bodies to force template instantiations
@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from a11a28d to e981c4b Compare March 3, 2025 18:01
duckdoom5 added a commit to duckdoom5/CppSharp that referenced this pull request Mar 4, 2025
Parser improvements
Fix AST Converter missing conversion data
Fix bug in test code
Can't return `T();` if `T` is a const reference type.
Fix clang assert
Fix other test compile bug
It's kinda weird to call it pure virtual and then implement it anyway no?
Fix test compiler error
Don't skip function bodies to force template instantiations
@tritao
Copy link
Collaborator

tritao commented Mar 4, 2025

Is this one ready to go?

@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from e981c4b to c54f367 Compare March 4, 2025 09:37
@duckdoom5
Copy link
Contributor Author

Yes it is :)

@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from c54f367 to 089f802 Compare March 4, 2025 09:48
@duckdoom5 duckdoom5 force-pushed the fix/parser-improvements branch from 089f802 to b2786f8 Compare March 4, 2025 09:49
@tritao tritao merged commit 88204f7 into mono:main Mar 4, 2025
9 checks passed
@duckdoom5 duckdoom5 deleted the fix/parser-improvements branch March 4, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants