Page MenuHomePhabricator

[clang-tidy] Fix infinite loop in MisplacedWideningCastCheck.
ClosedPublic

Authored by etienneb on Apr 6 2016, 10:50 AM.

Details

Summary

In Release mode, the check was infinite looping over chromium code base.

It seems there is something strange with the creation of the Maps.
I believe the compiler is making some assumption with the implicit conversion from enum <-> int.

By moving the map to a standard switch/cases, we no longer allocate memory and we can keep the same behavior. For a small amount of elements, this is fine.

Diff Detail

Event Timeline

etienneb updated this revision to Diff 52822.Apr 6 2016, 10:50 AM
etienneb retitled this revision from to [clang-tidy] Fix infinite loop in MisplacedWideningCastCheck..
etienneb updated this object.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
alexfh requested changes to this revision.Apr 7 2016, 6:38 AM
alexfh edited edge metadata.

Formatting is broken. clang-format -style=file, please.

This revision now requires changes to proceed.Apr 7 2016, 6:38 AM
etienneb updated this revision to Diff 52919.Apr 7 2016, 7:38 AM
etienneb edited edge metadata.

alexfh comments.

alexfh accepted this revision.Apr 7 2016, 7:39 AM
alexfh edited edge metadata.

LG

This revision is now accepted and ready to land.Apr 7 2016, 7:39 AM
etienneb updated this revision to Diff 52921.Apr 7 2016, 7:43 AM
etienneb edited edge metadata.

nits, lower case names.

alexfh added a comment.Apr 7 2016, 7:44 AM

Missed a couple of nits.

clang-tidy/misc/MisplacedWideningCastCheck.cpp
98–130

s/RelativeIntSizes/relativeIntSize/
s/kind/Kind/

etienneb updated this revision to Diff 52924.Apr 7 2016, 7:54 AM
etienneb marked an inline comment as done.

fix nits.

etienneb closed this revision.Apr 7 2016, 7:58 AM