summaryrefslogtreecommitdiffstats
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
commitd9ff35f6eddfb761bfdf57daa8ed12d3a7d69b8d (patch)
tree466e39f12a134f132c349d8d5613698591a78ce5
parent73156025e021f98786009a06c794f8b8f369b7a3 (diff)
downloadbcm5719-llvm-d9ff35f6eddfb761bfdf57daa8ed12d3a7d69b8d.tar.gz
bcm5719-llvm-d9ff35f6eddfb761bfdf57daa8ed12d3a7d69b8d.zip
[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. llvm-svn: 202622
-rw-r--r--llvm/docs/CodingStandards.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index 18e832d51d9..de2ac3fbe5f 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/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 ``[]``:
OpenPOWER on IntegriCloud