Skip to content

Improve formatting, readability and add newlines #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ parsers:
comment:
layout: "reach, diff, flags, tree, files"
behavior: default
require_changes: no
require_changes: no
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ build:
- cmake
- libclang-13-dev
- llvm-13-dev
- llvm-13-tools
- llvm-13-tools
20 changes: 5 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )

include(GNUInstallDirs)
## Define supported version of clang and llvm

set(CLANG_MIN_SUPPORTED 13.0)
set(CLANG_MAX_SUPPORTED "19.1.x")
set(CLANG_VERSION_UPPER_BOUND 20.0.0)
Expand All @@ -78,12 +77,10 @@ include(GNUInstallDirs)
set(LLVM_VERSION_UPPER_BOUND 20.0.0)

## Set Cmake packages search order

set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)

## Search packages HINTS and PATHS

if (DEFINED LLVM_DIR)
set(llvm_search_hints PATHS ${LLVM_DIR} HINTS "${LLVM_DIR}/lib/cmake/llvm" "${LLVM_DIR}/cmake" "${LLVM_CONFIG_EXTRA_PATH_HINTS}")
set(clang_search_hints PATHS ${LLVM_DIR} HINTS "${LLVM_DIR}/lib/cmake/clang" "${LLVM_DIR}/cmake")
Expand All @@ -102,7 +99,6 @@ include(GNUInstallDirs)
endif()

## Find supported LLVM

if (CPPINTEROP_USE_CLING)
message(STATUS "Mode CPPINTEROP_USE_CLING = ON")
find_package(LLVM REQUIRED CONFIG ${llvm_search_hints} NO_DEFAULT_PATH)
Expand Down Expand Up @@ -154,8 +150,7 @@ include(GNUInstallDirs)
message(STATUS "Found supported version: LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

## Find supported LLD only while building for webassembly against emscripten

## Find supported LLD only while building for webassembly against emscripten
if(EMSCRIPTEN)
if (DEFINED LLD_VERSION)
if (LLD_VERSION VERSION_GREATER_EQUAL LLD_VERSION_UPPER_BOUND)
Expand Down Expand Up @@ -194,7 +189,6 @@ if(EMSCRIPTEN)
endif()

## Find supported Clang

if (DEFINED CLANG_VERSION)
if (CLANG_VERSION VERSION_GREATER_EQUAL CLANG_VERSION_UPPER_BOUND)
set(CLANG_VERSION ${CLANG_VERSION_UPPER_BOUND})
Expand Down Expand Up @@ -236,19 +230,18 @@ endif()
set (CMAKE_CXX_STANDARD 17)
endif()
if (CMAKE_CXX_STANDARD LESS 17)
message(fatal "LLVM/CppInterOp requires c++17 or later")
message(fatal "LLVM/CppInterOp requires C++17 or later")
endif()
elseif (CLANG_VERSION_MAJOR GREATER_EQUAL 13)
if (NOT CMAKE_CXX_STANDARD)
set (CMAKE_CXX_STANDARD 14)
endif()
if (CMAKE_CXX_STANDARD LESS 14)
message(fatal "LLVM/CppInterOp requires c++14 or later")
message(fatal "LLVM/CppInterOp requires C++14 or later")
endif()
endif()

## Find supported Cling

if (CPPINTEROP_USE_CLING)
if (NOT Cling_FOUND AND DEFINED Cling_DIR)
find_package(Cling REQUIRED CONFIG ${cling_extra_hints} NO_DEFAULT_PATH)
Expand All @@ -274,8 +267,6 @@ endif()
# For consistency we should set it to the correct value.
set(LLVM_CONFIG_HAS_RTTI NO CACHE BOOL "" FORCE)

## Init

# In case this was a path to a build folder of llvm still try to find AddLLVM
list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")

Expand Down Expand Up @@ -352,7 +343,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
"`CMakeFiles'. Please delete them.")
endif()

