[llvm] r202622 - [C++11] Suggest placing callable arguments as the last argument to
Chandler Carruth
chandlerc at gmail.com
Sun Mar 2 01:13:39 PST 2014
Author: chandlerc
Date: Sun Mar 2 03:13:39 2014
New Revision: 202622
URL: http://llvm.org/viewvc/llvm-project?rev=202622&view=rev
Log:
[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.
Modified:
llvm/trunk/docs/CodingStandards.rst
Modified: llvm/trunk/docs/CodingStandards.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.rst?rev=202622&r1=202621&r2=202622&view=diff
==============================================================================
--- llvm/trunk/docs/CodingStandards.rst (original)
+++ llvm/trunk/docs/CodingStandards.rst Sun Mar 2 03:13:39 2014
@@ -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 ``[]``:
More information about the llvm-commits
mailing list