Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
#
Expand Down
33 changes: 0 additions & 33 deletions patches/utfcpp.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/frontend/cxx/frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void Frontend::Private::prepare() {
toolchain_ = std::move(windowsToolchain);
}

unit_->control()->setMemoryLayout(toolchain_->memoryLayout());
toolchain_->initMemoryLayout();
}

void Frontend::Private::preparePreprocessor() {
Expand Down
4 changes: 2 additions & 2 deletions src/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ if (EMSCRIPTEN)
target_compile_options(cxx-parser PUBLIC -fno-exceptions)
endif()

target_link_libraries(cxx-parser
PUBLIC $<BUILD_INTERFACE:utf8cpp>
target_include_directories(cxx-parser PUBLIC
$<BUILD_INTERFACE:${UTFCPP_INCLUDE_DIRS}>
)

if (CXX_ENABLE_FLATBUFFERS)
Expand Down
2 changes: 2 additions & 0 deletions src/parser/cxx/preprocessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}
Expand Down
2 changes: 2 additions & 0 deletions src/parser/cxx/preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/parser/cxx/toolchain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cxx/toolchain.h>

// cxx
#include <cxx/control.h>
#include <cxx/memory_layout.h>
#include <cxx/preprocessor.h>

Expand All @@ -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));
}
Expand Down
1 change: 1 addition & 0 deletions src/parser/cxx/toolchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Toolchain {

void setMemoryLayout(std::unique_ptr<MemoryLayout> memoryLayout);

virtual void initMemoryLayout();
virtual void addSystemIncludePaths() = 0;
virtual void addSystemCppIncludePaths() = 0;
virtual void addPredefinedMacros() = 0;
Expand Down