From: Daniel Jasper Date: Thu, 16 May 2013 12:59:13 +0000 (+0000) Subject: Don't insert a break into include lines with trailing comments. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d5b424589efe6b3dd963cb6a2b71b5583a4f6f2;p=clang Don't insert a break into include lines with trailing comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182003 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 6631c67f7e..6966aabd69 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -777,7 +777,8 @@ private: llvm::OwningPtr 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()); diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index c9201328d9..37e9ba8643 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2894,6 +2894,7 @@ TEST_F(FormatTest, HandlesIncludeDirectives) { "#include \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));