summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/docs')
-rw-r--r--clang-tools-extra/docs/ReleaseNotes.rst9
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/fuchsia-trailing-return.rst35
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/list.rst1
3 files changed, 44 insertions, 1 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 1531545bd34..01d47abdb82 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -70,7 +70,14 @@ Improvements to clang-tidy
Warns if global, non-trivial objects with static storage are constructed, unless the
object is statically initialized with a ``constexpr`` constructor or has no
explicit constructor.
-
+
+- New `fuchsia-trailing-return
+ <http://clang.llvm.org/extra/clang-tidy/checks/fuchsia-trailing-return.html>`_ check
+
+ Functions that have trailing returns are disallowed, except for those
+ using decltype specifiers and lambda with otherwise unutterable
+ return types.
+
- New alias `hicpp-avoid-goto
<http://clang.llvm.org/extra/clang-tidy/checks/hicpp-avoid-goto.html>`_ to
`cppcoreguidelines-avoid-goto <http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-avoid-goto.html>`_
diff --git a/clang-tools-extra/docs/clang-tidy/checks/fuchsia-trailing-return.rst b/clang-tools-extra/docs/clang-tidy/checks/fuchsia-trailing-return.rst
new file mode 100644
index 00000000000..42e85c20e22
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/fuchsia-trailing-return.rst
@@ -0,0 +1,35 @@
+.. title:: clang-tidy - fuchsia-trailing-return
+
+fuchsia-trailing-return
+=======================
+
+Functions that have trailing returns are disallowed, except for those using
+decltype specifiers and lambda with otherwise unutterable return types.
+
+For example:
+
+.. code-block:: c++
+
+ // No warning
+ int add_one(const int arg) { return arg; }
+
+ // Warning
+ auto get_add_one() -> int (*)(const int) {
+ return add_one;
+ }
+
+Exceptions are made for lambdas and decltype specifiers:
+
+.. code-block:: c++
+
+ // No warning
+ auto lambda = [](double x, double y) -> double {return x + y;};
+
+ // No warning
+ template <typename T1, typename T2>
+ auto fn(const T1 &lhs, const T2 &rhs) -> decltype(lhs + rhs) {
+ return lhs + rhs;
+ }
+
+
+See the features disallowed in Fuchsia at https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md
diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 77b398b01ff..6a56b6a2d89 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -72,6 +72,7 @@ Clang-Tidy Checks
fuchsia-default-arguments
fuchsia-overloaded-operator
fuchsia-statically-constructed-objects
+ fuchsia-trailing-return
fuchsia-virtual-inheritance
google-build-explicit-make-pair
google-build-namespaces
OpenPOWER on IntegriCloud