summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp3
-rw-r--r--clang/unittests/Format/FormatTest.cpp6
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 73ae10a29f8..3adb72c11da 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -792,7 +792,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
if (Previous && Previous->is(tok::question))
State.Stack.back().QuestionColumn = State.Column;
}
- if (!Current.opensScope() && !Current.closesScope())
+ if (!Current.opensScope() && !Current.closesScope() &&
+ !Current.is(TT_PointerOrReference))
State.LowestLevelOnLine =
std::min(State.LowestLevelOnLine, Current.NestingLevel);
if (Current.isMemberAccess())
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 7d5b77bffd1..9b833a96f16 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5221,6 +5221,12 @@ TEST_F(FormatTest, FormatsFunctionTypes) {
verifyFormat("void f() { function(*some_pointer_var)[0] = 10; }");
verifyFormat("int x = f(&h)();");
verifyFormat("returnsFunction(&param1, &param2)(param);");
+ verifyFormat("std::function<\n"
+ " LooooooooooongTemplatedType<\n"
+ " SomeType>*(\n"
+ " LooooooooooooooooongType type)>\n"
+ " function;",
+ getGoogleStyleWithColumns(40));
}
TEST_F(FormatTest, FormatsPointersToArrayTypes) {
OpenPOWER on IntegriCloud