[PATCH] D14289: Handle correctly containers that are data members in modernize-loop-convert.

Angel Garcia via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 08:20:59 PST 2015


angelgarcia created this revision.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.

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.

http://reviews.llvm.org/D14289

Files:
  clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tidy/modernize/LoopConvertCheck.h
  clang-tidy/modernize/LoopConvertUtils.h
  test/clang-tidy/modernize-loop-convert-basic.cpp
  test/clang-tidy/modernize-loop-convert-extra.cpp
  test/clang-tidy/modernize-loop-convert-negative.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14289.39070.patch
Type: text/x-patch
Size: 6457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151103/47a216fe/attachment.bin>


More information about the cfe-commits mailing list