317 lines
8.8 KiB
Markdown
317 lines
8.8 KiB
Markdown
# t20037 - Test case checking if activities in static variable declarations appear only once
|
|
## Config
|
|
```yaml
|
|
compilation_database_dir: ..
|
|
output_directory: diagrams
|
|
diagrams:
|
|
t20037_sequence:
|
|
type: sequence
|
|
glob:
|
|
- ../../tests/t20037/t20037.cc
|
|
include:
|
|
namespaces:
|
|
- clanguml::t20037
|
|
using_namespace:
|
|
- clanguml::t20037
|
|
from:
|
|
- function: "clanguml::t20037::tmain(int,char **)"
|
|
```
|
|
## Source code
|
|
File t20037.cc
|
|
```cpp
|
|
namespace clanguml {
|
|
namespace t20037 {
|
|
|
|
struct A {
|
|
A()
|
|
: a{100}
|
|
{
|
|
}
|
|
|
|
int a;
|
|
};
|
|
|
|
struct B {
|
|
int get() { return b; }
|
|
|
|
int b{100};
|
|
};
|
|
|
|
B initb() { return B{}; }
|
|
|
|
int c() { return 1; }
|
|
|
|
int a()
|
|
{
|
|
static A a;
|
|
static B b = initb();
|
|
|
|
return a.a + b.get() + c();
|
|
}
|
|
|
|
void tmain(int argc, char **argv)
|
|
{
|
|
auto a1 = a();
|
|
auto a2 = a();
|
|
auto a3 = a();
|
|
}
|
|
}
|
|
}
|
|
```
|
|
## Generated PlantUML diagrams
|
|

|
|
## Generated Mermaid diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "sequence",
|
|
"metadata": {
|
|
"clang_uml_version": "0.4.0-2-g4ab0d29",
|
|
"llvm_version": "Ubuntu clang version 16.0.6 (++20230710042027+7cbf1a259152-1~exp1~20230710162048.105)",
|
|
"schema_version": 1
|
|
},
|
|
"name": "t20037_sequence",
|
|
"participants": [
|
|
{
|
|
"id": "1676651465274088148",
|
|
"name": "clanguml::t20037::tmain(int,char **)",
|
|
"source_location": {
|
|
"column": 6,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 31,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "function"
|
|
},
|
|
{
|
|
"id": "150460916850164805",
|
|
"name": "clanguml::t20037::a()",
|
|
"source_location": {
|
|
"column": 5,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 23,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "function"
|
|
},
|
|
{
|
|
"id": "1329920824155530080",
|
|
"name": "clanguml::t20037::A",
|
|
"source_location": {
|
|
"column": 8,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 4,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "class"
|
|
},
|
|
{
|
|
"id": "1303264946914255327",
|
|
"name": "clanguml::t20037::initb()",
|
|
"source_location": {
|
|
"column": 3,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 19,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "function"
|
|
},
|
|
{
|
|
"id": "1746900845528413124",
|
|
"name": "clanguml::t20037::B",
|
|
"source_location": {
|
|
"column": 8,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 13,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "class"
|
|
},
|
|
{
|
|
"id": "1349992361928784583",
|
|
"name": "clanguml::t20037::c()",
|
|
"source_location": {
|
|
"column": 5,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 21,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"type": "function"
|
|
}
|
|
],
|
|
"sequences": [
|
|
{
|
|
"messages": [
|
|
{
|
|
"from": {
|
|
"activity_id": "1676651465274088148",
|
|
"activity_name": "clanguml::t20037::tmain(int,char **)",
|
|
"participant_id": "1676651465274088148",
|
|
"participant_name": "clanguml::t20037::tmain(int,char **)"
|
|
},
|
|
"name": "",
|
|
"return_type": "int",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 15,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 33,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805",
|
|
"participant_name": "clanguml::t20037::a()"
|
|
},
|
|
"name": "A()",
|
|
"return_type": "void",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 14,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 25,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "1135451191676888496",
|
|
"activity_name": "clanguml::t20037::A::A()",
|
|
"participant_id": "1329920824155530080"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805",
|
|
"participant_name": "clanguml::t20037::a()"
|
|
},
|
|
"name": "",
|
|
"return_type": "B",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 18,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 26,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "1303264946914255327",
|
|
"activity_name": "clanguml::t20037::initb()",
|
|
"participant_id": "1303264946914255327"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805",
|
|
"participant_name": "clanguml::t20037::a()"
|
|
},
|
|
"name": "get()",
|
|
"return_type": "int",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 18,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 28,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "107877908217538137",
|
|
"activity_name": "clanguml::t20037::B::get()",
|
|
"participant_id": "1746900845528413124"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805",
|
|
"participant_name": "clanguml::t20037::a()"
|
|
},
|
|
"name": "",
|
|
"return_type": "int",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 28,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 28,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "1349992361928784583",
|
|
"activity_name": "clanguml::t20037::c()",
|
|
"participant_id": "1349992361928784583"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "1676651465274088148",
|
|
"activity_name": "clanguml::t20037::tmain(int,char **)",
|
|
"participant_id": "1676651465274088148",
|
|
"participant_name": "clanguml::t20037::tmain(int,char **)"
|
|
},
|
|
"name": "",
|
|
"return_type": "int",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 15,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 34,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805"
|
|
},
|
|
"type": "message"
|
|
},
|
|
{
|
|
"from": {
|
|
"activity_id": "1676651465274088148",
|
|
"activity_name": "clanguml::t20037::tmain(int,char **)",
|
|
"participant_id": "1676651465274088148",
|
|
"participant_name": "clanguml::t20037::tmain(int,char **)"
|
|
},
|
|
"name": "",
|
|
"return_type": "int",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"column": 15,
|
|
"file": "../../tests/t20037/t20037.cc",
|
|
"line": 35,
|
|
"translation_unit": "../../tests/t20037/t20037.cc"
|
|
},
|
|
"to": {
|
|
"activity_id": "150460916850164805",
|
|
"activity_name": "clanguml::t20037::a()",
|
|
"participant_id": "150460916850164805"
|
|
},
|
|
"type": "message"
|
|
}
|
|
],
|
|
"start_from": {
|
|
"id": 1676651465274088148,
|
|
"location": "clanguml::t20037::tmain(int,char **)"
|
|
}
|
|
}
|
|
],
|
|
"using_namespace": "clanguml::t20037"
|
|
}
|
|
```
|