Merge pull request #177 from bkryza/v0.3.9

v0.3.9
This commit is contained in:
Bartek Kryza
2023-09-02 17:46:29 +02:00
committed by GitHub
12 changed files with 58 additions and 51 deletions

View File

@@ -1,5 +1,6 @@
# CHANGELOG
### 0.3.9
* Added `from_to` and `to` location constraints to sequence diagrams (#154)
* Fixed 'else if' statement generation in sequence diagrams (#81)
* Implemented removal of redundant dependency relationhips (#28)

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = "clang-uml"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 0.3.8
PROJECT_NUMBER = 0.3.9
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -4,7 +4,7 @@
[![Build status](https://github.com/bkryza/clang-uml/actions/workflows/build.yml/badge.svg)](https://github.com/bkryza/clang-uml/actions)
[![Coverage](https://codecov.io/gh/bkryza/clang-uml/branch/master/graph/badge.svg)](https://codecov.io/gh/bkryza/clang-uml)
[![Version](https://img.shields.io/badge/version-0.3.8-blue)](https://github.com/bkryza/clang-uml/releases)
[![Version](https://img.shields.io/badge/version-0.3.9-blue)](https://github.com/bkryza/clang-uml/releases)
[![Version](https://img.shields.io/badge/LLVM-12,13,14,15,16-orange)](https://github.com/bkryza/clang-uml/releases)
[![Doxygen](https://img.shields.io/badge/Docs-Doxygen-gainsboro)](https://clang-uml.github.io)

View File

@@ -30,16 +30,16 @@ sudo apt install clang-uml
```bash
# Fedora 36
wget https://github.com/bkryza/clang-uml/releases/download/0.3.8/clang-uml-0.3.8-1.fc36.x86_64.rpm
sudo dnf install ./clang-uml-0.3.8-1.fc36.x86_64.rpm
wget https://github.com/bkryza/clang-uml/releases/download/0.3.9/clang-uml-0.3.9-1.fc36.x86_64.rpm
sudo dnf install ./clang-uml-0.3.9-1.fc36.x86_64.rpm
# Fedora 37
wget https://github.com/bkryza/clang-uml/releases/download/0.3.8/clang-uml-0.3.8-1.fc37.x86_64.rpm
sudo dnf install ./clang-uml-0.3.8-1.fc37.x86_64.rpm
wget https://github.com/bkryza/clang-uml/releases/download/0.3.9/clang-uml-0.3.9-1.fc37.x86_64.rpm
sudo dnf install ./clang-uml-0.3.9-1.fc37.x86_64.rpm
# Fedora 38
wget https://github.com/bkryza/clang-uml/releases/download/0.3.8/clang-uml-0.3.8-1.fc38.x86_64.rpm
sudo dnf install ./clang-uml-0.3.8-1.fc38.x86_64.rpm
wget https://github.com/bkryza/clang-uml/releases/download/0.3.9/clang-uml-0.3.9-1.fc38.x86_64.rpm
sudo dnf install ./clang-uml-0.3.9-1.fc38.x86_64.rpm
```
#### Conda
@@ -161,7 +161,7 @@ bin\clang-uml.exe --version
```
It should produce something like:
```bash
clang-uml 0.3.8
clang-uml 0.3.9
Copyright (C) 2021-2023 Bartek Kryza <bkryza@gmail.com>
Built against LLVM/Clang libraries version: 15.0.6
Using LLVM/Clang libraries version: clang version 15.0.6 (https://github.com/llvm/llvm-project.git 088f33605d8a61ff519c580a71b1dd57d16a03f8)

View File

@@ -3,7 +3,7 @@
<!-- toc -->
* [Sequence diagram overview](#sequence-diagram-overview)
* [Specifying diagram entry point](#specifying-diagram-entry-point)
* [Specifying diagram location constraints](#specifying-diagram-location-constraints)
* [Grouping free functions by file](#grouping-free-functions-by-file)
* [Lambda expressions in sequence diagrams](#lambda-expressions-in-sequence-diagrams)
* [Customizing participants order](#customizing-participants-order)

View File

@@ -9,6 +9,7 @@
* [Clang produces several warnings during diagram generation](#clang-produces-several-warnings-during-diagram-generation)
* [Cannot generate diagrams from header-only projects](#cannot-generate-diagrams-from-header-only-projects)
* [YAML anchors and aliases are not fully supported](#yaml-anchors-and-aliases-are-not-fully-supported)
* [Schema validation error is thrown, but the configuration file is correct](#schema-validation-error-is-thrown-but-the-configuration-file-is-correct)
* [Class diagrams](#class-diagrams)
* ["fatal error: 'stddef.h' file not found"](#fatal-error-stddefh-file-not-found)
* [How can I generate class diagram of my entire project](#how-can-i-generate-class-diagram-of-my-entire-project)

View File

@@ -41,7 +41,7 @@ types:
tooltip: string
git_t:
branch: string
revision: string
revision: [string, int]
commit: string
toplevel: string
layout_hint_key: !variant

View File

@@ -285,11 +285,11 @@ common::model::diagram_element::id_t diagram::get_from_activity_id(
return from_activity;
}
std::unordered_set<message_chain_t> diagram::get_all_from_to_message_chains(
std::vector<message_chain_t> diagram::get_all_from_to_message_chains(
const common::model::diagram_element::id_t from_activity,
const common::model::diagram_element::id_t to_activity) const
{
std::unordered_set<message_chain_t> message_chains_unique{};
std::vector<message_chain_t> message_chains_unique{};
// Message (call) chains matching the specified from_to condition
std::vector<message_chain_t> message_chains;
@@ -382,15 +382,31 @@ std::unordered_set<message_chain_t> diagram::get_all_from_to_message_chains(
// Reverse the message chains order (they were added starting from
// the destination activity)
for (auto &mc : message_chains)
for (auto &mc : message_chains) {
std::reverse(mc.begin(), mc.end());
std::copy_if(message_chains.begin(), message_chains.end(),
std::inserter(message_chains_unique, message_chains_unique.begin()),
[from_activity](const message_chain_t &mc) {
return !mc.empty() &&
(from_activity == 0 || (mc.front().from() == from_activity));
});
if (mc.empty())
continue;
if (std::find(message_chains_unique.begin(),
message_chains_unique.end(), mc) != message_chains_unique.end())
continue;
if (from_activity == 0 || (mc.front().from() == from_activity)) {
message_chains_unique.push_back(mc);
}
}
LOG_TRACE("Message chains unique", iter++);
int message_chain_index{};
for (const auto &mc : message_chains_unique) {
LOG_TRACE("\t{}: {}", message_chain_index++,
fmt::join(util::map<std::string>(mc,
[](const model::message &m) -> std::string {
return m.message_name();
}),
"->"));
}
return message_chains_unique;
}

View File

@@ -255,7 +255,7 @@ public:
* @param to_activity Target activity for from_to message chain
* @return List of message chains
*/
std::unordered_set<message_chain_t> get_all_from_to_message_chains(
std::vector<message_chain_t> get_all_from_to_message_chains(
common::model::diagram_element::id_t from_activity,
common::model::diagram_element::id_t to_activity) const;

View File

@@ -27,6 +27,14 @@ message::message(
{
}
bool message::operator==(const message &other) const noexcept
{
return from_ == other.from_ && to_ == other.to_ && type_ == other.type_ &&
scope_ == other.scope_ && message_name_ == other.message_name_ &&
return_type_ == other.return_type_ &&
condition_text_ == other.condition_text_;
}
void message::set_type(common::model::message_t t) { type_ = t; }
common::model::message_t message::type() const { return type_; }

View File

@@ -41,6 +41,14 @@ public:
message(common::model::message_t type,
common::model::diagram_element::id_t from);
/**
* @brief Equality operator
*
* @param other Compare this to other message
* @return True, if 2 messages are equal
*/
bool operator==(const message &other) const noexcept;
/**
* @brief Set message type
*
@@ -162,33 +170,3 @@ private:
};
} // namespace clanguml::sequence_diagram::model
namespace std {
template <> struct hash<clanguml::sequence_diagram::model::message> {
std::size_t operator()(
const clanguml::sequence_diagram::model::message &m) const
{
std::size_t seed = clanguml::util::hash_seed(m.from());
seed ^= m.to();
seed += std::hash<std::string>{}(m.full_name(true));
return seed;
}
};
template <>
struct hash<std::vector<clanguml::sequence_diagram::model::message>> {
std::size_t operator()(
const std::vector<clanguml::sequence_diagram::model::message> &msgs)
const
{
std::size_t seed = clanguml::util::hash_seed(msgs.size());
for (const auto &m : msgs) {
seed ^= std::hash<clanguml::sequence_diagram::model::message>{}(m);
}
return seed;
}
};
} // namespace std

View File

@@ -139,9 +139,12 @@ TEST_CASE("t00014", "[test-case][class]")
REQUIRE_THAT(puml,
IsAggregation(_A("R<T>"),
_A("A<float,std::unique_ptr<std::string>>"), "-floatstring"));
#if !defined(__APPLE__)
// TODO(#176)
REQUIRE_THAT(puml, IsDependency(_A("R<T>"), _A("A<char,std::string>")));
REQUIRE_THAT(
puml, IsDependency(_A("R<T>"), _A("A<wchar_t,std::string>")));
#endif
save_puml(
config.output_directory() + "/" + diagram->name + ".puml", puml);