# Add appropriate flags for GCC
## Add appropriate flags for GCC
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
if (APPLE OR EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
Expand Down Expand Up @@ -383,7 +374,7 @@ include_directories(BEFORE SYSTEM
${CMAKE_CURRENT_SOURCE_DIR}/include
)

#Removes flag due to issue with Google test download when LLVM_ENABLE_WERROR=On
# Removes flag due to issue with Google test download when LLVM_ENABLE_WERROR=On
string(REPLACE "-Wcovered-switch-default" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

file(STRINGS "VERSION" CPPINTEROP_VERSION)
Expand All @@ -406,7 +397,6 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/CppInterOp/
PATTERN "*.cmake"
)


install(DIRECTORY include/
DESTINATION include
FILES_MATCHING
Expand Down
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py
create_sphinx_target(
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
TARGET_NAME sphinx-cppinterop
)
)
2 changes: 1 addition & 1 deletion docs/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ languages, which can make your applications more powerful and flexible.

- Installation And Usage Guide-:doc:`Installation and usage <InstallationAndUsage>`

- Tutorials-:doc:`Tutorials <tutorials>`
- Tutorials-:doc:`Tutorials <tutorials>`
2 changes: 1 addition & 1 deletion docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ https: //www.boost.org/doc/libs/1_65_1/libs/python/doc/html/reference/index.html
https://bitbucket.org/wlav/cppyy/issues/369/template-instantiation-not-happening-in (Visited August 2021).

[14] Extend clang AST to provide information for the type as written in template instantiations,
https://llvm.org/OpenProjects.html#clang-template-instantiation-sugar (Visited August 2021).
https://llvm.org/OpenProjects.html#clang-template-instantiation-sugar (Visited August 2021).
2 changes: 1 addition & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@ be under the extern C for the compiler to know the C++ code within.


The complete example can found below:
`Example <https://github.com/compiler-research/pldi-tutorials-2023/blob/main/examples/p3-ex4/p3-ex4.c>`_.
`Example <https://github.com/compiler-research/pldi-tutorials-2023/blob/main/examples/p3-ex4/p3-ex4.c>`_.
2 changes: 1 addition & 1 deletion environment-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:
- xeus
- cpp-argparse
- pugixml
- doctest
- doctest
2 changes: 1 addition & 1 deletion include/clang-c/CXCppInterOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ CINDEX_LINKAGE void clang_destruct(CXObject This, CXScope S, bool withFree);
LLVM_CLANG_C_EXTERN_C_END

#endif // LLVM_CLANG_C_CXCPPINTEROP_H
// NOLINTEND()
// NOLINTEND()
2 changes: 1 addition & 1 deletion lib/Interpreter/CXCppInterOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,4 +612,4 @@ void Destruct(compat::Interpreter& interp, TCppObject_t This,

void clang_destruct(CXObject This, CXScope S, bool withFree) {
Cpp::Destruct(*getInterpreter(S), This, getDecl(S), withFree);
}
}
2 changes: 1 addition & 1 deletion lib/Interpreter/exports.ld
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
-Wl,--export=_ZNK5clang17ClassTemplateDecl18getSpecializationsEv
-Wl,--export=_ZNK5clang4Sema15getStdNamespaceEv
-Wl,--export=__clang_Interpreter_SetValueNoAlloc
-Wl,--export=__clang_Interpreter_SetValueWithAlloc
-Wl,--export=__clang_Interpreter_SetValueWithAlloc
2 changes: 1 addition & 1 deletion unittests/CppInterOp/EnumReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,4 @@ TEST(EnumReflectionTest, GetEnums) {
EXPECT_TRUE(std::find(enumNames2.begin(), enumNames2.end(), "Months") != enumNames2.end());
EXPECT_TRUE(std::find(enumNames3.begin(), enumNames3.end(), "Color") != enumNames3.end());
EXPECT_TRUE(enumNames4.empty());
}
}
2 changes: 1 addition & 1 deletion unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,4 +1847,4 @@ TEST(FunctionReflectionTest, UndoTest) {
EXPECT_EQ(ret, 1);
#endif
#endif
}
}
2 changes: 1 addition & 1 deletion unittests/CppInterOp/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ void dispose_string(CXString string) {

CXScope make_scope(const clang::Decl* D, const CXInterpreter I) {
return {CXCursor_UnexposedDecl, 0, {D, nullptr, I}};
}
}
2 changes: 1 addition & 1 deletion unittests/CppInterOp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
}
Loading