Files
clang-uml/docs/test_cases/t20034.md
2023-10-21 21:58:45 +02:00

18 KiB

t20034 - Test case for rendering all call chains from one activity to another (from_to)

Config

compilation_database_dir: ..
output_directory: diagrams
diagrams:
  t20034_sequence:
    type: sequence
    glob:
      - ../../tests/t20034/t20034.cc
    include:
      namespaces:
        - clanguml::t20034
    using_namespace:
      - clanguml::t20034
    from_to:
      - [function: "clanguml::t20034::D::d2()",
         function: "clanguml::t20034::A::a2()"]

Source code

File t20034.cc

#include <cstdint>

namespace clanguml {
namespace t20034 {
struct A {
    void a1() { }
    void a2() { }
    void a3() { }
};

struct C;

struct B {
    void b1()
    {
        a.a1();
        a.a2();
    }
    void b2() { a.a2(); }
    void b3() { a.a3(); }
    void b4();

    A a;

    C *c;
};

struct C {
    void c1() { b.b1(); }
    void c2() { b.b2(); }
    void c3()
    {
        if (reinterpret_cast<uint64_t>(&b) == 0xbadc0de)
            c3();
        else
            c2();
    }

    void c4() { b.b4(); }

    B b;
};

struct D {
    void d1() { c.c1(); }
    void d2()
    {
        c.c1();
        a.a2();
        c.c2();
        c.c3();
        a.a2();

        c.c4();

        auto l = [this]() { a.a2(); };
        l();
    }
    void d3() { c.c3(); }

    A a;
    C c;
};

void B::b4()
{
    c->c4();
    b2();
}
}
}

Generated PlantUML diagrams

t20034_sequence

Generated Mermaid diagrams

t20034_sequence

Generated JSON models

