This gives a clearer separation of the context, e.g. in GMOCK
statements.
Before:
EXPECT_CALL(SomeObject,
SomeFunction(Parameter)).WillRepeatedly(Return(SomeValue));
After:
EXPECT_CALL(SomeObject, SomeFunction(Parameter))
.WillRepeatedly(Return(SomeValue));
Minor format cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175162
91177308-0d34-0410-b5e6-
96231b3b80d8
std::set<LineState> Seen;
// Insert start element into queue.
- StateNode *Node=
+ StateNode *Node =
new (Allocator.Allocate()) StateNode(InitialState, false, NULL);
Queue.push(QueueItem(OrderedPenalty(0, Count), Node));
++Count;
// While not empty, take first element and follow edges.
while (!Queue.empty()) {
unsigned Penalty = Queue.top().first.first;
- StateNode *Node= Queue.top().second;
+ StateNode *Node = Queue.top().second;
if (Node->State.NextToken == NULL) {
DEBUG(llvm::errs() << "\n---\nPenalty for line: " << Penalty << "\n");
break;
/// \p IndentForLevel must contain the indent for the level \c l
/// at \p IndentForLevel[l], or a value < 0 if the indent for
/// that level is unknown.
- unsigned getIndent(const std::vector<int> IndentForLevel,
- unsigned Level) {
+ unsigned getIndent(const std::vector<int> IndentForLevel, unsigned Level) {
if (IndentForLevel[Level] != -1)
return IndentForLevel[Level];
if (Level == 0)
struct ScopedContextCreator {
AnnotatingParser &P;
- ScopedContextCreator(AnnotatingParser &P, unsigned Increase)
- : P(P) {
- P.Contexts.push_back(Context(
- P.Contexts.back().BindingStrength + Increase,
- P.Contexts.back().IsExpression));
+ ScopedContextCreator(AnnotatingParser &P, unsigned Increase) : P(P) {
+ P.Contexts.push_back(Context(P.Contexts.back().BindingStrength + Increase,
+ P.Contexts.back().IsExpression));
}
~ScopedContextCreator() { P.Contexts.pop_back(); }
if (Right.is(tok::arrow) || Right.is(tok::period)) {
if (Left.is(tok::r_paren) && Line.Type == LT_BuilderTypeCall)
return 5; // Should be smaller than breaking at a nested comma.
+ if ((Left.is(tok::r_paren) || Left.is(tok::r_square)) &&
+ Left.MatchingParen && Left.MatchingParen->ParameterCount > 0)
+ return 10;
return 150;
}
" aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)));");
verifyGoogleFormat(
- "aaaaaaaaaaaaaaa(\n"
- " aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();");
+ "aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa)\n"
+ " .aaaaaaaaaaaaaaaaaa();");
verifyGoogleFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaa, aaaaaaaaaaa);");
" aaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
Style);
- verifyFormat("void f() {\n"
- " aaaaaaaaaaaaaaaaaaaaaaaa(\n"
- " aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa).aaaaaaa();\n"
- "}",
- Style);
+ verifyFormat(
+ "void f() {\n"
+ " aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaa)\n"
+ " .aaaaaaa();\n"
+ "}", Style);
}
TEST_F(FormatTest, FormatsBuilderPattern) {
"function(LoooooooooooooooooooooooooooooooooooongObject\n"
" ->loooooooooooooooooooooooooooooooooooooooongFunction());");
+ verifyFormat("EXPECT_CALL(SomeObject, SomeFunction(Parameter))\n"
+ " .WillRepeatedly(Return(SomeValue));");
+ verifyFormat("SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]\n"
+ " .insert(ccccccccccccccccccccccc);");
+
// Here, it is not necessary to wrap at "." or "->".
verifyFormat("if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaa) ||\n"
" aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {\n}");