diff --git a/src/include_diagram/visitor/translation_unit_visitor.cc b/src/include_diagram/visitor/translation_unit_visitor.cc index a062391b..6b42082d 100644 --- a/src/include_diagram/visitor/translation_unit_visitor.cc +++ b/src/include_diagram/visitor/translation_unit_visitor.cc @@ -160,6 +160,10 @@ void translation_unit_visitor::process_source_file(const cppast::cpp_file &file) else source_file.set_type(source_file_t::kHeader); + source_file.set_file( + std::filesystem::absolute(file.name()).lexically_normal().string()); + source_file.set_line(0); + ctx.set_current_file(type_safe::opt_ref(source_file)); } else { diff --git a/tests/t40002/test_case.h b/tests/t40002/test_case.h index 1c53aa4c..3f793053 100644 --- a/tests/t40002/test_case.h +++ b/tests/t40002/test_case.h @@ -48,6 +48,20 @@ TEST_CASE("t40002", "[test-case][package]") REQUIRE_THAT(puml, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); REQUIRE_THAT(puml, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); + REQUIRE_THAT(puml, + HasLink(_A("t40002.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/t40002.cc#L0", + clanguml::util::get_git_commit()), + "t40002.cc")); + + REQUIRE_THAT(puml, + HasLink(_A("lib1.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/lib1/lib1.cc#L0", + clanguml::util::get_git_commit()), + "lib1.cc")); + REQUIRE_THAT(puml, HasLink(_A("lib1.h"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"