Working on clang-tidy check that is finding modifications of container you are iterating I found this lines of code. Here, we are using operator[] on std::map. In this case is not a problem, because we use the key of actual entry and it will not break anything, but we can easily remove operator[] by binding for-loop variable by reference.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
All of the const changes can be separate and submitted. (Please do so before posting revised patch to simplify review.)
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | ||
---|---|---|
762 | Sink variable to use please. Also, assigning to reference is mildly confusing. Can you add a comment to clarify? | |
819 | This appears to be changing behaviour. The State variable previous survive to end of scope unmodified and is now modified part way through before hitting more conditional code. Please revert. |
Sink variable to use please.
Also, assigning to reference is mildly confusing. Can you add a comment to clarify?