summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-03-02 09:13:39 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-03-02 09:13:39 +0000
commitbab807eaa132b2a909aa4d19b61fe766c73d10ee (patch)
treefc130cfe2dd928cd6f8770ebe659158909892df0 /docs
parent629b96cb4f278cc78bfd5679e91315cb6e1ed164 (diff)
downloadllvm-bab807eaa132b2a909aa4d19b61fe766c73d10ee.tar.gz
llvm-bab807eaa132b2a909aa4d19b61fe766c73d10ee.tar.bz2
llvm-bab807eaa132b2a909aa4d19b61fe766c73d10ee.tar.xz
[C++11] Suggest placing callable arguments as the last argument to
facilitate the nice formatting of lambdas passed there. Suggested by Chris during review of my lambda additions, and something I strongly agree with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/CodingStandards.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/CodingStandards.rst b/docs/CodingStandards.rst
index 18e832d51d..de2ac3fbe5 100644
--- a/docs/CodingStandards.rst
+++ b/docs/CodingStandards.rst
@@ -481,6 +481,10 @@ by the preceding part of the statement:
return a.bam < b.bam;
});
+To take best advantage of this formatting, if you are designing an API which
+accepts a continuation or single callable argument (be it a functor, or
+a ``std::function``), it should be the last argument if at all possible.
+
If there are multiple multi-line lambdas in a statement, or there is anything
interesting after the lambda in the statement, indent the block two spaces from
the indent of the ``[]``: