Skip to content

Commit 5e275e5

Browse files
committed
Fixed building on macos with LLVM 21 (#415)
1 parent c5311cd commit 5e275e5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: brew update && (brew list cmake || brew install cmake) && brew install llvm@21 ninja yaml-cpp ccache
4141

4242
- name: Build and test
43-
run: CC=/opt/homebrew/opt/llvm@21/bin/clang CXX=/opt/homebrew/opt/llvm@21/bin/clang++ CMAKE_PREFIX=/opt/homebrew/opt/llvm@21/lib/cmake/llvm/ CMAKE_OSX_SYSROOT=macosx CMAKE_GENERATOR=Ninja ENABLE_OBJECTIVE_C_TEST_CASES=ON make test
43+
run: CC=/opt/homebrew/opt/llvm@21/bin/clang CXX=/opt/homebrew/opt/llvm@21/bin/clang++ CMAKE_PREFIX=/opt/homebrew/opt/llvm@21/lib/cmake/llvm/ CMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CMAKE_OSX_SYSROOT=macosx CMAKE_GENERATOR=Ninja ENABLE_OBJECTIVE_C_TEST_CASES=ON make test
4444

4545
- name: Print build version
4646
run: debug/src/clang-uml --version

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ if(LLVM_VERSION_MAJOR GREATER_EQUAL 17)
106106
endif()
107107
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
108108
set(CUSTOM_COMPILE_OPTIONS ${CUSTOM_COMPILE_OPTIONS}
109-
-Wno-unused-private-field)
109+
-Wno-unused-private-field
110+
-D_LIBCPP_INTRODUCED_IN_LLVM_21=0)
110111
if(CMAKE_BUILD_TYPE MATCHES Debug)
111112
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug")
112113
endif()

src/class_diagram/visitor/translation_unit_visitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ bool translation_unit_visitor::find_relationships(const clang::Decl *decl,
18491849
}
18501850
else if (type->getAsCXXRecordDecl() != nullptr) {
18511851
relationships.emplace_back(
1852-
common::to_id(type, decl->getASTContext()), relationship_hint,
1852+
common::to_id(type, type->getAsCXXRecordDecl()->getASTContext()), relationship_hint,
18531853
decl);
18541854
result = true;
18551855
}

0 commit comments

Comments
 (0)