Added sequence diagram model cleanup step to remove empty block statements
This commit is contained in:
@@ -359,6 +359,8 @@ std::unique_ptr<DiagramModel> generate(const common::compilation_database &db,
|
||||
|
||||
diagram->set_complete(true);
|
||||
|
||||
diagram->finalize();
|
||||
|
||||
return diagram;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ void diagram::set_complete(bool complete) { complete_ = complete; }
|
||||
|
||||
bool diagram::complete() const { return complete_; }
|
||||
|
||||
void diagram::finalize() { }
|
||||
|
||||
bool diagram::should_include(const element &e) const
|
||||
{
|
||||
if (filter_.get() == nullptr)
|
||||
|
||||
@@ -124,12 +124,24 @@ public:
|
||||
void set_complete(bool complete);
|
||||
|
||||
/**
|
||||
* Whether the diagram is complete.
|
||||
* @brief Whether the diagram is complete.
|
||||
*
|
||||
* This flag is set to true, when all translation units for this diagram
|
||||
* have been visited.
|
||||
*
|
||||
* @return Diagram completion status.
|
||||
*/
|
||||
bool complete() const;
|
||||
|
||||
/**
|
||||
* @brief Once the diagram is complete, run any final processing.
|
||||
*
|
||||
* This method should be overriden by specific diagram models to do some
|
||||
* final tasks like cleaning up the model (e.g. some filters only work
|
||||
* on completed diagrams).
|
||||
*/
|
||||
virtual void finalize();
|
||||
|
||||
// TODO: refactor to a template method
|
||||
bool should_include(const element &e) const;
|
||||
bool should_include(const namespace_ &ns) const;
|
||||
|
||||
@@ -376,6 +376,7 @@ tvl::value_t callee_filter::match(
|
||||
const diagram &d, const sequence_diagram::model::participant &p) const
|
||||
{
|
||||
using sequence_diagram::model::class_;
|
||||
using sequence_diagram::model::function;
|
||||
using sequence_diagram::model::method;
|
||||
using sequence_diagram::model::participant;
|
||||
|
||||
@@ -391,6 +392,10 @@ tvl::value_t callee_filter::match(
|
||||
|
||||
tvl::value_t res = tvl::any_of(
|
||||
callee_types_.begin(), callee_types_.end(), [&p, is_lambda](auto ct) {
|
||||
auto is_function = [](const participant *p) {
|
||||
return dynamic_cast<const function *>(p) != nullptr;
|
||||
};
|
||||
|
||||
switch (ct) {
|
||||
case config::callee_type::method:
|
||||
return p.type_name() == "method";
|
||||
@@ -401,12 +406,12 @@ tvl::value_t callee_filter::match(
|
||||
return p.type_name() == "method" &&
|
||||
((method &)p).is_assignment();
|
||||
case config::callee_type::operator_:
|
||||
return p.type_name() == "method" && ((method &)p).is_operator();
|
||||
return is_function(&p) && ((function &)p).is_operator();
|
||||
case config::callee_type::defaulted:
|
||||
return p.type_name() == "method" &&
|
||||
((method &)p).is_defaulted();
|
||||
case config::callee_type::static_:
|
||||
return p.type_name() == "method" && ((method &)p).is_static();
|
||||
return is_function(&p) && ((function &)p).is_static();
|
||||
case config::callee_type::function:
|
||||
return p.type_name() == "function";
|
||||
case config::callee_type::function_template:
|
||||
|
||||
Reference in New Issue
Block a user