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
20 changes: 20 additions & 0 deletions interpreter/CppInterOp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ option(CPPINTEROP_BUILD_TABLEGEN_ONLY "Only build cppinterop-tblgen (for cross-c
#=Set OFF to suppress install() rules and route clangCppInterOp through
# add_llvm_library(... BUILDTREE_ONLY)
option(CPPINTEROP_INSTALL "Generate install rules for CppInterOp" ON)

# OFF to ship the shared library as a single unversioned file, matching
# the Darwin layout: archives that cannot carry symlinks (Python wheels)
# would otherwise materialize the SOVERSION namelink as a second full copy.
option(CPPINTEROP_SHARED_LIBRARY_VERSIONING
"Attach the LLVM SOVERSION and namelink to shared clangCppInterOp" ON)
if(EMSCRIPTEN)
set(CPPINTEROP_EXTRA_WASM_FLAGS "-fwasm-exceptions" CACHE STRING "Extra flags for wasm")
endif()
Expand Down Expand Up @@ -504,6 +510,7 @@ if(CPPINTEROP_INSTALL)

install(DIRECTORY include/
DESTINATION include
COMPONENT cppinterop-headers
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
Expand All @@ -513,12 +520,14 @@ if(CPPINTEROP_INSTALL)

install(DIRECTORY tools/
DESTINATION include/CppInterOp/tools
COMPONENT cppinterop-headers
FILES_MATCHING
PATTERN "*.h"
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION include
COMPONENT cppinterop-headers
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
PATTERN "*.inc"
Expand Down Expand Up @@ -617,6 +626,17 @@ if(NOT EMSCRIPTEN AND NOT CPPINTEROP_TABLEGEN_EXE)
add_subdirectory(utils/TableGen)
endif()
add_subdirectory(lib)

if(CPPINTEROP_INSTALL)
# Installing the headers needs to depend on generating the tablegen'd
# public headers.
add_custom_target(cppinterop-headers DEPENDS CppInterOpTableGen)
if(NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-cppinterop-headers
DEPENDS cppinterop-headers
COMPONENT cppinterop-headers)
endif()
endif()
if (CPPINTEROP_ENABLE_TESTING)
add_subdirectory(unittests)
endif(CPPINTEROP_ENABLE_TESTING)
2 changes: 1 addition & 1 deletion interpreter/CppInterOp/cmake/modules/GoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_SHALLOW FALSE
GIT_TAG fa8438ae6b70c57010177de47a9f13d7041a6328
GIT_TAG v1.18.0
UPDATE_COMMAND ""
${_gtest_configure}
BUILD_COMMAND ${build_cmd}
Expand Down
2 changes: 1 addition & 1 deletion interpreter/CppInterOp/cppinterop-version.tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bdf062f298a20c13c44edacfd55170dbd3ad56ca
7cb23ca494cdaf3d5e6cc57318c4f561abcf1d84
14 changes: 14 additions & 0 deletions interpreter/CppInterOp/etc/lsan-cling.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Two cling interpreter-teardown leaks, fixed in root-project/root#23045;
# suppress until the fixes reach root-project/cling. Applied only to the
# cling+Address row; the clang-repl asan row runs unsuppressed.
#
# 1. deallocate() retains code via FinalizedAlloc::release(), orphaning
# each allocation's DeallocActions vector (eh-frame deregistration,
# new with LLVM 22).
# 2. ShutDown() leaks the frontend through the DisableFree path and hides
# the pointers with llvm::BuryPointer, which only holds 16 pointers;
# destroying a few interpreters per process overflows it.
#
# The allocation stacks are often 2 frames deep (the fast unwinder stops
# at JIT frames), hence the module-level match.
leak:libclangCppInterOp
14 changes: 13 additions & 1 deletion interpreter/CppInterOp/include/CppInterOp/CppInterOpTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,19 @@ enum class AllocType : unsigned char {
NewArr,
Malloc,
Unknown,
CustomAlloc
CustomAlloc,
Null,
OperatorNew,
OperatorNewArr
};

enum class DeallocType : unsigned char {
None,
Delete,
DeleteArr,
Free,
Unknown, // Contradiction, delete x or delete[] x in same func
Opaque // Could not analyze
};

inline QualKind operator|(QualKind a, QualKind b) {
Expand Down
10 changes: 7 additions & 3 deletions interpreter/CppInterOp/lib/CppInterOp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ add_llvm_library(clangCppInterOp
${link_libs}
)

# llvm_add_library() stamps LLVM's VERSION/SOVERSION on shared libraries on
# ELF platforms; unsetting them ships one unversioned file, as on Darwin.
if(NOT CPPINTEROP_SHARED_LIBRARY_VERSIONING)
set_property(TARGET clangCppInterOp PROPERTY VERSION)
set_property(TARGET clangCppInterOp PROPERTY SOVERSION)
endif()

if(EMSCRIPTEN)
if(BUILD_SHARED_LIBS)
# FIXME: When dynamically linking the Emscripten shared library to the
Expand Down Expand Up @@ -275,6 +282,3 @@ string(REPLACE ";" "\;" _VER CPPINTEROP_VERSION)
set_source_files_properties(CppInterOp.cpp PROPERTIES COMPILE_DEFINITIONS
"LLVM_BINARY_DIR=\"${LLVM_BINARY_DIR}\";CPPINTEROP_VERSION=\"${_VAR}\""
)
if(MSVC)
set_source_files_properties(CppInterOp.cpp COMPILE_FLAGS /bigobj)
endif()
Loading
Loading