annotate private class members as needed#50
Merged
andrurogerz merged 13 commits intocompnerd:mainfrom May 5, 2025
Merged
Conversation
compnerd
reviewed
Apr 30, 2025
compnerd
reviewed
Apr 30, 2025
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
compnerd
reviewed
Apr 30, 2025
Collaborator
Author
|
@compnerd any additional feedback on this one? I have been using it locally to code-mod in annotations, and it is working great. |
compnerd
approved these changes
May 5, 2025
Owner
compnerd
left a comment
There was a problem hiding this comment.
Some minor tweaks, but this looks good now! Thanks for persisting through this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Updates IDS to add the export annotation to private class members that require export. Previously, only public and protected member were exported.
Overview
This patch makes the following changes:
VisitCallExprto visit method calls identified in the AST. Common code for exporting method declarations was refactored fromVisitFunctionDeclinto private methodexport_function_if_needed, which is now also called byVisitCallExprfor private methodsVisitDeclRefExprto visit static fields references identified in the AST. Common code for exporting variable declarations was refactored fromVisitVarDeclintoexport_variable_if_needed, which is now also called byVisitDeclRefExprfor private static fields.DeclSetclass. An instance of this class replaces previousin_exported_record_member bool that was used to track if the "current" record was being exported. This change simplifies things and ensures that we don't mistakenly export the same symbol twice now that there are multiple codepaths.is_in_system_headermethod to ensure we skip processing any declarations in system headers (this was missing fromVisitVarDecl).Background
Private methods in a class must be exported when they are referenced by inline function definitions. For example:
Similarly, private static fields must in a class must also be exported when referenced by inline function definitions. For example:
Validation