diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f0ce80a..0dd72aca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,9 @@ set(UML_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/uml) option(LLVM_CONFIG_PATH "Path to custom llvm-config executable") if(LLVM_CONFIG_PATH) + message(STATUS "Using llvm-config from ${LLVM_CONFIG_PATH}") set(LIBCLANG_LLVM_CONFIG_EXECUTABLE ${LLVM_CONFIG_PATH}) + set(LLVM_CONFIG_BINARY ${LLVM_CONFIG_PATH}) endif(LLVM_CONFIG_PATH) message(STATUS "Checking for fmt...") diff --git a/README.md b/README.md index 795c3283..d85fb2e1 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ release/clang-uml --help # To build using a specific installed version of LLVM use: LLVM_CONFIG_PATH=/usr/bin/llvm-config-13 make release +# To build on macos, it is necessary to provide also path to LLVM cmake directory, e.g.: +export LLVM_PREFIX="/usr/local/Cellar/llvm@12/12.0.1_1" +LLVM_CONFIG_PATH="${LLVM_PREFIX}/bin/llvm-config" CMAKE_PREFIX_PATH="${LLVM_PREFIX}/lib/cmake/llvm/" make test + # Optionally make install # or diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 4fc7ce58..e4d41c67 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -728,10 +728,8 @@ void translation_unit_visitor::process_field( auto tr_declaration = cppast::to_string(tr); -#ifndef __APPLE__ LOG_DBG("Processing field {} with unreferenced type of kind {}", mv.name(), - tr.kind()); -#endif + cx::to_string(tr.kind())); if (tr.kind() == cppast::cpp_type_kind::builtin_t) { LOG_DBG("Builtin type found for field: {}", m.name()); @@ -1214,10 +1212,8 @@ bool translation_unit_visitor::find_relationships(const cppast::cpp_type &t_, const auto fn = cx::util::full_name(cppast::remove_cv(t_), ctx.entity_index(), false); -#ifndef __APPLE__ LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_), - t_.kind(), fn); -#endif + cx::to_string(t_.kind()), fn); relationship_t relationship_type = relationship_hint; const auto &t = cppast::remove_cv(cx::util::unreferenced(t_)); diff --git a/src/common/model/package.h b/src/common/model/package.h index 46325c79..8202b4c2 100644 --- a/src/common/model/package.h +++ b/src/common/model/package.h @@ -40,7 +40,7 @@ public: package(const package &) = delete; package(package &&) = default; package &operator=(const package &) = delete; - package &operator=(package &&) = default; + package &operator=(package &&) = delete; std::string full_name(bool relative) const override; diff --git a/src/cx/util.cc b/src/cx/util.cc index 7c780a6a..67c7ddcc 100644 --- a/src/cx/util.cc +++ b/src/cx/util.cc @@ -38,6 +38,47 @@ std::string to_string(CXString &&cxs) return r; } +std::string to_string(cppast::cpp_type_kind t) +{ + using namespace cppast; + switch (t) { + case cpp_type_kind::builtin_t: + return "builtin"; + case cpp_type_kind::user_defined_t: + return "user_defined"; + case cpp_type_kind::auto_t: + return "auto"; + case cpp_type_kind::decltype_t: + return "decltype"; + case cpp_type_kind::decltype_auto_t: + return "decltype_auto"; + case cpp_type_kind::cv_qualified_t: + return "cv_qualified"; + case cpp_type_kind::pointer_t: + return "pointer"; + case cpp_type_kind::reference_t: + return "reference"; + case cpp_type_kind::array_t: + return "array"; + case cpp_type_kind::function_t: + return "function"; + case cpp_type_kind::member_function_t: + return "member_function"; + case cpp_type_kind::member_object_t: + return "member_object"; + case cpp_type_kind::template_parameter_t: + return "template_parameter"; + case cpp_type_kind::template_instantiation_t: + return "template_instantiation"; + case cpp_type_kind::dependent_t: + return "dependent"; + case cpp_type_kind::unexposed_t: + return "unexposed"; + default: + return "invalid"; + } +} + std::string full_name( const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e) { diff --git a/src/cx/util.h b/src/cx/util.h index 139d1490..182c8486 100644 --- a/src/cx/util.h +++ b/src/cx/util.h @@ -42,6 +42,8 @@ namespace util { */ std::string to_string(CXString &&cxs); +std::string to_string(cppast::cpp_type_kind t); + std::string full_name( const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e); diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index 043729cc..f3c61e6b 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -379,10 +379,8 @@ bool translation_unit_visitor::find_relationships(const cppast::cpp_type &t_, const auto fn_ns = cx::util::ns(cppast::remove_cv(t_), ctx.entity_index()); -#ifndef __APPLE__ LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_), - t_.kind(), fn); -#endif + cx::to_string(t_.kind()), fn); relationship_t relationship_type = relationship_hint; const auto &t = cppast::remove_cv(cx::util::unreferenced(t_));