Allow breaking between type and name in for loops.
authorDaniel Jasper <djasper@google.com>
Thu, 21 Feb 2013 15:00:29 +0000 (15:00 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 21 Feb 2013 15:00:29 +0000 (15:00 +0000)
commit37905f711cb286baae724f1e438ec572ba26fbf3
treecdb7e3977cd661460cd2c60ff8ad03d4de8b6808
parente8ba1c851a8f3f3397422dd49e4554e017f0eb8f
Allow breaking between type and name in for loops.

This fixes llvm.org/PR15033.

Also: Always break before a parameter, if the previous parameter was
split over multiple lines. This was necessary to make the right
decisions in for-loops, almost always makes the code more readable and
also fixes llvm.org/PR14873.

Before:
for (llvm::ArrayRef<NamedDecl *>::iterator I = FD->getDeclsInPrototypeScope()
         .begin(), E = FD->getDeclsInPrototypeScope().end();
     I != E; ++I) {
}
foo(bar(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
        ccccccccccccccccccccccccccccc), d, bar(e, f));

After:
for (llvm::ArrayRef<NamedDecl *>::iterator
         I = FD->getDeclsInPrototypeScope().begin(),
         E = FD->getDeclsInPrototypeScope().end();
     I != E; ++I) {
}
foo(bar(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
        ccccccccccccccccccccccccccccc),
    d, bar(e, f));

llvm-svn: 175741
clang/lib/Format/Format.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp