diff options
| author | Daniel Jasper <djasper@google.com> | 2013-03-14 10:50:25 +0000 | 
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-03-14 10:50:25 +0000 | 
| commit | ae9076457e59044487a16dd9c2e6ece0d156905b (patch) | |
| tree | 71c8d30c07e856ee5673a96dc216f836ee069a56 /clang | |
| parent | 140cd8415550856418f47aa3f416ffb014daad16 (diff) | |
| download | bcm5719-llvm-ae9076457e59044487a16dd9c2e6ece0d156905b.tar.gz bcm5719-llvm-ae9076457e59044487a16dd9c2e6ece0d156905b.zip  | |
Fix dereference formatting in for-loops.
Before: for (char **a = b; * a; ++a) {}
After:  for (char **a = b; *a; ++a) {}
llvm-svn: 177037
Diffstat (limited to 'clang')
| -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 0b8f286ebe3..93eeb7f9404 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -661,7 +661,7 @@ private:        return TT_PointerOrReference;      if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace, -                           tok::comma, tok::kw_return, tok::colon, +                           tok::comma, tok::semi, tok::kw_return, tok::colon,                             tok::equal) ||          PrevToken->Type == TT_BinaryOperator ||          PrevToken->Type == TT_UnaryOperator || PrevToken->Type == TT_CastRParen) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index ac9dd644184..86b98b31527 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1919,6 +1919,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {        "const char *const p = reinterpret_cast<const char *const>(q);");    verifyIndependentOfContext("A<int **, int **> a;");    verifyIndependentOfContext("void f(int *a = d * e, int *b = c * d);"); +  verifyFormat("for (char **a = b; *a; ++a) {\n}");    verifyFormat(        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"  | 

