Page MenuHomePhabricator

[CFG] NFC: Remove implicit conversion from CFGTerminator to Stmt *, make it a variant class instead.

Authored by NoQ on May 10 2019, 8:02 PM.



This conversion does indeed save some code, but i plan to add support for more kinds of terminators that aren't necessarily based on statements, and as i do, it becomes more and more confusing to have it implicitly convertible to a Stmt *.

Diff Detail


Event Timeline

NoQ created this revision.May 10 2019, 8:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2019, 8:02 PM
a_sidorin accepted this revision.May 11 2019, 11:17 AM

The conversion operator indeed looks non-evident.

513 ↗(On Diff #199117)

It seems to me that isStmt() and isTemporaryDtorBranch() methods can make the code a bit cleaner in few places by avoiding comparisons with enums.

This revision is now accepted and ready to land.May 11 2019, 11:17 AM
Szelethus accepted this revision.May 14 2019, 1:39 PM


514 ↗(On Diff #199117)

Can we add something to check that the integer part of Data is actually large enough to store an object of type Kind, even if we add more values to the enum?

NoQ updated this revision to Diff 199531.May 14 2019, 4:26 PM
NoQ marked 2 inline comments as done.


a_sidorin added inline comments.May 19 2019, 12:45 PM
465 ↗(On Diff #199531)


NoQ marked an inline comment as done.May 23 2019, 6:32 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2019, 6:34 PM