Skip to content
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

[GAIAPLAT-1245] Incrementing with tagged property produces a compile error #955

Merged
merged 3 commits into from
Sep 24, 2021

Conversation

simone-gaia
Copy link
Contributor

No description provided.

@@ -1382,8 +1381,7 @@ SourceRange get_expression_source_range(ASTContext* context, const Stmt& node, c
else if (const auto* expression = node_parents_iterator.get<GaiaForStmt>())
{
SourceRange for_condition_source_range = SourceRange(expression->getLParenLoc().getLocWithOffset(1), expression->getRParenLoc().getLocWithOffset(-1));
if (is_range_contained_in_another_range(for_condition_source_range, return_value) ||
is_range_contained_in_another_range(return_value, for_condition_source_range))
if (is_range_contained_in_another_range(for_condition_source_range, return_value) || is_range_contained_in_another_range(return_value, for_condition_source_range))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already fixed in another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I thought this looked familiar.

@@ -631,6 +631,12 @@ ruleset test_insert_delete_2
{
grade = c_grade_d + c_grade_plus;
}

on_update(s:student)
{
Copy link
Contributor

@daxhaw daxhaw Sep 24, 2021

Choose a reason for hiding this comment

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

and maybe just an unqualified total_hours++ as well to round out the test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

anyOf(
hasOperatorName("++"),
hasOperatorName("--")),
hasUnaryOperand(
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is AST101 for me. Why was the above matcher not sufficient? I.e., how did you know it needed to be this to fix the issue with the Tag. I'm trying to understand why T.field++ was not recognized as something Gaia had to act on but table.field++ or field++ worked just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well actually it was not matching table.field++ either. Once I realized that it was trivial to understand that the matcher needs to be the same as the fieldSet (line above).

As of why it did't match, I guess the reason is that memberExpr(member(hasAttr(attr::GaiaFieldLValue looks for the attr::GaiaFieldLValue on the member side field instead of the other table side table.

Copy link
Contributor

@daxhaw daxhaw left a comment

Choose a reason for hiding this comment

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

Approved but I don't understand why the fix makes sense because I don't understand LLVM's ASTs well-enough. Your tests tell me it's working though. Thanks for adding them.

Copy link
Contributor

@LaurentiuCristofor LaurentiuCristofor left a comment

Choose a reason for hiding this comment

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

LGTM, but I don't understand this code enough, to be able to evaluate the functional change.

@simone-gaia simone-gaia merged commit 8daaf56 into master Sep 24, 2021
@LaurentiuCristofor LaurentiuCristofor deleted the rondelli-gaiat-plusplus branch October 15, 2021 20:15
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.

3 participants