Updated docs

This commit is contained in:
Bartek Kryza
2023-07-05 22:39:19 +02:00
parent 51e31b4bf7
commit 0fd0d97786
2 changed files with 26 additions and 20 deletions

View File

@@ -61,7 +61,7 @@ diagram should start. Currently, the entry point can only be a method or a free
configuration property, for instance: configuration property, for instance:
```yaml ```yaml
start_from: start_from:
- function: "main(int,char**)" - function: "main(int,const char**)"
``` ```
or or
```yaml ```yaml
@@ -69,23 +69,21 @@ start_from:
- function: "clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *)" - function: "clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *)"
``` ```
The entrypoints must be fully qualified and they must match exactly the string representation of given function or The entrypoints must be fully qualified and they must match exactly the string
method in the `clang-uml` model, which can be frustrating after few attempts. representation of given function or method in the `clang-uml` model.
If not sure, the best way is to put anything in the `function`
property value at first, run the `clang-uml` on the diagram with verbose set to `-vvv` and look in the logs To find the exact function signature run `clang-uml` as follows:
for the relevant function signature. At the end of the diagram generation at this verbosity level, `clang-uml` will
generate a textual representation of all discovered activities relevant for this diagram, for instance if you're looking
_for exact signature of method `translation_unit_visitor::VisitCXXRecordDecl`, look for similar_
output in the logs:
```bash ```bash
[trace] [tid 3842954] [diagram.cc:194] Sequence id=1875210076312968845: clang-uml --print-start-from -n main_sequence | grep main
[trace] [tid 3842954] [diagram.cc:198] Activity id=1875210076312968845, from=clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *):
[trace] [tid 3842954] [diagram.cc:208] Message from=clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *), from_id=1875210076312968845, to=__UNRESOLVABLE_ID__, to_id=0, name=, type=if
[trace] [tid 3842954] [diagram.cc:217] Message from=clanguml::sequence_diagram::visitor::translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *), from_id=1875210076312968845, to=clanguml::sequence_diagram::visitor::translation_unit_visitor::should_include(const clang::TagDecl *), to_id=664596622746486441, name=should_include, type=call
``` ```
Then you just need to copy and paste the signature exactly and rerun `clang-uml`. Command line flag `--print-start-from` will print on stdout all functions
and methods available in the diagram model, and each line of this output
can be directly used as a value of `start_from` option in the config file.
Since that list can be quite large, it's best to filter the output to limit
the number of lines to a subset of possible candidates.
## Grouping free functions by file ## Grouping free functions by file
By default, `clang-uml` will generate a new participant for each call to a free function (not method), which can lead By default, `clang-uml` will generate a new participant for each call to a free function (not method), which can lead

View File

@@ -320,7 +320,8 @@ Hopefully this will be eventually resolved.
In order to generate sequence diagram the `start_from` configuration option must In order to generate sequence diagram the `start_from` configuration option must
have a valid starting point have a valid starting point
for the diagram (e.g. `function`), which must match exactly the function for the diagram (e.g. `function`), which must match exactly the function
signature in the `clang-uml` model. or method signature in the `clang-uml` diagram model.
Look for error in the console output such as: Look for error in the console output such as:
```bash ```bash
@@ -330,11 +331,18 @@ Failed to find participant mynamespace::foo(int) for start_from condition
which means that either you have a typo in the function signature in the which means that either you have a typo in the function signature in the
configuration file, or that the function configuration file, or that the function
was not defined in the translation units you specified in the `glob` patterns was not defined in the translation units you specified in the `glob` patterns
for this diagram. Run again the for this diagram.
`clang-uml` tool with `-vvv` option and look in the console output for any
mentions of the function from To find the exact function signature run `clang-uml` as follows:
which the diagram should start and copy the exact signature into the
configuration file. ```bash
clang-uml -n my_sequence_diagram --print-start-from | grep foo
```
Command line flag `--print-start-from` will print on stdout all functions
and methods available in the diagram model, and each line of this output
can be directly used as a value of `start_from` option in the config file.
### Generated diagram contains several empty control blocks or calls which should not be there ### Generated diagram contains several empty control blocks or calls which should not be there