This is an archive of the discontinued LLVM Phabricator instance.

[clang/CFG] Don't explicitly add AttributedStmtClass to AlwaysAddList
ClosedPublic

Authored by thakis on Oct 11 2021, 11:27 AM.

Details

Summary

CFGBuilder::addStmt() implicitly passes AddStmtChoice::AlwaysAdd
to Visit() already, so this should have no behavior change.

Diff Detail

Event Timeline

thakis requested review of this revision.Oct 11 2021, 11:27 AM
thakis created this revision.
hans added a comment.Oct 12 2021, 4:27 AM

I guess I don't have enough context here. Why is AttributedStmtClass special here? Is it because it's a statement and the others are expressions, and so wouldn't go through CFGBlock::addStmt()?

Yes, that's my understanding. (I'm not super familiar with this code either.)

The line was added in the change that added -Wimplicit-fallthrough (84837d5b5aa0d), and all the -Wimplicit-fallthrough tests still pass with this. Chances are it was unnecessary back then too.

(addStmt is from ea9fcffe035d, way older.)

hans accepted this revision.Oct 12 2021, 5:49 AM

Sounds good to me :)

This revision is now accepted and ready to land.Oct 12 2021, 5:49 AM
This revision was landed with ongoing or failed builds.Oct 12 2021, 10:29 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2021, 10:29 AM