diff --git a/README.md b/README.md index bcb1e513..eb1ebd75 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,6 @@ apt install ccache cmake libyaml-cpp-dev clang-12 libclang-12-dev libclang-cpp12 # macos brew install ccache cmake llvm yaml-cpp ``` -> Please note that on macos this tool is not fully functional, i.e. several test cases fail. The build instructions are -> provided for development purposes only. Then proceed with building the sources: @@ -79,12 +77,17 @@ make release release/clang-uml --help # To build using a specific installed version of LLVM use: -LLVM_VERSION=13 make release +LLVM_VERSION=14 make release # Optionally make install # or export PATH=$PATH:$PWD/release + +# On macos, it is necessary to build clang-uml using the same llvm against which it is linked, e.g. +export CC=/usr/local/opt/llvm/bin/clang +export CCX=/usr/local/opt/llvm/bin/clang++ +LLVM_VERSION=14 make release ``` ## Usage diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index ed3ead59..46a4acdf 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -133,6 +133,9 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm) if (enm->getNameAsString().empty()) return true; + if (!diagram().should_include(enm->getQualifiedNameAsString())) + return true; + LOG_DBG("= Visiting enum declaration {} at {}", enm->getQualifiedNameAsString(), enm->getLocation().printToString(source_manager_)); @@ -304,6 +307,9 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) if (source_manager_.isInSystemHeader(cls->getSourceRange().getBegin())) return true; + if (!diagram().should_include(cls->getQualifiedNameAsString())) + return true; + LOG_DBG("= Visiting class declaration {} at {}", cls->getQualifiedNameAsString(), cls->getLocation().printToString(source_manager_)); diff --git a/src/config/config.cc b/src/config/config.cc index 121e9eaa..154fd692 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -154,6 +154,12 @@ void class_diagram::initialize_template_aliases() if (!template_aliases().count("std::basic_string")) { template_aliases().insert({"std::basic_string", "std::string"}); } + if (!template_aliases().count("std::basic_string,std::allocator>")) { + template_aliases().insert({"std::basic_string,std::allocator>", + "std::string"}); + } if (!template_aliases().count("std::basic_string")) { template_aliases().insert( {"std::basic_string", "std::wstring"}); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7de8841c..21167c13 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,6 +7,10 @@ set(CMAKE_CXX_STANDARD 17) set(TEST_DISABLE_WARNINGS "-Wno-unused-parameter -Wno-unused-private-field -Wno-unused-variable -Wno-attributes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCLANG_CXXFLAGS} ${TEST_DISABLE_WARNINGS}") +if(APPLE) + # Without this, clang-uml test cases fail with error saying that clang cannot find stdarg.h + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${LLVM_LIBRARY_DIR}/clang/${LLVM_PACKAGE_VERSION}/include") +endif(APPLE) file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc) file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml) diff --git a/tests/t00039/.clang-uml b/tests/t00039/.clang-uml index 8474b0ac..c949af75 100644 --- a/tests/t00039/.clang-uml +++ b/tests/t00039/.clang-uml @@ -16,4 +16,7 @@ diagrams: - clanguml::t00039::E - clanguml::t00039::ns3::F relationships: - - inheritance \ No newline at end of file + - inheritance + exclude: + namespaces: + - std \ No newline at end of file diff --git a/tests/t00042/.clang-uml b/tests/t00042/.clang-uml index 2f94a9ac..c15333de 100644 --- a/tests/t00042/.clang-uml +++ b/tests/t00042/.clang-uml @@ -16,4 +16,6 @@ diagrams: - instantiation exclude: specializations: - - clanguml::t00042::C \ No newline at end of file + - clanguml::t00042::C + namespaces: + - std \ No newline at end of file diff --git a/tests/t00048/test_case.h b/tests/t00048/test_case.h index 4aabe0ff..e522af7a 100644 --- a/tests/t00048/test_case.h +++ b/tests/t00048/test_case.h @@ -48,7 +48,6 @@ TEST_CASE("t00048", "[test-case][class]") REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A"))); REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B"))); - save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } \ No newline at end of file