Don't break comments after includes.

LLVM/Clang basically don't use such comments and for Google-style,
include-lines are explicitly exempt from the column limit. Also, for
most cases, where the column limit is violated, the "better" solution
would be to move the comment to before the include, which clang-format
cannot do (yet).

llvm-svn: 181191
This commit is contained in:
Daniel Jasper 2013-05-06 10:24:51 +00:00
parent db7d11c7a2
commit 4a4be01818
2 changed files with 4 additions and 1 deletions

View File

@ -643,7 +643,9 @@ private:
if (!DryRun)
BBC->alignLines(Whitespaces);
Token.reset(BBC);
} else if (Current.Type == TT_LineComment) {
} else if (Current.Type == TT_LineComment &&
(Current.Parent == NULL ||
Current.Parent->Type != TT_ImplicitStringLiteral)) {
Token.reset(new BreakableLineComment(SourceMgr, Current, StartColumn));
} else {
return 0;

View File

@ -2763,6 +2763,7 @@ TEST_F(FormatTest, HandlesIncludeDirectives) {
"#include \"string.h\"\n"
"#include <a-a>\n"
"#include < path with space >\n"
"#include \"abc.h\" // this is included for ABC\n"
"#include \"some very long include paaaaaaaaaaaaaaaaaaaaaaath\"",
getLLVMStyleWithColumns(35));