summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-12-07 16:44:49 +0000
committerDaniel Jasper <djasper@google.com>2014-12-07 16:44:49 +0000
commit55aed6777f62ad6ec5ac6388b41bb95dc888a468 (patch)
treeedf33d4b59237656aea240f17e5d49cfa5a45d96 /clang/lib/Format
parente80523350f6f6c559ebb5c7afd8a2b3a53307d8e (diff)
downloadbcm5719-llvm-55aed6777f62ad6ec5ac6388b41bb95dc888a468.tar.gz
bcm5719-llvm-55aed6777f62ad6ec5ac6388b41bb95dc888a468.zip
clang-format: Don't merge lines with comments.
Before: int f() { // comment return 42; } After: int f() { // comment return 42; } This fixes llvm.org/PR21769. llvm-svn: 223609
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index cf8e5d32ae5..ebd12909e1c 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -665,6 +665,9 @@ public:
}
if (I[1]->First->is(TT_FunctionLBrace) &&
Style.BreakBeforeBraces != FormatStyle::BS_Attach) {
+ if (I[1]->Last->is(TT_LineComment))
+ return 0;
+
// Check for Limit <= 2 to account for the " {".
if (Limit <= 2 || (Style.ColumnLimit == 0 && containsMustBreak(TheLine)))
return 0;
OpenPOWER on IntegriCloud