forked from OSchip/llvm-project
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:
parent
db7d11c7a2
commit
4a4be01818
|
@ -643,7 +643,9 @@ private:
|
||||||
if (!DryRun)
|
if (!DryRun)
|
||||||
BBC->alignLines(Whitespaces);
|
BBC->alignLines(Whitespaces);
|
||||||
Token.reset(BBC);
|
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));
|
Token.reset(new BreakableLineComment(SourceMgr, Current, StartColumn));
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2763,6 +2763,7 @@ TEST_F(FormatTest, HandlesIncludeDirectives) {
|
||||||
"#include \"string.h\"\n"
|
"#include \"string.h\"\n"
|
||||||
"#include <a-a>\n"
|
"#include <a-a>\n"
|
||||||
"#include < path with space >\n"
|
"#include < path with space >\n"
|
||||||
|
"#include \"abc.h\" // this is included for ABC\n"
|
||||||
"#include \"some very long include paaaaaaaaaaaaaaaaaaaaaaath\"",
|
"#include \"some very long include paaaaaaaaaaaaaaaaaaaaaaath\"",
|
||||||
getLLVMStyleWithColumns(35));
|
getLLVMStyleWithColumns(35));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue