31#include <clang/AST/Comment.h>
32#include <clang/AST/Expr.h>
33#include <clang/AST/RawCommentList.h>
34#include <clang/Basic/Module.h>
35#include <clang/Basic/SourceManager.h>
46 std::vector<std::pair<eid_t, common::model::relationship_t>>;
67 clang::SourceManager &sm, DiagramT &
diagram,
const ConfigT &
config)
96 const std::filesystem::path &
tu_path()
const
163 namespace fs = std::filesystem;
169 if (location.isValid()) {
184 LOG_DBG(
"Failed to extract source location for element from {}",
191 fs::path file_path{file};
192 if (!file_path.is_absolute()) {
193 file_path = fs::absolute(file_path);
196 file_path = fs::weakly_canonical(file_path);
198 file = file_path.string();
219 if (
const clang::Module *module = decl.getOwningModule();
221 std::string module_name = module->Name;
222 bool is_private{
false};
223#if LLVM_VERSION_MAJOR < 15
224 is_private = module->Kind ==
225 clang::Module::ModuleKind::PrivateModuleFragment;
227 is_private = module->isPrivateModule();
231 module_name = module->getTopLevelModule()->Name;
239 std::unique_ptr<common::model::template_element> element)
256 auto *comment = decl.getASTContext().getRawCommentForDeclNoCache(&decl);
270 const clang::RawComment *comment, clang::DiagnosticsEngine &de,
273 if (comment ==
nullptr)
284 const auto &[decorators, stripped_comment] =
289 return stripped_comment;
294 return !
config().include_system_headers() &&
296 decl->getSourceRange().getBegin());
316 auto should_include_namespace =
diagram().should_include(
319 const auto decl_file =
322 const auto should_include_decl_file =
325 return should_include_namespace && should_include_decl_file;