aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-02 18:30:06 +0000
committerDaniel Jasper <djasper@google.com>2013-01-02 18:30:06 +0000
commit5eda31ee30106c769b5829683761d42e6e50467f (patch)
tree6e1aaa73cfa87e8d411864faaeb53e26c0951d17 /lib/Format/Format.cpp
parentba3d3074e8ef4c4c05ac062b073b2e082e6a0206 (diff)
Don't allow line breaks after template parameters.
This fixes llvm.org/PR14786. We will need to split there as a last resort, but that should be done consistently independent of whether the type is a template type or not. Before: template <typename T> aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T> ::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: template <typename T> aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171400 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 3c337ec063..6fb75a657a 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -941,7 +941,10 @@ private:
}
bool canBreakBefore(unsigned i) {
+ if (Annotations[i - 1].ClosesTemplateDeclaration)
+ return true;
if (Annotations[i - 1].Type == TokenAnnotation::TT_PointerOrReference ||
+ Annotations[i - 1].Type == TokenAnnotation::TT_TemplateCloser ||
Annotations[i].Type == TokenAnnotation::TT_ConditionalExpr) {
return false;
}