Fixed building on macos with LLVM 15

This commit is contained in:
Bartek Kryza
2022-12-25 21:30:01 +01:00
parent 87f6616783
commit 07584c8616
12 changed files with 37 additions and 13 deletions

View File

@@ -43,6 +43,15 @@ translation_unit_visitor::include_visitor::include_visitor(
{
}
#if LLVM_VERSION_MAJOR > 14
void translation_unit_visitor::include_visitor::InclusionDirective(
clang::SourceLocation hash_loc, const clang::Token & /*include_tok*/,
clang::StringRef /*file_name*/, bool is_angled,
clang::CharSourceRange /*filename_range*/, clang::Optional<clang::FileEntryRef> file,
clang::StringRef /*search_path*/, clang::StringRef relative_path,
const clang::Module * /*imported*/,
clang::SrcMgr::CharacteristicKind file_type)
#else
void translation_unit_visitor::include_visitor::InclusionDirective(
clang::SourceLocation hash_loc, const clang::Token & /*include_tok*/,
clang::StringRef /*file_name*/, bool is_angled,
@@ -50,6 +59,7 @@ void translation_unit_visitor::include_visitor::InclusionDirective(
clang::StringRef /*search_path*/, clang::StringRef relative_path,
const clang::Module * /*imported*/,
clang::SrcMgr::CharacteristicKind file_type)
#endif
{
using common::model::relationship;
using common::model::source_file;
@@ -66,7 +76,11 @@ void translation_unit_visitor::include_visitor::InclusionDirective(
assert(diagram().get(current_file_id.value()));
#if LLVM_VERSION_MAJOR > 14
auto include_path = std::filesystem::path(file->getDir().getName().str());
#else
auto include_path = std::filesystem::path(file->getDir()->getName().str());
#endif
include_path = include_path / file->getName().str();
include_path = include_path.lexically_normal();

View File

@@ -47,12 +47,21 @@ public:
clanguml::include_diagram::model::diagram &diagram,
const clanguml::config::include_diagram &config);
#if LLVM_VERSION_MAJOR > 14
void InclusionDirective(clang::SourceLocation hash_loc,
const clang::Token &include_tok, clang::StringRef file_name,
bool is_angled, clang::CharSourceRange filename_range,
clang::Optional<clang::FileEntryRef> file, clang::StringRef search_path,
clang::StringRef relative_path, const clang::Module *imported,
clang::SrcMgr::CharacteristicKind file_type) override;
#else
void InclusionDirective(clang::SourceLocation hash_loc,
const clang::Token &include_tok, clang::StringRef file_name,
bool is_angled, clang::CharSourceRange filename_range,
const clang::FileEntry *file, clang::StringRef search_path,
clang::StringRef relative_path, const clang::Module *imported,
clang::SrcMgr::CharacteristicKind file_type) override;
#endif
std::optional<common::id_t> process_internal_header(
const std::filesystem::path &include_path, bool is_system,

View File

@@ -1461,7 +1461,6 @@ void translation_unit_visitor::
const std::string &full_template_specialization_name,
const clang::TemplateDecl *template_decl)
{
auto arg_index = 0U;
for (const auto &arg : template_args) {
const auto argument_kind = arg.getKind();
class_diagram::model::template_parameter argument;
@@ -1490,8 +1489,6 @@ void translation_unit_visitor::
argument, argument.to_string(config().using_namespace(), false));
template_instantiation.add_template(argument);
arg_index++;
}
}