diff options
| author | Daniel Jasper <djasper@google.com> | 2014-11-23 19:15:35 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-11-23 19:15:35 +0000 |
| commit | bb86d847ba53d52e110bf94d38266a9f4d286996 (patch) | |
| tree | 0c99bde5079e0346d0739442d90767adafd5df4f | |
| parent | 7198b0c77897f32f4ae28e3eee48b09f99876293 (diff) | |
| download | bcm5719-llvm-bb86d847ba53d52e110bf94d38266a9f4d286996.tar.gz bcm5719-llvm-bb86d847ba53d52e110bf94d38266a9f4d286996.zip | |
clang-format: Improve ObjC blocks with return type.
Before:
Block b = ^int * (A * a, B * b) {}
After:
Block b = ^int *(A *a, B *b) {}
This fixed llvm.org/PR21619.
llvm-svn: 222639
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 346af61199c..a36f9630e68 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1033,7 +1033,7 @@ private: // It is very unlikely that we are going to find a pointer or reference type // definition on the RHS of an assignment. - if (IsExpression) + if (IsExpression && !Contexts.back().CaretFound) return TT_BinaryOperator; return TT_PointerOrReference; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index fceebfadea7..58680e07343 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -9412,6 +9412,7 @@ TEST_F(FormatTest, FormatsBlocks) { " }\n" " }\n" "});"); + verifyFormat("Block b = ^int *(A *a, B *b) {}"); FormatStyle FourIndent = getLLVMStyle(); FourIndent.ObjCBlockIndentWidth = 4; |

