summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst')
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst
new file mode 100644
index 00000000000..683977a3d2c
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst
@@ -0,0 +1,27 @@
+.. title:: clang-tidy - bugprone-lambda-function-name
+
+bugprone-lambda-function-name
+=============================
+
+Checks for attempts to get the name of a function from within a lambda
+expression. The name of a lambda is always something like ``operator()``, which
+is almost never what was intended.
+
+Example:
+
+.. code-block:: c++
+
+ void FancyFunction() {
+ [] { printf("Called from %s\n", __func__); }();
+ [] { printf("Now called from %s\n", __FUNCTION__); }();
+ }
+
+Output::
+
+ Called from operator()
+ Now called from operator()
+
+Likely intended output::
+
+ Called from FancyFunction
+ Now called from FancyFunction
OpenPOWER on IntegriCloud