xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/bugprone/lambda-function-name.rst (revision a94c44cc0a5601e977b5cc1d2cfdee1488be62e9)
1.. title:: clang-tidy - bugprone-lambda-function-name
2
3bugprone-lambda-function-name
4=============================
5
6Checks for attempts to get the name of a function from within a lambda
7expression. The name of a lambda is always something like ``operator()``, which
8is almost never what was intended.
9
10Example:
11
12.. code-block:: c++
13
14  void FancyFunction() {
15    [] { printf("Called from %s\n", __func__); }();
16    [] { printf("Now called from %s\n", __FUNCTION__); }();
17  }
18
19Output::
20
21  Called from operator()
22  Now called from operator()
23
24Likely intended output::
25
26  Called from FancyFunction
27  Now called from FancyFunction
28
29Options
30-------
31
32.. option::  IgnoreMacros
33
34  The value `true` specifies that attempting to get the name of a function from
35  within a macro should not be diagnosed. The default value is `false`.
36