Minor code cleanup

This commit is contained in:
Bartek Kryza
2022-12-19 23:56:48 +01:00
parent e87b4dccc0
commit 834ead063e
7 changed files with 222 additions and 95 deletions

View File

@@ -35,30 +35,71 @@ using found_relationships_t =
std::vector<std::pair<clanguml::common::model::diagram_element::id_t,
common::model::relationship_t>>;
/**
* @brief Diagram translation unit visitor base class
*
* This class provides common interface for diagram translation unit
* visitors.
*/
class translation_unit_visitor {
public:
/**
* @brief Constructor
*
* @param sm Reference to @link clang::SourceManager instance
* @param config Reference to @link clanguml::config::diagram configuration
* instance
*/
explicit translation_unit_visitor(
clang::SourceManager &sm, const clanguml::config::diagram &config);
/**
* @brief Get clang::SourceManager
* @return Reference to @link clang::SourceManager used by this translation
* unit visitor
*/
clang::SourceManager &source_manager() const;
protected:
/**
* @brief Set source location in diagram element
*
* @param decl Reference to @link clang::Decl
* @param element Reference to element to be updated
*/
void set_source_location(const clang::Decl &decl,
clanguml::common::model::source_location &element);
/**
* @brief Set source location in diagram element
*
* @param expr Reference to @link clang::Expr
* @param element Reference to element to be updated
*/
void set_source_location(const clang::Expr &expr,
clanguml::common::model::source_location &element);
/**
* @brief Set source location in diagram element
*
* @param location Reference to @link clang::SourceLocation
* @param element Reference to element to be updated
*/
void set_source_location(const clang::SourceLocation &location,
clanguml::common::model::source_location &element);
/**
* @brief Set source location in diagram element
*
* @param decl Reference to @link clang::NamedDecl
* @param element Reference to element to be updated
*/
void process_comment(const clang::NamedDecl &decl,
clanguml::common::model::decorated_element &e);
private:
clang::SourceManager &source_manager_;
// Reference to diagram config
const clanguml::config::diagram &config_;
std::unique_ptr<comment::comment_visitor> comment_visitor_;