Merge pull request #98 from bkryza/fix-building-internal-clang-uml-diagrams

Fix building internal clang uml diagrams
This commit is contained in:
Bartek Kryza
2023-02-19 01:39:42 +01:00
committed by GitHub
8 changed files with 36 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ jobs:
- name: Update package database - name: Update package database
run: sudo apt -y update run: sudo apt -y update
- name: Install deps - name: Install deps
run: sudo apt -y install git make gcc-10 g++-10 ccache cmake libyaml-cpp-dev llvm-12 clang-12 libclang-12-dev libclang-cpp12-dev clang-format-12 lcov zlib1g-dev run: sudo apt -y install git make pkg-config gcc-10 g++-10 ccache cmake libyaml-cpp-dev llvm-12 clang-12 libclang-12-dev libclang-cpp12-dev clang-format-12 lcov zlib1g-dev libunwind-dev libdw-dev
- name: Select g++ version - name: Select g++ version
run: | run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10

View File

@@ -14,6 +14,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_VERBOSE_MAKEFILE OFF) set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_FIND_DEBUG_MODE OFF) set(CMAKE_FIND_DEBUG_MODE OFF)
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
# #
# C++ setup # C++ setup
# #
@@ -155,6 +159,17 @@ endif()
link_directories(${LLVM_LIBRARY_DIR} ${YAML_CPP_LIBRARY_DIR}) link_directories(${LLVM_LIBRARY_DIR} ${YAML_CPP_LIBRARY_DIR})
#
# Setup libdw and libunwind
#
if(LINUX AND (CMAKE_BUILD_TYPE MATCHES Debug))
find_package(PkgConfig REQUIRED)
pkg_check_modules(DW REQUIRED IMPORTED_TARGET libdw)
pkg_check_modules(UNWIND REQUIRED IMPORTED_TARGET libunwind)
set(BACKWARD_CPP_LIBRARIES PkgConfig::DW PkgConfig::UNWIND)
set(ENABLE_BACKWARD_CPP -DENABLE_BACKWARD_CPP)
endif()
# #
# Setup thirdparty sources # Setup thirdparty sources
# #

View File

@@ -97,7 +97,7 @@ document_test_cases: test_plantuml
clanguml_diagrams: debug clanguml_diagrams: debug
mkdir -p docs/diagrams mkdir -p docs/diagrams
debug/clang-uml debug/src/clang-uml
plantuml -tsvg -nometadata docs/diagrams/*.puml plantuml -tsvg -nometadata docs/diagrams/*.puml
python3 util/format_svg.py docs/diagrams/*.svg python3 util/format_svg.py docs/diagrams/*.svg

View File

@@ -422,6 +422,7 @@ This project relies on the following great tools:
* [glob](https://github.com/p-ranav/glob) - Unix style path expansion for C++ * [glob](https://github.com/p-ranav/glob) - Unix style path expansion for C++
* [CLI11](https://github.com/CLIUtils/CLI11) - command line parser for C++ * [CLI11](https://github.com/CLIUtils/CLI11) - command line parser for C++
* [inja](https://github.com/pantor/inja) - a template engine for modern C++ * [inja](https://github.com/pantor/inja) - a template engine for modern C++
* [backward-cpp](https://github.com/bombela/backward-cpp) - stack trace pretty printer for C++
## Contributing ## Contributing

View File

@@ -68,7 +68,7 @@ git clone https://github.com/bkryza/clang-uml
cd clang-uml cd clang-uml
# Please note that top level Makefile is just a convenience wrapper for CMake # Please note that top level Makefile is just a convenience wrapper for CMake
make release make release
release/clang-uml --help release/src/clang-uml --help
# To build using a specific installed version of LLVM use: # To build using a specific installed version of LLVM use:
LLVM_VERSION=14 make release LLVM_VERSION=14 make release

View File

@@ -25,7 +25,8 @@ endif(MSVC)
target_compile_features(clang-umllib INTERFACE cxx_std_17) target_compile_features(clang-umllib INTERFACE cxx_std_17)
target_compile_options(clang-umllib PRIVATE target_compile_options(clang-umllib PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field> -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field
-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>) $<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>)
target_compile_definitions(clang-umllib PRIVATE target_compile_definitions(clang-umllib PRIVATE
$<$<CXX_COMPILER_ID:MSVC>: $<$<CXX_COMPILER_ID:MSVC>:
@@ -39,12 +40,16 @@ add_executable(clang-uml ${MAIN_SOURCE_FILE})
target_compile_features(clang-uml PUBLIC cxx_std_17) target_compile_features(clang-uml PUBLIC cxx_std_17)
target_compile_options(clang-uml PRIVATE target_compile_options(clang-uml PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field> -Werror -Wall -Wextra -Wno-unused-parameter -Wno-unused-private-field
-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>) $<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>)
target_compile_definitions(clang-uml PRIVATE
${ENABLE_BACKWARD_CPP})
target_link_libraries(clang-uml target_link_libraries(clang-uml
${YAML_CPP_LIBRARIES} ${YAML_CPP_LIBRARIES}
${LIBTOOLING_LIBS} ${LIBTOOLING_LIBS}
${MSVC_LIBRARIES} ${MSVC_LIBRARIES}
${BACKWARD_CPP_LIBRARIES}
clang-umllib clang-umllib
Threads::Threads) Threads::Threads)

View File

@@ -897,8 +897,12 @@ void translation_unit_visitor::
desugared_atsp = deduced_type->getDeducedType(); desugared_atsp = deduced_type->getDeducedType();
} }
const auto *deduced_record_type = if (desugared_atsp.isNull())
desugared_atsp->getAs<clang::RecordType>(); return;
const auto *deduced_record_type = desugared_atsp->isRecordType()
? desugared_atsp->getAs<clang::RecordType>()
: nullptr;
if (deduced_record_type != nullptr) { if (deduced_record_type != nullptr) {
if (auto *deduced_auto_decl = if (auto *deduced_auto_decl =

View File

@@ -24,7 +24,9 @@
#include "util/util.h" #include "util/util.h"
#include "version.h" #include "version.h"
#ifndef NDEBUG #ifdef ENABLE_BACKWARD_CPP
#define BACKWARD_HAS_DW 1
#define BACKWARD_HAS_LIBUNWIND 1
#include <backward-cpp/backward.hpp> #include <backward-cpp/backward.hpp>
#endif #endif
@@ -40,7 +42,7 @@
#include <iostream> #include <iostream>
#include <util/thread_pool_executor.h> #include <util/thread_pool_executor.h>
#ifndef NDEBUG #ifdef ENABLE_BACKWARD_CPP
namespace backward { namespace backward {
backward::SignalHandling sh; // NOLINT backward::SignalHandling sh; // NOLINT
} // namespace backward } // namespace backward