Skip to content

C++: Clean up IRVariables using final aliases #16415

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 3 commits into from
May 3, 2024

Conversation

MathiasVP
Copy link
Contributor

This PR is just a simple refactoring of the IRVariable files that replaces explicit enumeration of subclasses in the base class with abstract classes.

In order to ensure no other code accidentally extends the new abstract classes they're kept private and final aliases are provided. This means code will continue to work exactly as before.

MathiasVP added 2 commits May 3, 2024 13:50
…as'ing to ensure that we don't accidentially extend the abstract base class.
@MathiasVP MathiasVP requested a review from a team as a code owner May 3, 2024 13:46
@github-actions github-actions bot added the C++ label May 3, 2024
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label May 3, 2024
@@ -17,18 +17,11 @@
* The variable may be a user-declared variable (`IRUserVariable`) or a temporary variable generated
* by the AST-to-IR translation (`IRTempVariable`).
*/
class IRVariable extends TIRVariable {
abstract private class AbstractIRVariable extends TIRVariable {

Check warning

Code scanning / CodeQL

UnusedField

This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRAutomaticVariable](2). This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRGeneratedVariable](3). This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRParameter](4). This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [Allocation](5).
@@ -17,18 +17,11 @@
* The variable may be a user-declared variable (`IRUserVariable`) or a temporary variable generated
* by the AST-to-IR translation (`IRTempVariable`).
*/
class IRVariable extends TIRVariable {
abstract private class AbstractIRVariable extends TIRVariable {

Check warning

Code scanning / CodeQL

UnusedField

This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRAutomaticVariable](2). This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRGeneratedVariable](3). This class declares the [field func](1) but does not bind it in the characteristic predicate of any class between it and [IRParameter](4).
Copy link
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if DCA is happy.

Took me a bit to figure out that all the restrictions from the char preds are covered in the subclassed (as they sometimes look a bit different there), but this all seems ok.

@MathiasVP
Copy link
Contributor Author

DCA was uneventful (as expected)

@MathiasVP MathiasVP merged commit 5d5e313 into github:main May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants