This namespace provides common interfaces for all kinds of diagrams.
The core diagram functionality is divided into 3 groups: visitor, model and generators.
Namespaces | |
namespace | generators |
namespace | jinja |
namespace | model |
namespace | visitor |
Classes | |
class | compilation_database |
Custom compilation database class. More... | |
class | eid_t |
Universal class for representing all kinds of Id's in the diagram model. More... | |
class | optional_ref |
Simple optional reference type. More... | |
struct | or_regex |
Convenience class for configuration options with regex support. More... | |
struct | path_or_regex |
struct | regex |
Wrapper around std::regex, which contains original pattern. More... | |
Typedefs | |
using | compilation_database_ptr = std::unique_ptr< compilation_database > |
template<typename T > | |
using | opt_ref = optional_ref< T > |
template<typename T > | |
using | reference_vector = std::vector< std::reference_wrapper< T > > |
template<typename T > | |
using | reference_set = std::unordered_set< std::reference_wrapper< T > > |
using | string_or_regex = or_regex< std::string > |
using | namespace_or_regex = common::or_regex< common::model::namespace_ > |
Enumerations | |
enum class | generator_type_t { plantuml , json , mermaid , graphml } |
Functions | |
model::access_t | access_specifier_to_access_t (clang::AccessSpecifier access_specifier) |
Convert clang::AccessSpecifier to. | |
model::access_t | access_specifier_to_access_t (clang::ObjCIvarDecl::AccessControl access_specifier) |
model::namespace_ | get_tag_namespace (const clang::TagDecl &declaration) |
model::namespace_ | get_template_namespace (const clang::TemplateDecl &declaration) |
std::string | get_tag_name (const clang::TagDecl &declaration) |
Generate full qualified name for clang::TagDecl instance. | |
std::string | to_string (const clang::ArrayType &array_type, const clang::ASTContext &ctx, bool try_canonical, std::vector< std::string > &dimensions) |
std::string | to_string (const clang::TemplateArgumentLoc &argLoc, const clang::ASTContext &context) |
std::string | to_string (const clang::QualType &type, const clang::ASTContext &ctx, bool try_canonical) |
std::string | to_string (const clang::RecordType &type, const clang::ASTContext &ctx, bool try_canonical) |
std::string | to_string (const clang::TemplateArgument &arg, const clang::ASTContext *ctx) |
std::string | to_string (const clang::TemplateName &templ) |
std::string | to_string (const clang::Expr *expr) |
std::string | to_string (const clang::ValueDecl *val) |
std::string | to_string (const clang::Stmt *stmt) |
std::string | to_string (const clang::FunctionTemplateDecl *decl) |
std::string | to_string (const clang::TypeConstraint *tc) |
std::string | get_source_text_raw (clang::SourceRange range, const clang::SourceManager &sm) |
Get raw text of specific source range. | |
std::string | get_source_text (clang::SourceRange range, const clang::SourceManager &sm) |
Get printable range of text of specific source range. | |
std::tuple< unsigned int, unsigned int, std::string > | extract_template_parameter_index (const std::string &type_parameter) |
Extract template depth and index. | |
void | ensure_lambda_type_is_relative (const config::diagram &config, std::string ¶meter_type) |
bool | is_subexpr_of (const clang::Stmt *parent_stmt, const clang::Stmt *sub_stmt) |
Check if an expression is contained in another expression. | |
template<> | |
eid_t | to_id (const std::string &full_name) |
eid_t | to_id (const clang::QualType &type, const clang::ASTContext &ctx) |
template<> | |
eid_t | to_id (const clang::NamespaceDecl &declaration) |
template<> | |
eid_t | to_id (const clang::RecordDecl &declaration) |
template<> | |
eid_t | to_id (const clang::ObjCCategoryDecl &type) |
template<> | |
eid_t | to_id (const clang::ObjCInterfaceDecl &type) |
template<> | |
eid_t | to_id (const clang::ObjCProtocolDecl &type) |
template<> | |
eid_t | to_id (const clang::EnumDecl &declaration) |
template<> | |
eid_t | to_id (const clang::TagDecl &declaration) |
template<> | |
eid_t | to_id (const clang::CXXRecordDecl &declaration) |
template<> | |
eid_t | to_id (const clang::EnumType &t) |
template<> | |
eid_t | to_id (const std::filesystem::path &file) |
template<> | |
eid_t | to_id (const clang::TemplateArgument &template_argument) |
std::pair< common::model::namespace_, std::string > | split_ns (const std::string &full_name) |
Split qualified name to namespace and name. | |
std::vector< common::model::template_parameter > | parse_unexposed_template_params (const std::string ¶ms, const std::function< std::string(const std::string &)> &ns_resolve, int depth=0) |
Parse unexposed (available as string) template params. | |
bool | is_type_parameter (const std::string &t) |
bool | is_qualifier (const std::string &q) |
bool | is_bracket (const std::string &b) |
bool | is_identifier_character (char c) |
bool | is_identifier (const std::string &t) |
bool | is_keyword (const std::string &t) |
bool | is_qualified_identifier (const std::string &t) |
bool | is_type_token (const std::string &t) |
std::string | format_condition_text (const std::string &condition_text) |
std::string | get_condition_text (clang::SourceManager &sm, clang::IfStmt *stmt) |
std::string | get_condition_text (clang::SourceManager &sm, clang::WhileStmt *stmt) |
std::string | get_condition_text (clang::SourceManager &sm, clang::CXXForRangeStmt *stmt) |
std::string | get_condition_text (clang::SourceManager &sm, clang::ForStmt *stmt) |
std::string | get_condition_text (clang::SourceManager &sm, clang::DoStmt *stmt) |
std::string | get_condition_text (clang::SourceManager &sm, clang::ConditionalOperator *stmt) |
clang::QualType | dereference (clang::QualType type) |
std::pair< clang::QualType, std::deque< common::model::context > > | consume_type_context (clang::QualType type) |
Extract type context and return raw type. | |
std::vector< std::string > | tokenize_unexposed_template_parameter (const std::string &t) |
bool | parse_source_location (const std::string &location_str, std::string &file, unsigned &line, unsigned &column) |
clang::RawComment * | get_expression_raw_comment (const clang::SourceManager &sm, const clang::ASTContext &context, const clang::Stmt *stmt) |
Extract a comment before or next to a statement. | |
clang::RawComment * | get_declaration_raw_comment (const clang::SourceManager &sm, const clang::ASTContext &context, const clang::Decl *decl) |
clang::RawComment * | get_raw_comment (const clang::SourceManager &sm, const clang::ASTContext &context, const clang::SourceRange &source_range) |
bool | is_coroutine (const clang::FunctionDecl &decl) |
bool | is_struct (const clang::NamedDecl *decl) |
bool | has_attr (const clang::FunctionDecl *decl, clang::attr::Kind function_attr) |
std::optional< size_t > | get_array_size (const clang::ArrayType &type) |
void | set_source_location (clang::SourceManager &source_manager, const clang::SourceLocation &location, clanguml::common::model::source_location &element, std::filesystem::path tu_path, std::filesystem::path relative_to_path_) |
const clang::Type * | get_unqualified_type (const clang::TypedefDecl *decl) |
const clang::EnumDecl * | get_typedef_enum_decl (const clang::TypedefDecl *decl) |
template<typename T > | |
std::string | get_qualified_name (const T &declaration) |
Get qualified name of some Clang declaration. | |
template<typename T > | |
eid_t | to_id (const T &declaration) |
template<> | |
eid_t | to_id (const std::string &full_name) |
template<> | |
eid_t | to_id (const clang::NamespaceDecl &declaration) |
template<> | |
eid_t | to_id (const clang::CXXRecordDecl &declaration) |
template<> | |
eid_t | to_id (const clang::RecordDecl &declaration) |
template<> | |
eid_t | to_id (const clang::ObjCCategoryDecl &type) |
template<> | |
eid_t | to_id (const clang::ObjCInterfaceDecl &type) |
template<> | |
eid_t | to_id (const clang::ObjCProtocolDecl &type) |
template<> | |
eid_t | to_id (const clang::EnumDecl &declaration) |
template<> | |
eid_t | to_id (const clang::TagDecl &declaration) |
template<> | |
eid_t | to_id (const clang::EnumType &type) |
template<> | |
eid_t | to_id (const clang::TemplateSpecializationType &type) |
template<> | |
eid_t | to_id (const std::filesystem::path &type) |
template<typename T , typename P , typename F > | |
void | if_dyn_cast (P pointer, F &&func) |
bool | operator== (const eid_t &lhs, const eid_t &rhs) |
bool | operator== (const eid_t &lhs, const uint64_t &v) |
bool | operator!= (const eid_t &lhs, const uint64_t &v) |
bool | operator!= (const eid_t &lhs, const eid_t &rhs) |
bool | operator< (const eid_t &lhs, const eid_t &rhs) |
std::string | to_string (const bool v) |
std::string | to_string (const std::string &s) |
std::string | to_string (const string_or_regex &sr) |
std::string | to_string (const std::filesystem::path &p) |
std::string | to_string (const generator_type_t type) |
YAML::Emitter & | operator<< (YAML::Emitter &out, const string_or_regex &m) |
using clanguml::common::compilation_database_ptr = typedef std::unique_ptr<compilation_database> |
Definition at line 146 of file compilation_database.h.
using clanguml::common::opt_ref = typedef optional_ref<T> |
using clanguml::common::reference_set = typedef std::unordered_set<std::reference_wrapper<T> > |
using clanguml::common::reference_vector = typedef std::vector<std::reference_wrapper<T> > |
using clanguml::common::string_or_regex = typedef or_regex<std::string> |
|
strong |
model::access_t clanguml::common::access_specifier_to_access_t | ( | clang::AccessSpecifier | access_specifier | ) |
Convert clang::AccessSpecifier
to.
access_specifier | Clang member access specifier |
Definition at line 25 of file clang_utils.cc.
model::access_t clanguml::common::access_specifier_to_access_t | ( | clang::ObjCIvarDecl::AccessControl | access_specifier | ) |
Definition at line 46 of file clang_utils.cc.
std::pair< clang::QualType, std::deque< common::model::context > > clanguml::common::consume_type_context | ( | clang::QualType | type | ) |
Extract type context and return raw type.
This function removes the context for a type, for example for: std::string const&
it will return (std::string, [const&])
type | Type to process |
Definition at line 788 of file clang_utils.cc.
clang::QualType clanguml::common::dereference | ( | clang::QualType | type | ) |
Definition at line 771 of file clang_utils.cc.
void clanguml::common::ensure_lambda_type_is_relative | ( | const config::diagram & | config, |
std::string & | parameter_type | ||
) |
Definition at line 414 of file clang_utils.cc.
std::tuple< unsigned int, unsigned int, std::string > clanguml::common::extract_template_parameter_index | ( | const std::string & | type_parameter | ) |
Extract template depth and index.
This function extracts template depth and index values from Clang's type-parameter-
names.
type_parameter | Clang's type parameter string |
Definition at line 395 of file clang_utils.cc.
std::string clanguml::common::format_condition_text | ( | const std::string & | condition_text | ) |
Definition at line 702 of file clang_utils.cc.
std::optional< size_t > clanguml::common::get_array_size | ( | const clang::ArrayType & | type | ) |
If type
is a constant array, return it's number of elements. Otherwise nothing.
type |
Definition at line 1066 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::ConditionalOperator * | stmt | ||
) |
Definition at line 763 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::CXXForRangeStmt * | stmt | ||
) |
Definition at line 740 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::DoStmt * | stmt | ||
) |
Definition at line 756 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::ForStmt * | stmt | ||
) |
Definition at line 748 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::IfStmt * | stmt | ||
) |
Definition at line 724 of file clang_utils.cc.
std::string clanguml::common::get_condition_text | ( | clang::SourceManager & | sm, |
clang::WhileStmt * | stmt | ||
) |
Definition at line 732 of file clang_utils.cc.
clang::RawComment * clanguml::common::get_declaration_raw_comment | ( | const clang::SourceManager & | sm, |
const clang::ASTContext & | context, | ||
const clang::Decl * | decl | ||
) |
Definition at line 1004 of file clang_utils.cc.
clang::RawComment * clanguml::common::get_expression_raw_comment | ( | const clang::SourceManager & | sm, |
const clang::ASTContext & | context, | ||
const clang::Stmt * | stmt | ||
) |
Extract a comment before or next to a statement.
sm | clang::SourceManager reference |
context | clang::ASTContext reference |
stmt | Pointer to the current clang::Stmt |
Definition at line 998 of file clang_utils.cc.
std::string clanguml::common::get_qualified_name | ( | const T & | declaration | ) |
Get qualified name of some Clang declaration.
This template is convenient for getting qualified name of various types of clang declarations.
T | Type of Clang's declaration, e.g. clang::TagDecl |
declaration | Reference to a clang declaration |
Definition at line 71 of file clang_utils.h.
clang::RawComment * clanguml::common::get_raw_comment | ( | const clang::SourceManager & | sm, |
const clang::ASTContext & | context, | ||
const clang::SourceRange & | source_range | ||
) |
Definition at line 1010 of file clang_utils.cc.
std::string clanguml::common::get_source_text | ( | clang::SourceRange | range, |
const clang::SourceManager & | sm | ||
) |
Get printable range of text of specific source range.
range | Source range |
sm | Source manager reference |
Definition at line 382 of file clang_utils.cc.
std::string clanguml::common::get_source_text_raw | ( | clang::SourceRange | range, |
const clang::SourceManager & | sm | ||
) |
Get raw text of specific source range.
range | Source range |
sm | Source manager reference |
Definition at line 374 of file clang_utils.cc.
std::string clanguml::common::get_tag_name | ( | const clang::TagDecl & | declaration | ) |
Generate full qualified name for clang::TagDecl instance.
declaration | Input declaration |
Definition at line 105 of file clang_utils.cc.
model::namespace_ clanguml::common::get_tag_namespace | ( | const clang::TagDecl & | declaration | ) |
Get namespace of a specific clang::TagDecl
declaration | Reference to clang::TagDecl |
Definition at line 67 of file clang_utils.cc.
model::namespace_ clanguml::common::get_template_namespace | ( | const clang::TemplateDecl & | declaration | ) |
Get namespace of a specific clang::TemplateDecl
declaration | Reference to clang::TemplateDecl |
Definition at line 97 of file clang_utils.cc.
const clang::EnumDecl * clanguml::common::get_typedef_enum_decl | ( | const clang::TypedefDecl * | decl | ) |
Get pointer to enum decl in typedef decl
decl | typedef decl |
Definition at line 1147 of file clang_utils.cc.
const clang::Type * clanguml::common::get_unqualified_type | ( | const clang::TypedefDecl * | decl | ) |
Get the unqualified type of typedef decl
decl | typedef decl |
Definition at line 1137 of file clang_utils.cc.
bool clanguml::common::has_attr | ( | const clang::FunctionDecl * | decl, |
clang::attr::Kind | function_attr | ||
) |
Check if function declaration contains specified attributed
decl | Function declaration |
function_attr | Clang function attribute |
Definition at line 1059 of file clang_utils.cc.
void clanguml::common::if_dyn_cast | ( | P | pointer, |
F && | func | ||
) |
Definition at line 241 of file clang_utils.h.
bool clanguml::common::is_bracket | ( | const std::string & | b | ) |
Definition at line 653 of file clang_utils.cc.
bool clanguml::common::is_coroutine | ( | const clang::FunctionDecl & | decl | ) |
Check if function or method declaration is a C++20 coroutine.
decl | Function declaration |
Definition at line 1036 of file clang_utils.cc.
bool clanguml::common::is_identifier | ( | const std::string & | t | ) |
Definition at line 663 of file clang_utils.cc.
bool clanguml::common::is_identifier_character | ( | char | c | ) |
Definition at line 658 of file clang_utils.cc.
bool clanguml::common::is_keyword | ( | const std::string & | t | ) |
Definition at line 669 of file clang_utils.cc.
bool clanguml::common::is_qualified_identifier | ( | const std::string & | t | ) |
Definition at line 688 of file clang_utils.cc.
bool clanguml::common::is_qualifier | ( | const std::string & | q | ) |
Definition at line 648 of file clang_utils.cc.
bool clanguml::common::is_struct | ( | const clang::NamedDecl * | decl | ) |
Check if named declaration is a C++ struct.
decl | Declaration to check |
Definition at line 1042 of file clang_utils.cc.
bool clanguml::common::is_subexpr_of | ( | const clang::Stmt * | parent_stmt, |
const clang::Stmt * | sub_stmt | ||
) |
Check if an expression is contained in another expression.
This method returns true if sub_stmt
is equal to or is contained in the AST subtree of parent_stmt
parent_stmt | Parent statement |
sub_stmt | Sub statement |
Definition at line 448 of file clang_utils.cc.
bool clanguml::common::is_type_parameter | ( | const std::string & | t | ) |
Definition at line 643 of file clang_utils.cc.
bool clanguml::common::is_type_token | ( | const std::string & | t | ) |
Definition at line 696 of file clang_utils.cc.
bool clanguml::common::operator!= | ( | const eid_t & | lhs, |
const uint64_t & | v | ||
) |
YAML::Emitter & clanguml::common::operator<< | ( | YAML::Emitter & | out, |
const string_or_regex & | m | ||
) |
Definition at line 23 of file yaml_emitters.cc.
bool clanguml::common::operator== | ( | const eid_t & | lhs, |
const uint64_t & | v | ||
) |
bool clanguml::common::parse_source_location | ( | const std::string & | location_str, |
std::string & | file, | ||
unsigned & | line, | ||
unsigned & | column | ||
) |
Definition at line 961 of file clang_utils.cc.
std::vector< common::model::template_parameter > clanguml::common::parse_unexposed_template_params | ( | const std::string & | params, |
const std::function< std::string(const std::string &)> & | ns_resolve, | ||
int | depth = 0 |
||
) |
Parse unexposed (available as string) template params.
params | String parameters as provided by Clang |
ns_resolve | Namespace resolver function |
depth | Current depth in the template specification |
Definition at line 551 of file clang_utils.cc.
void clanguml::common::set_source_location | ( | clang::SourceManager & | source_manager, |
const clang::SourceLocation & | location, | ||
clanguml::common::model::source_location & | element, | ||
std::filesystem::path | tu_path, | ||
std::filesystem::path | relative_to_path_ | ||
) |
Definition at line 1077 of file clang_utils.cc.
std::pair< common::model::namespace_, std::string > clanguml::common::split_ns | ( | const std::string & | full_name | ) |
Split qualified name to namespace and name.
full_name | Fully qualified element name |
Definition at line 538 of file clang_utils.cc.
eid_t clanguml::common::to_id | ( | const clang::TemplateArgument & | template_argument | ) |
Definition at line 521 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const bool | v | ) |
std::string clanguml::common::to_string | ( | const clang::ArrayType & | array_type, |
const clang::ASTContext & | ctx, | ||
bool | try_canonical, | ||
std::vector< std::string > & | dimensions | ||
) |
Definition at line 137 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::Expr * | expr | ) |
Definition at line 308 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::FunctionTemplateDecl * | decl | ) |
Definition at line 333 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::QualType & | type, |
const clang::ASTContext & | ctx, | ||
bool | try_canonical | ||
) |
Definition at line 181 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::RecordType & | type, |
const clang::ASTContext & | ctx, | ||
bool | try_canonical | ||
) |
Definition at line 265 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::Stmt * | stmt | ) |
Definition at line 323 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::TemplateArgument & | arg, |
const clang::ASTContext * | ctx | ||
) |
Definition at line 271 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::TemplateArgumentLoc & | argLoc, |
const clang::ASTContext & | context | ||
) |
Definition at line 160 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::TemplateName & | templ | ) |
Definition at line 294 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::TypeConstraint * | tc | ) |
Definition at line 359 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const clang::ValueDecl * | val | ) |
Definition at line 318 of file clang_utils.cc.
std::string clanguml::common::to_string | ( | const generator_type_t | type | ) |
Definition at line 94 of file types.cc.
std::string clanguml::common::to_string | ( | const std::filesystem::path & | p | ) |
std::string clanguml::common::to_string | ( | const std::string & | s | ) |
std::string clanguml::common::to_string | ( | const string_or_regex & | sr | ) |
std::vector< std::string > clanguml::common::tokenize_unexposed_template_parameter | ( | const std::string & | t | ) |
Definition at line 878 of file clang_utils.cc.