Skip to content

Conversation

@jketema
Copy link
Contributor

@jketema jketema commented Mar 20, 2023

This removes the import of the Print library in places that are used in production and not just debugging.

I've only added a change note for C++, as the C# changes live in an experimental directory.

Comment on lines -541 to 548
/**
* Gets a string that uniquely identifies an `IROpaqueType` tag. This may be different from the usual
* `toString()` of the tag in order to ensure uniqueness.
* Gets a string that uniquely identifies an `IROpaqueType` tag. Using `toString` here might
* not be sufficient to ensure uniqueness, but suffices for our current debugging purposes.
* To ensure uniqueness `getOpaqueTagIdentityString` from `semmle.code.cpp.Print` could be used,
* but that comes at the cost of importing all the `Dump` classes defined in that library.
*/
string getOpaqueTagIdentityString(Type tag) {
hasOpaqueType(tag, _) and
result = getTypeIdentityString(tag)
result = tag.toString()
}
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 probably somewhat dubious. However, this still seems to suffice for our tests (which is the only place where this is used). I tried to factor this out and keep the old definition. Unfortunately this means factoring out all getUniqueId and related predicates, which if non-trivial.

@jketema jketema force-pushed the move-print branch 3 times, most recently from 70a3bb0 to 9031348 Compare March 20, 2023 09:27
Comment on lines -1119 to -1120
/** DEPRECATED: Alias for SsaConsistency */
deprecated module SSAConsistency = SsaConsistency;
Copy link
Contributor Author

@jketema jketema Mar 20, 2023

Choose a reason for hiding this comment

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

Moving this to SSAConsistency.qll resulted in the following warning:

WARNING: Reference to SSAConsistency references a local library, not the named module.

So I dropped this instead. Note that this was deprecated early September 2022.

This removes the import of the `Print` library in places that are used in
production and not just debugging.
@jketema jketema marked this pull request as ready for review March 20, 2023 09:35
@jketema jketema requested review from a team as code owners March 20, 2023 09:35
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM once DCA/CI is happy!

@jketema
Copy link
Contributor Author

jketema commented Mar 20, 2023

DCA looks good.

@jketema jketema merged commit 2968c12 into github:main Mar 20, 2023
@jketema jketema deleted the move-print branch March 20, 2023 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants