This is an archive of the discontinued LLVM Phabricator instance.

Handle correctly containers that are data members in modernize-loop-convert.
ClosedPublic

Authored by angelgarcia on Nov 3 2015, 8:20 AM.

Details

Summary

I recently found that the variable naming wasn't working as expected with containers that are data members. The new index always received the name "Elem" (or equivalent) regardless of the container's name.
The check was assuming that the container's declaration was a VarDecl, which cannot be converted to a FieldDecl (a data member), and then it could never retrieve its name.

This also fixes some cases where the check failed to find the container at all (so it didn't do any fix) because of the same reason.

Diff Detail

Event Timeline

angelgarcia updated this revision to Diff 39070.Nov 3 2015, 8:20 AM
angelgarcia retitled this revision from to Handle correctly containers that are data members in modernize-loop-convert..
angelgarcia updated this object.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.
klimek accepted this revision.Nov 3 2015, 8:33 AM
klimek edited edge metadata.

lg

This revision is now accepted and ready to land.Nov 3 2015, 8:33 AM
angelgarcia updated this revision to Diff 39075.Nov 3 2015, 8:40 AM
angelgarcia edited edge metadata.

Merge with the latest revision.

angelgarcia closed this revision.Nov 3 2015, 8:40 AM