Added highlight of calls within condition statements of if/else blocks
This commit is contained in:
@@ -164,6 +164,22 @@ std::string get_source_text(
|
||||
return get_source_text_raw(printable_range, sm);
|
||||
}
|
||||
|
||||
bool is_subexpr_of(const clang::Stmt *parent_stmt, const clang::Stmt *sub_stmt)
|
||||
{
|
||||
if (parent_stmt == nullptr || sub_stmt == nullptr)
|
||||
return false;
|
||||
|
||||
if (parent_stmt == sub_stmt)
|
||||
return true;
|
||||
|
||||
for (const auto *e : parent_stmt->children()) {
|
||||
if (is_subexpr_of(e, sub_stmt))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <> id_t to_id(const std::string &full_name)
|
||||
{
|
||||
return std::hash<std::string>{}(full_name) >> 3;
|
||||
|
||||
@@ -68,6 +68,8 @@ std::string get_source_text_raw(
|
||||
std::string get_source_text(
|
||||
clang::SourceRange range, const clang::SourceManager &sm);
|
||||
|
||||
bool is_subexpr_of(const clang::Stmt *parent_stmt, const clang::Stmt *sub_stmt);
|
||||
|
||||
template <typename T> id_t to_id(const T &declaration);
|
||||
|
||||
template <> id_t to_id(const std::string &full_name);
|
||||
|
||||
@@ -39,6 +39,7 @@ enum class relationship_t {
|
||||
kDependency
|
||||
};
|
||||
|
||||
/// Types of sequence diagram activity elements
|
||||
enum class message_t {
|
||||
kCall,
|
||||
kReturn,
|
||||
@@ -55,6 +56,13 @@ enum class message_t {
|
||||
kNone
|
||||
};
|
||||
|
||||
/// The scope of the call expression represented in the sequence diagram
|
||||
enum class message_scope_t {
|
||||
kNormal, // This is a regular call expression
|
||||
kCondition // This is a call expression from within a control condition
|
||||
// e.g if(a->is_valid()) { ... }
|
||||
};
|
||||
|
||||
std::string to_string(relationship_t r);
|
||||
|
||||
std::string to_string(access_t r);
|
||||
|
||||
Reference in New Issue
Block a user