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

C++: Don't strip specifiers in Node.getType #15559

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

MathiasVP
Copy link
Contributor

We were calling getUnspecifiedType instead of getUnderlyingType in a bunch of places when computing the type of a dataflow node, and since getUnspecifiedType strips away specifiers such as const and volatile we could get into a situation where a node's getType returned int while the same node's asExpr().getType() returned const int.

The fix is to use getUnderlyingType instead of getUnspecifiedType since getUnderlyingType only resolves typedefs without stripping specifiers.

Finally, I also fixed a bug where some nodes were not correctly specified as being dataflow nodes wrapping a glvalue instruction or operand. This also fixed some inconsistency errors.

There still are some type-related bugs, but they seem a bit more difficult to fix. I'll write up an issue for the remaining ones.

Commit-by-commit review recommended.

@github-actions github-actions bot added the C++ label Feb 8, 2024
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Feb 8, 2024
@MathiasVP MathiasVP marked this pull request as ready for review February 9, 2024 08:51
@MathiasVP MathiasVP requested a review from a team as a code owner February 9, 2024 08:51
@MathiasVP
Copy link
Contributor Author

DCA reports one additional new result that looks like:

const char* patterns[] = { "%s", "file=%s", "\"%s\"", "file=\"%s\"" };
char buf[1 * K];
for (size_t i = 0; i < ARRAY_SIZE(patterns); i++) {
  int ret = jio_snprintf(buf, sizeof(buf), patterns[i], TestLogFileName);
  /* ... */
}

where we claim that patterns[i] isn't a constant format string. I think that's a query FP that I expect to be fixed by #15516. So I don't think that should block this PR.

@MathiasVP MathiasVP merged commit a42c845 into github:main Feb 9, 2024
14 checks passed
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