mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
5740f93ef4
GC-allocated objects should never have JS::SafeFunction/JS::Handle fields. For now the plugin only emits warnings here, as there are many cases of this occurring in the codebase that aren't trivial to fix. It is also behind a CMake flag since it is a _very_ loud warning.
28 lines
1.3 KiB
CMake
28 lines
1.3 KiB
CMake
include(clang_development)
|
|
|
|
function(clang_plugin target_name)
|
|
cmake_parse_arguments(CLANG_PLUGIN "" "" "SOURCES" ${ARGN})
|
|
add_library(${target_name} ${CLANG_PLUGIN_SOURCES})
|
|
target_include_directories(${target_name} SYSTEM PRIVATE ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
|
|
target_compile_features(${target_name} PRIVATE cxx_std_20)
|
|
target_compile_options(${target_name} PRIVATE -Wall -Wextra -Werror -Wno-unused -fno-rtti)
|
|
|
|
add_custom_target(${target_name}Target DEPENDS ${target_name})
|
|
|
|
set_property(GLOBAL APPEND PROPERTY CLANG_PLUGINS_COMPILE_OPTIONS_FOR_TESTS -fplugin=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/lib${target_name}.so)
|
|
|
|
add_lagom_library_install_rules(${target_name})
|
|
endfunction()
|
|
|
|
function(depend_on_clang_plugin target_name plugin_name)
|
|
if (TARGET ${plugin_name}Target)
|
|
add_dependencies(${target_name} ${plugin_name}Target)
|
|
endif()
|
|
target_compile_options(${target_name} INTERFACE -fplugin=$<TARGET_FILE:Lagom::${plugin_name}>)
|
|
if (${ENABLE_CLANG_PLUGINS_INVALID_FUNCTION_MEMBERS})
|
|
target_compile_options(${target_name} INTERFACE -fplugin-arg-libjs_gc_scanner-detect-invalid-function-members)
|
|
endif()
|
|
endfunction()
|
|
|
|
clang_plugin(LambdaCaptureClangPlugin SOURCES LambdaCapturePluginAction.cpp)
|
|
clang_plugin(LibJSGCClangPlugin SOURCES LibJSGCPluginAction.cpp)
|