bugprone-lambda-function-name

检查从 lambda 表达式内部获取函数名称的尝试。lambda 的名称总是类似于 operator(),这几乎永远不是预期的结果。

示例

void FancyFunction() {
  [] { printf("Called from %s\n", __func__); }();
  [] { printf("Now called from %s\n", __FUNCTION__); }();
}

输出

Called from operator()
Now called from operator()

预期输出

Called from FancyFunction
Now called from FancyFunction

选项

IgnoreMacros

true 指定从宏内部获取函数名称的尝试不应被诊断。默认值为 false