diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-09 09:33:39 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-09 09:33:39 +0000 |
commit | 043835aa876b1edeca0a05def0cc0989faa15892 (patch) | |
tree | 73d24965f53a029a5d8ddd6a155e872ce4411042 /lib/Format/Format.cpp | |
parent | 886568dc24eb0a1ccf73bf32d1eafa8fd4008cc6 (diff) |
Allow comments in the middle of statements to be on their own line.
This fixes llvm.org/PR14860.
Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
//getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 16e8c2d6c5..e5e59f4550 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1062,8 +1062,10 @@ private: if (Left.is(tok::equal) && CurrentLineType == LT_VirtualFunctionDecl) return false; + if (Right.is(tok::comment)) + return !Right.Children.empty(); if (Right.is(tok::r_paren) || Right.is(tok::l_brace) || - Right.is(tok::comment) || Right.is(tok::greater)) + Right.is(tok::greater)) return false; return (isBinaryOperator(Left) && Left.isNot(tok::lessless)) || Left.is(tok::comma) || Right.is(tok::lessless) || |