Don't insert a break into include lines with trailing comments.

llvm-svn: 182003
This commit is contained in:
Daniel Jasper 2013-05-16 12:59:13 +00:00
parent efb6172cb3
commit 8bb99e8911
2 changed files with 3 additions and 1 deletions

View File

@ -777,7 +777,8 @@ private:
llvm::OwningPtr<BreakableToken> Token;
unsigned StartColumn = State.Column - Current.FormatTok.TokenLength -
UnbreakableTailLength;
if (Current.is(tok::string_literal)) {
if (Current.is(tok::string_literal) &&
Current.Type != TT_ImplicitStringLiteral) {
// Only break up default narrow strings.
const char *LiteralData = SourceMgr.getCharacterData(
Current.FormatTok.getStartOfNonWhitespace());

View File

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