{
  "diagram_type": "sequence",
  "metadata": {
    "clang_uml_version": "0.4.0-32-g701b2c5",
    "llvm_version": "Ubuntu clang version 16.0.6 (++20230710042027+7cbf1a259152-1~exp1~20230710162048.105)",
    "schema_version": 1
  },
  "name": "t20034_sequence",
  "participants": [
    {
      "id": "272777525372220260",
      "name": "clanguml::t20034::D",
      "source_location": {
        "column": 8,
        "file": "../../tests/t20034/t20034.cc",
        "line": 44,
        "translation_unit": "../../tests/t20034/t20034.cc"
      },
      "type": "class"
    },
    {
      "id": "2153793652884753477",
      "name": "clanguml::t20034::C",
      "source_location": {
        "column": 8,
        "file": "../../tests/t20034/t20034.cc",
        "line": 28,
        "translation_unit": "../../tests/t20034/t20034.cc"
      },
      "type": "class"
    },
    {
      "id": "1214895773389400008",
      "name": "clanguml::t20034::B",
      "source_location": {
        "column": 8,
        "file": "../../tests/t20034/t20034.cc",
        "line": 13,
        "translation_unit": "../../tests/t20034/t20034.cc"
      },
      "type": "class"
    },
    {
      "id": "1029414747563549012",
      "name": "clanguml::t20034::A",
      "source_location": {
        "column": 8,
        "file": "../../tests/t20034/t20034.cc",
        "line": 5,
        "translation_unit": "../../tests/t20034/t20034.cc"
      },
      "type": "class"
    },
    {
      "id": "1441889098721372112",
      "name": "clanguml::t20034::D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18)",
      "source_location": {
        "column": 18,
        "file": "../../tests/t20034/t20034.cc",
        "line": 56,
        "translation_unit": "../../tests/t20034/t20034.cc"
      },
      "type": "class"
    }
  ],
  "sequences": [
    {
      "from_to": {
        "from": {
          "id": 1707514178726476738,
          "location": "clanguml::t20034::D::d2()"
        },
        "to": {
          "id": 1307188853155365430,
          "location": "clanguml::t20034::A::a2()"
        }
      },
      "message_chains": [
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "c2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 50,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "472904899982022039",
                "activity_name": "clanguml::t20034::C::c2()",
                "participant_id": "2153793652884753477"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "472904899982022039",
                "activity_name": "clanguml::t20034::C::c2()",
                "participant_id": "2153793652884753477"
              },
              "name": "b2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 30,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 19,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        },
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 49,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        },
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "operator()()",
              "return_type": "",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 57,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1828095161459098283",
                "activity_name": "clanguml::t20034::D::d2()##(lambda ../../tests/t20034/t20034.cc:56:18)::operator()()",
                "participant_id": "1441889098721372112"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "1828095161459098283",
                "activity_name": "clanguml::t20034::D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18)::operator()()",
                "participant_id": "1441889098721372112"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 29,
                "file": "../../tests/t20034/t20034.cc",
                "line": 56,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        },
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "c4()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 54,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "395720534444062628",
                "activity_name": "clanguml::t20034::C::c4()",
                "participant_id": "2153793652884753477"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "395720534444062628",
                "activity_name": "clanguml::t20034::C::c4()",
                "participant_id": "2153793652884753477"
              },
              "name": "b4()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 39,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1774155279072101253",
                "activity_name": "clanguml::t20034::B::b4()",
                "participant_id": "1214895773389400008"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "1774155279072101253",
                "activity_name": "clanguml::t20034::B::b4()",
                "participant_id": "1214895773389400008"
              },
              "name": "b2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 5,
                "file": "../../tests/t20034/t20034.cc",
                "line": 68,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 19,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        },
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "c1()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 48,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "148530508384958711",
                "activity_name": "clanguml::t20034::C::c1()",
                "participant_id": "2153793652884753477"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "148530508384958711",
                "activity_name": "clanguml::t20034::C::c1()",
                "participant_id": "2153793652884753477"
              },
              "name": "b1()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 29,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "289899516984058785",
                "activity_name": "clanguml::t20034::B::b1()",
                "participant_id": "1214895773389400008"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "289899516984058785",
                "activity_name": "clanguml::t20034::B::b1()",
                "participant_id": "1214895773389400008"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 17,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        },
        {
          "messages": [
            {
              "from": {
                "activity_id": "1707514178726476738",
                "activity_name": "clanguml::t20034::D::d2()",
                "participant_id": "272777525372220260"
              },
              "name": "c3()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 9,
                "file": "../../tests/t20034/t20034.cc",
                "line": 51,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "2116989777037608337",
                "activity_name": "clanguml::t20034::C::c3()",
                "participant_id": "2153793652884753477"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "2116989777037608337",
                "activity_name": "clanguml::t20034::C::c3()",
                "participant_id": "2153793652884753477"
              },
              "name": "c2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 13,
                "file": "../../tests/t20034/t20034.cc",
                "line": 36,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "472904899982022039",
                "activity_name": "clanguml::t20034::C::c2()",
                "participant_id": "2153793652884753477"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "472904899982022039",
                "activity_name": "clanguml::t20034::C::c2()",
                "participant_id": "2153793652884753477"
              },
              "name": "b2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 30,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "type": "message"
            },
            {
              "from": {
                "activity_id": "1034410188120190919",
                "activity_name": "clanguml::t20034::B::b2()",
                "participant_id": "1214895773389400008"
              },
              "name": "a2()",
              "return_type": "void",
              "scope": "normal",
              "source_location": {
                "column": 17,
                "file": "../../tests/t20034/t20034.cc",
                "line": 19,
                "translation_unit": "../../tests/t20034/t20034.cc"
              },
              "to": {
                "activity_id": "1307188853155365430",
                "activity_name": "clanguml::t20034::A::a2()",
                "participant_id": "1029414747563549012"
              },
              "type": "message"
            }
          ]
        }
      ]
    }
  ],
  "using_namespace": "clanguml::t20034"
}