This is an archive of the discontinued LLVM Phabricator instance.

Emit CK_NoOp casts in C mode, not just C++.
ClosedPublic

Authored by jyknight on Oct 4 2018, 5:18 PM.

Details

Summary

Previously, it had been using CK_BitCast even for casts that only
change const/restrict/volatile. Now it will use CK_Noop where
appropriate.

This is an alternate solution to r336746.

Diff Detail

Repository
rL LLVM

Event Timeline

jyknight created this revision.Oct 4 2018, 5:18 PM

Patch is missing tests -- perhaps you could dump the AST and check the casting notation from the output?

Patch is missing tests -- perhaps you could dump the AST and check the casting notation from the output?

It would appear that which casts get emitted in C mode is almost completely untested. I added tests just for this change in a new file, and left a TODO to fill it out for the remainder of those functions.

jyknight updated this revision to Diff 168477.Oct 5 2018, 8:06 AM

Added test.

aaron.ballman accepted this revision.Oct 5 2018, 11:44 AM

LGTM, thank you for adding the test and the TODO!

This revision is now accepted and ready to land.Oct 5 2018, 11:44 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.