diff --git a/CMakeLists.txt b/CMakeLists.txt index b886f869..9778c446 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,8 +72,9 @@ if(CXX_BUILD_TESTS) set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz + googletest + URL https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz + URL_HASH SHA256=65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c ) FetchContent_MakeAvailable(googletest) @@ -87,13 +88,15 @@ endif() # FetchContent_Declare( utfcpp - URL https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.5.tar.gz - PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patches/utfcpp.patch + URL https://github.com/nemtrif/utfcpp/archive/refs/tags/v4.0.8.tar.gz + URL_HASH SHA256=f808b26d8c3a59def27fea207182ece77a8930bd121a69f80d328ecf3cfef925 ) FetchContent_MakeAvailable(utfcpp) FetchContent_GetProperties(utfcpp) +set(UTFCPP_INCLUDE_DIRS "${utfcpp_SOURCE_DIR}/source") + # # nlohmann_json # diff --git a/patches/utfcpp.patch b/patches/utfcpp.patch deleted file mode 100644 index 11be0868..00000000 --- a/patches/utfcpp.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f24f9b6..0ad6e6f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -7,15 +7,19 @@ project (utf8cpp - LANGUAGES CXX - DESCRIPTION "C++ portable library for working with utf-8 encoding") - --add_library(${PROJECT_NAME} INTERFACE) -+option(UTFCPP_INSTALL "Generate the install target" OFF) - --include(GNUInstallDirs) -+add_library(${PROJECT_NAME} INTERFACE) - - target_include_directories(utf8cpp INTERFACE - "$" - $ - ) - -+if (UTFCPP_INSTALL) -+ -+include(GNUInstallDirs) -+ - include(CMakePackageConfigHelpers) - write_basic_package_version_file( - "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" -@@ -51,3 +55,6 @@ install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - install(FILES ${PROJECT_SOURCE_DIR}/source/utf8.h DESTINATION include/utf8cpp) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/source/utf8 DESTINATION - include/utf8cpp) -+ -+endif() -+ diff --git a/src/frontend/cxx/frontend.cc b/src/frontend/cxx/frontend.cc index 4ddad0ad..4d0d6294 100644 --- a/src/frontend/cxx/frontend.cc +++ b/src/frontend/cxx/frontend.cc @@ -367,7 +367,7 @@ void Frontend::Private::prepare() { toolchain_ = std::move(windowsToolchain); } - unit_->control()->setMemoryLayout(toolchain_->memoryLayout()); + toolchain_->initMemoryLayout(); } void Frontend::Private::preparePreprocessor() { diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index faeca0f3..94b039ee 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -102,8 +102,8 @@ if (EMSCRIPTEN) target_compile_options(cxx-parser PUBLIC -fno-exceptions) endif() -target_link_libraries(cxx-parser - PUBLIC $ +target_include_directories(cxx-parser PUBLIC + $ ) if (CXX_ENABLE_FLATBUFFERS) diff --git a/src/parser/cxx/preprocessor.cc b/src/parser/cxx/preprocessor.cc index bbac519e..f85f5129 100644 --- a/src/parser/cxx/preprocessor.cc +++ b/src/parser/cxx/preprocessor.cc @@ -2937,6 +2937,8 @@ Preprocessor::Preprocessor(Control* control, Preprocessor::~Preprocessor() = default; +auto Preprocessor::control() const -> Control* { return d->control_; } + auto Preprocessor::diagnosticsClient() const -> DiagnosticsClient* { return d->diagnosticsClient_; } diff --git a/src/parser/cxx/preprocessor.h b/src/parser/cxx/preprocessor.h index e093d9c0..7d06fd1a 100644 --- a/src/parser/cxx/preprocessor.h +++ b/src/parser/cxx/preprocessor.h @@ -56,6 +56,8 @@ class Preprocessor { explicit Preprocessor(Control* control, DiagnosticsClient* diagnosticsClient); ~Preprocessor(); + [[nodiscard]] auto control() const -> Control*; + [[nodiscard]] auto diagnosticsClient() const -> DiagnosticsClient*; [[nodiscard]] auto language() const -> LanguageKind; diff --git a/src/parser/cxx/toolchain.cc b/src/parser/cxx/toolchain.cc index 84587f33..3b0a58c8 100644 --- a/src/parser/cxx/toolchain.cc +++ b/src/parser/cxx/toolchain.cc @@ -21,6 +21,7 @@ #include // cxx +#include #include #include @@ -45,6 +46,10 @@ void Toolchain::defineMacro(const std::string& name, preprocessor_->defineMacro(name, definition); } +void Toolchain::initMemoryLayout() { + preprocessor_->control()->setMemoryLayout(memoryLayout_.get()); +} + void Toolchain::addSystemIncludePath(std::string path) { preprocessor_->addSystemIncludePath(std::move(path)); } diff --git a/src/parser/cxx/toolchain.h b/src/parser/cxx/toolchain.h index aed0fbd9..976f239c 100644 --- a/src/parser/cxx/toolchain.h +++ b/src/parser/cxx/toolchain.h @@ -46,6 +46,7 @@ class Toolchain { void setMemoryLayout(std::unique_ptr memoryLayout); + virtual void initMemoryLayout(); virtual void addSystemIncludePaths() = 0; virtual void addSystemCppIncludePaths() = 0; virtual void addPredefinedMacros() = 0;