Added debug_mode config option

This commit is contained in:
Bartek Kryza
2022-12-26 21:47:27 +01:00
parent 1a344f9d8c
commit 887652ed6b
8 changed files with 66 additions and 4 deletions

View File

@@ -124,6 +124,14 @@ public:
template <typename E>
void generate_link(std::ostream &ostr, const E &e) const;
/**
* @brief Print debug information in diagram comments
*
* @param m Diagram element to describe
* @param ostr Output stream
*/
void print_debug(
const common::model::source_location &e, std::ostream &ostr) const;
/**
* @brief Update diagram Jinja context
*
@@ -345,6 +353,14 @@ void generator<C, D>::generate_link(std::ostream &ostr, const E &e) const
ostr << "]]";
}
template <typename C, typename D>
void generator<C, D>::print_debug(
const common::model::source_location &e, std::ostream &ostr) const
{
if (m_config.debug_mode())
ostr << "' " << e.file() << ":" << e.line() << '\n';
}
template <typename DiagramModel, typename DiagramConfig,
typename TranslationUnitVisitor>
class diagram_ast_consumer : public clang::ASTConsumer {