]> granicus.if.org Git - clang/commitdiff
Don't insert a break into include lines with trailing comments.
authorDaniel Jasper <djasper@google.com>
Thu, 16 May 2013 12:59:13 +0000 (12:59 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 16 May 2013 12:59:13 +0000 (12:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182003 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp
unittests/Format/FormatTest.cpp

index 6631c67f7e51c7fe6e629ae9e5fa76a2d39e81b6..6966aabd69667431efed244189e6071b1e4f02ae 100644 (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());
index c9201328d96a2aa02db8ec5d3887fdaa66d062f6..37e9ba8643dd2ae6e99e104dd026bd8f1d6fb289 100644 (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));