545 lines
12 KiB
Markdown
545 lines
12 KiB
Markdown
# t00048 - Test case for unique entity id with multiple translation units
|
|
## Config
|
|
```yaml
|
|
compilation_database_dir: ..
|
|
output_directory: puml
|
|
diagrams:
|
|
t00048_class:
|
|
type: class
|
|
glob:
|
|
- ../../tests/t00048/b_t00048.cc
|
|
- ../../tests/t00048/a_t00048.cc
|
|
- ../../tests/t00048/t00048.cc
|
|
using_namespace: clanguml::t00048
|
|
parse_includes: true
|
|
include:
|
|
namespaces:
|
|
- clanguml::t00048
|
|
```
|
|
## Source code
|
|
File b_t00048.h
|
|
```cpp
|
|
#include "t00048.h"
|
|
|
|
#pragma once
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
|
|
struct B : public Base {
|
|
int b;
|
|
|
|
void foo() override;
|
|
};
|
|
|
|
template <typename T> struct BTemplate : public BaseTemplate<T> {
|
|
T b;
|
|
|
|
void foo() override { }
|
|
};
|
|
|
|
}
|
|
}
|
|
```
|
|
File b_t00048.cc
|
|
```cpp
|
|
#include "b_t00048.h"
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
|
|
void B::foo() { }
|
|
|
|
}
|
|
}
|
|
```
|
|
File t00048.cc
|
|
```cpp
|
|
#include "t00048.h"
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
}
|
|
}
|
|
```
|
|
File a_t00048.h
|
|
```cpp
|
|
#include "t00048.h"
|
|
|
|
#pragma once
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
|
|
struct A : public Base {
|
|
int a;
|
|
|
|
void foo() override;
|
|
};
|
|
|
|
template <typename T> struct ATemplate : public BaseTemplate<T> {
|
|
T a;
|
|
|
|
void foo() override { }
|
|
};
|
|
|
|
}
|
|
}
|
|
```
|
|
File a_t00048.cc
|
|
```cpp
|
|
#include "a_t00048.h"
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
|
|
void A::foo() { }
|
|
|
|
}
|
|
}
|
|
```
|
|
File t00048.h
|
|
```cpp
|
|
#pragma once
|
|
|
|
namespace clanguml {
|
|
namespace t00048 {
|
|
|
|
struct Base {
|
|
int base;
|
|
|
|
virtual void foo() = 0;
|
|
};
|
|
|
|
template <typename T> struct BaseTemplate {
|
|
T base;
|
|
|
|
virtual void foo() = 0;
|
|
};
|
|
|
|
}
|
|
}
|
|
```
|
|
## Generated UML diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "class",
|
|
"elements": [
|
|
{
|
|
"bases": [],
|
|
"display_name": "clanguml::t00048::Base",
|
|
"id": "10200626899013233",
|
|
"is_abstract": true,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "base",
|
|
"source_location": {
|
|
"column": 9,
|
|
"file": "../../tests/t00048/t00048.h",
|
|
"line": 7,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"type": "int"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": true,
|
|
"is_static": false,
|
|
"is_virtual": true,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "Base",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 8,
|
|
"file": "../../tests/t00048/t00048.h",
|
|
"line": 6,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "clanguml::t00048::BaseTemplate<T>",
|
|
"id": "630197772543569536",
|
|
"is_abstract": true,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "base",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "../../tests/t00048/t00048.h",
|
|
"line": 13,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"type": "T"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": true,
|
|
"is_static": false,
|
|
"is_virtual": true,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "BaseTemplate",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 30,
|
|
"file": "../../tests/t00048/t00048.h",
|
|
"line": 12,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [
|
|
{
|
|
"access": "public",
|
|
"id": "10200626899013233",
|
|
"is_virtual": false,
|
|
"name": "clanguml::t00048::Base"
|
|
}
|
|
],
|
|
"display_name": "clanguml::t00048::B",
|
|
"id": "59336049758992190",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "b",
|
|
"source_location": {
|
|
"column": 9,
|
|
"file": "../../tests/t00048/b_t00048.h",
|
|
"line": 9,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"type": "int"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": true,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 8,
|
|
"file": "../../tests/t00048/b_t00048.h",
|
|
"line": 8,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [
|
|
{
|
|
"access": "public",
|
|
"id": "630197772543569536",
|
|
"is_virtual": false,
|
|
"name": "BaseTemplate<T>"
|
|
}
|
|
],
|
|
"display_name": "clanguml::t00048::BTemplate<T>",
|
|
"id": "1635850649347735305",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "b",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "../../tests/t00048/b_t00048.h",
|
|
"line": 15,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"type": "T"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "BTemplate",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 30,
|
|
"file": "../../tests/t00048/b_t00048.h",
|
|
"line": 14,
|
|
"translation_unit": "../../tests/t00048/b_t00048.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [
|
|
{
|
|
"access": "public",
|
|
"id": "10200626899013233",
|
|
"is_virtual": false,
|
|
"name": "clanguml::t00048::Base"
|
|
}
|
|
],
|
|
"display_name": "clanguml::t00048::A",
|
|
"id": "199333691834211223",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "a",
|
|
"source_location": {
|
|
"column": 9,
|
|
"file": "../../tests/t00048/a_t00048.h",
|
|
"line": 9,
|
|
"translation_unit": "../../tests/t00048/a_t00048.cc"
|
|
},
|
|
"type": "int"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": true,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 8,
|
|
"file": "../../tests/t00048/a_t00048.h",
|
|
"line": 8,
|
|
"translation_unit": "../../tests/t00048/a_t00048.cc"
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [
|
|
{
|
|
"access": "public",
|
|
"id": "630197772543569536",
|
|
"is_virtual": false,
|
|
"name": "BaseTemplate<T>"
|
|
}
|
|
],
|
|
"display_name": "clanguml::t00048::ATemplate<T>",
|
|
"id": "1025697108404463905",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": true,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "public",
|
|
"is_static": false,
|
|
"name": "a",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "../../tests/t00048/a_t00048.h",
|
|
"line": 15,
|
|
"translation_unit": "../../tests/t00048/a_t00048.cc"
|
|
},
|
|
"type": "T"
|
|
}
|
|
],
|
|
"methods": [
|
|
{
|
|
"access": "public",
|
|
"is_const": false,
|
|
"is_consteval": false,
|
|
"is_constexpr": false,
|
|
"is_constructor": false,
|
|
"is_copy_assignment": false,
|
|
"is_defaulted": false,
|
|
"is_deleted": false,
|
|
"is_move_assignment": false,
|
|
"is_noexcept": false,
|
|
"is_operator": false,
|
|
"is_pure_virtual": false,
|
|
"is_static": false,
|
|
"is_virtual": false,
|
|
"name": "foo",
|
|
"parameters": [],
|
|
"type": "void"
|
|
}
|
|
],
|
|
"name": "ATemplate",
|
|
"namespace": "clanguml::t00048",
|
|
"source_location": {
|
|
"column": 30,
|
|
"file": "../../tests/t00048/a_t00048.h",
|
|
"line": 14,
|
|
"translation_unit": "../../tests/t00048/a_t00048.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
}
|
|
],
|
|
"metadata": {
|
|
"clang_uml_version": "0.3.7-4-g43cc5cb",
|
|
"llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)",
|
|
"schema_version": 1
|
|
},
|
|
"name": "t00048_class",
|
|
"relationships": [
|
|
{
|
|
"access": "public",
|
|
"destination": "10200626899013233",
|
|
"source": "59336049758992190",
|
|
"type": "extension"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "630197772543569536",
|
|
"source": "1635850649347735305",
|
|
"type": "extension"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "10200626899013233",
|
|
"source": "199333691834211223",
|
|
"type": "extension"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "630197772543569536",
|
|
"source": "1025697108404463905",
|
|
"type": "extension"
|
|
}
|
|
],
|
|
"using_namespace": "clanguml::t00048"
|
|
}
|
|
```
|