diff options
| author | Daniel Jasper <djasper@google.com> | 2013-07-01 09:34:09 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-07-01 09:34:09 +0000 |
| commit | 022612db050e18d18c8e6febad56b3aa22e8a6e6 (patch) | |
| tree | e156f5c0867a4a7c848d5af043953969282b3541 | |
| parent | 7f5d53e55fd8465209abc976fc8a6036f8138b8f (diff) | |
| download | bcm5719-llvm-022612db050e18d18c8e6febad56b3aa22e8a6e6.tar.gz bcm5719-llvm-022612db050e18d18c8e6febad56b3aa22e8a6e6.zip | |
Keep space between pointer and block comment.
Before: void f(int */* unused */) {}
After: void f(int * /* unused */) {}
The previous version seems to be valid C++ code but confuses many syntax
highlighters.
llvm-svn: 185320
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index eb5616d5ab8..7cbacd9042d 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1073,7 +1073,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, (Left.Type != TT_PointerOrReference || Style.PointerBindsToType)) return true; if (Left.Type == TT_PointerOrReference) - return Right.Tok.isLiteral() || + return Right.Tok.isLiteral() || Right.Type == TT_BlockComment || ((Right.Type != TT_PointerOrReference) && Right.isNot(tok::l_paren) && Style.PointerBindsToType && Left.Previous && diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index c4d9c6f573b..25e1d49f08d 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3887,6 +3887,8 @@ TEST_F(FormatTest, BlockComments) { format("int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; /* comment */\n" "int bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; /* comment */\n" "int cccccccccccccccccccccccccccccc; /* comment */\n")); + + verifyFormat("void f(int * /* unused */) {}"); } TEST_F(FormatTest, BlockCommentsInMacros) { |

