0.5.4
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
t20053 - Test case for inlining nested lambda operator calls

Config

diagrams:
t20053_sequence:
type: sequence
glob:
- t20053.cc
include:
namespaces:
- clanguml::t20053
using_namespace: clanguml::t20053
inline_lambda_messages: true
from:
- function: "clanguml::t20053::tmain()"

Source code

File tests/t20053/t20053.cc

namespace clanguml {
namespace t20053 {
template <typename F> int a1(F &&f) { return f(42); }
int a2(int x) { return 2; }
int a3(int x) { return 3; }
int tmain()
{
// Call expression in a nested lambda
auto v1 = [](auto &&arg1) {
return [](auto &&arg2) { return a2(arg2); }(arg1);
}(0);
// Nested lambda call without any actual calls
auto v2 = [](auto &&arg1) {
return [](auto &&arg2) { return arg2 + 2; }(arg1);
}(0);
// Call expression in a nested lambda in call expression
auto v4 = a1(
[](auto &&arg1) { return [](auto &&arg2) { return a3(arg2); }(arg1); });
return 0;
}
}
}

Generated PlantUML diagrams

Generated Mermaid diagrams

Generated JSON models

{
"diagram_type": "sequence",
"name": "t20053_sequence",
"participants": [
{
"display_name": "tmain()",
"full_name": "clanguml::t20053::tmain()",
"id": "15912078192340203929",
"name": "tmain",
"namespace": "clanguml::t20053",
"source_location": {
"column": 5,
"file": "t20053.cc",
"line": 9,
"translation_unit": "t20053.cc"
},
"type": "function"
},
{
"display_name": "a2(int)",
"full_name": "clanguml::t20053::a2(int)",
"id": "5360957122025856535",
"name": "a2",
"namespace": "clanguml::t20053",
"source_location": {
"column": 5,
"file": "t20053.cc",
"line": 5,
"translation_unit": "t20053.cc"
},
"type": "function"
},
{
"display_name": "a1<(lambda at t20053.cc:23:9)>((lambda at t20053.cc:23:9) &&)",
"full_name": "clanguml::t20053::a1<(lambda at t20053.cc:23:9)>((lambda at /home/bartek/devel/clang-uml/tests/t20053/t20053.cc:23:9) &&)",
"id": "7741474621311506482",
"name": "a1",
"namespace": "clanguml::t20053",
"source_location": {
"column": 27,
"file": "t20053.cc",
"line": 3,
"translation_unit": "t20053.cc"
},
"type": "function_template"
},
{
"display_name": "a3(int)",
"full_name": "clanguml::t20053::a3(int)",
"id": "12693661768937063443",
"name": "a3",
"namespace": "clanguml::t20053",
"source_location": {
"column": 5,
"file": "t20053.cc",
"line": 7,
"translation_unit": "t20053.cc"
},
"type": "function"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "15912078192340203929",
"participant_id": "15912078192340203929"
},
"name": "",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 41,
"file": "t20053.cc",
"line": 13,
"translation_unit": "t20053.cc"
},
"to": {
"activity_id": "5360957122025856535",
"participant_id": "5360957122025856535"
},
"type": "message"
},
{
"from": {
"activity_id": "15912078192340203929",
"participant_id": "15912078192340203929"
},
"name": "",
"return_type": "",
"scope": "normal",
"source_location": {
"column": 15,
"file": "t20053.cc",
"line": 22,
"translation_unit": "t20053.cc"
},
"to": {
"activity_id": "7741474621311506482",
"participant_id": "7741474621311506482"
},
"type": "message"
},
{
"from": {
"activity_id": "7741474621311506482",
"participant_id": "7741474621311506482"
},
"name": "",
"return_type": "int",
"scope": "normal",
"source_location": {
"column": 59,
"file": "t20053.cc",
"line": 23,
"translation_unit": "t20053.cc"
},
"to": {
"activity_id": "12693661768937063443",
"participant_id": "12693661768937063443"
},
"type": "message"
}
],
"start_from": {
"id": "15912078192340203929",
"location": "clanguml::t20053::tmain()"
}
}
],
"using_namespace": "clanguml::t20053"
}