Fixed include diagram visitor
This commit is contained in:
@@ -69,9 +69,15 @@ void translation_unit_visitor::include_visitor::InclusionDirective(
|
||||
include_path = include_path / file->getName().str();
|
||||
include_path = include_path.lexically_normal();
|
||||
|
||||
LOG_DBG("Processing include file {} in file {}", include_path.string(),
|
||||
if (!diagram().should_include(source_file{include_path}) ||
|
||||
visited_.find(include_path.string()) != visited_.end())
|
||||
return;
|
||||
|
||||
LOG_INFO("Processing include file {} in file {}", include_path.string(),
|
||||
current_file.string());
|
||||
|
||||
visited_.emplace(include_path.string());
|
||||
|
||||
auto relative_include_path = include_path;
|
||||
if (config().relative_to) {
|
||||
const std::filesystem::path relative_to{config().relative_to()};
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace clanguml::include_diagram::visitor {
|
||||
@@ -80,6 +81,9 @@ public:
|
||||
|
||||
// Reference to class diagram config
|
||||
const clanguml::config::include_diagram &config_;
|
||||
|
||||
// Keep track of already visited headers and source files
|
||||
std::set<std::string> visited_;
|
||||
};
|
||||
|
||||
translation_unit_visitor(clang::SourceManager &sm,
|
||||
|
||||
Reference in New Issue
Block a user