aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Format/Format.cpp4
-rw-r--r--unittests/Format/FormatTest.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index d251d4f9e6..68626d29ca 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -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;
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 98e6d47c4f..4c948e89e9 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -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));