This is an archive of the discontinued LLVM Phabricator instance.

Refactor LoopConvertCheck.
ClosedPublic

Authored by angelgarcia on Sep 11 2015, 4:41 AM.

Details

Summary

Reorder the code in a more logical and understandable way.

Diff Detail

Event Timeline

angelgarcia retitled this revision from to Refactor LoopConvertCheck..
angelgarcia updated this object.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.
klimek added inline comments.Sep 14 2015, 3:55 PM
clang-tidy/modernize/LoopConvertCheck.cpp
419

Now you can make that early exit!

494–495

I assume the change in the tests is due to the bug here? :)

498

I'd give the intermediate result a different name.

533–534

I think we still want to split up this function. The if() {} else {} blocks are too long ...

534

This sentence doesn't parse.

534–536

I think an example might help this comment. Here and elsewhere ;)

535–536

Perhaps add: , because we need to keep the code correct if it mutates the returned objects

536

LLVM uses FIXME; also, "Think about this" is not a good todo ;) They need to be more specific (or delete it).

542

That comment doesn't give information, I think. I'd delete it.

559–560

I liked the early continue better...

clang-tidy/modernize/LoopConvertCheck.h
34

I'd probably make that a std::string - having references in members is a frequent cause for bugs.

angelgarcia marked 9 inline comments as done.Sep 17 2015, 6:14 AM
angelgarcia added inline comments.
clang-tidy/modernize/LoopConvertCheck.cpp
494–495

I'm not sure if it was a bug or just different priorities, but that's not reason. "DerefByValue" is a weird case and we don't have many tests for that. The change is due to:

If the initializer and variable have both the same type just use auto
otherwise we test for const qualification of the pointed-at type.

At line 726 (somewhere inside the iterator loops logic). I removed the conditional because we always want to check for const qualification.

Split a function and several other small changes.

klimek accepted this revision.Sep 19 2015, 11:44 AM
klimek edited edge metadata.

lg

This revision is now accepted and ready to land.Sep 19 2015, 11:44 AM
angelgarcia closed this revision.Sep 21 2015, 2:34 AM