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

@@ -12,6 +12,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_FIND_DEBUG_MODE OFF)
if(APPLE)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif(APPLE)
#
# clang-uml custom defines

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++;
}
}

View File

@@ -19,5 +19,6 @@ diagrams:
- inheritance
exclude:
namespaces:
- std
- clanguml::t00039::detail
- clanguml::t00039::ns3::detail

View File

@@ -53,7 +53,7 @@ TEST_CASE("t00049", "[test-case][class]")
// Check if all relationships exist
REQUIRE_THAT(
puml, IsInstantiation(_A("A<T>"), _A("A<std::vector<thestring>>")));
puml, IsInstantiation(_A("A<T>"), _A("A<string_vector>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));

View File

@@ -6,8 +6,7 @@ diagrams:
# Provide the files to parse in order to look
# for #include directives
glob:
- ../../tests/t40001/**/*.cc
- ../../tests/t40001/**/*.h
- ../../tests/t40001/src/t40001.cc
# Render the paths relative to this directory
relative_to: ../../../tests/t40001
# Include also external system headers

View File

@@ -16,7 +16,7 @@
* limitations under the License.
*/
TEST_CASE("t40001", "[test-case][package]")
TEST_CASE("t40001", "[test-case][include]")
{
auto [config, db] = load_config("t40001");

View File

@@ -6,8 +6,9 @@ diagrams:
# Provide the files to parse in order to look
# for #include directives
glob:
- ../../tests/t40002/**/*.cc
- ../../tests/t40002/**/*.h
- ../../tests/t40002/src/t40002.cc
- ../../tests/t40002/src/lib1/lib1.cc
- ../../tests/t40002/src/lib2/lib2.cc
# Render the paths relative to this directory
relative_to: ../../../tests/t40002
include:

View File

@@ -16,7 +16,7 @@
* limitations under the License.
*/
TEST_CASE("t40002", "[test-case][package]")
TEST_CASE("t40002", "[test-case][include]")
{
auto [config, db] = load_config("t40002");

View File

@@ -6,8 +6,8 @@ diagrams:
# Provide the files to parse in order to look
# for #include directives
glob:
- ../../tests/t40003/include/**/*.h
- ../../tests/t40003/src/**/*.cc
- ../../tests/t40003/src/dependants/t1.cc
- ../../tests/t40003/src/dependencies/t2.cc
# Render the paths relative to this directory
relative_to: ../../../tests/t40003
include:

View File

@@ -16,7 +16,7 @@
* limitations under the License.
*/
TEST_CASE("t40003", "[test-case][package]")
TEST_CASE("t40003", "[test-case][include]")
{
auto [config, db] = load_config("t40003");