loop-convert, a C++11 for loop modernizer
authorSam Panzer <espanz@gmail.com>
Fri, 24 Aug 2012 23:46:42 +0000 (23:46 +0000)
committerSam Panzer <espanz@gmail.com>
Fri, 24 Aug 2012 23:46:42 +0000 (23:46 +0000)
commit4cf99cfdc785eb284bf805831b4be275e0ee2d53
tree9e3bd777d00860d211386396fa58c73113aa6500
parent24adaee6bc305b69200c7c022b63fe4a414f6502
loop-convert, a C++11 for loop modernizer

A new Clang-based tool which converts for loops to use the range-based
syntax new to C++11. Three kinds of loops can be converted:
 - Loops over statically allocated arrays
 - Loops over containers, using iterators
 - Loops over array-like containers, using operator[] and at()

Each transformation is assigned a confidence level by the tool. The
minimum require confidence level to actually apply the transformation
can be specified on the command line, but the default level should be
fine for most code.

Like other tools based on RefactoringTool, it is easiest to use this
tool with a compilation database.

llvm-svn: 162627
28 files changed:
clang-tools-extra/CMakeLists.txt
clang-tools-extra/loop-convert/CMakeLists.txt [new file with mode: 0644]
clang-tools-extra/loop-convert/LoopActions.cpp [new file with mode: 0644]
clang-tools-extra/loop-convert/LoopActions.h [new file with mode: 0644]
clang-tools-extra/loop-convert/LoopConvert.cpp [new file with mode: 0644]
clang-tools-extra/loop-convert/LoopMatchers.cpp [new file with mode: 0644]
clang-tools-extra/loop-convert/LoopMatchers.h [new file with mode: 0644]
clang-tools-extra/loop-convert/StmtAncestor.cpp [new file with mode: 0644]
clang-tools-extra/loop-convert/StmtAncestor.h [new file with mode: 0644]
clang-tools-extra/loop-convert/VariableNaming.cpp [new file with mode: 0644]
clang-tools-extra/loop-convert/VariableNaming.h [new file with mode: 0644]
clang-tools-extra/test/CMakeLists.txt
clang-tools-extra/test/loop-convert/Inputs/negative-header.h [new file with mode: 0644]
clang-tools-extra/test/loop-convert/Inputs/structures.h [new file with mode: 0644]
clang-tools-extra/test/loop-convert/array.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/confidence.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/dependency.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/iterator.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/naming.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/negative-iterator.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/negative-multi-end-call.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/negative-pseudoarray-extra.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/negative-pseudoarray.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/negative.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/nesting.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/nocompile.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/pseudoarray.cpp [new file with mode: 0644]
clang-tools-extra/test/loop-convert/single-iterator.cpp [new file with mode: 0644]