From d53e4cbef4b0bfa79c4fe02f753d907a48d808bd Mon Sep 17 00:00:00 2001 From: Meow King Date: Sun, 4 Aug 2024 17:53:29 +0800 Subject: [PATCH] test+fix(ci/macos): rename all underscored file names like _types.h to types.h to prevent possible compilation pitfall --- CMakeLists.txt | 18 ++++++++-------- pyproject.toml | 4 ++-- src/llvm/Core.cpp | 4 ++-- src/llvm/Core/enum.cpp | 2 +- src/llvm/Core/globalFunc.cpp | 2 ++ src/llvm/Core/globalFunc.h | 2 -- src/llvm/Core/iterator.cpp | 3 +-- src/llvm/Core/miscClasses.cpp | 4 ++-- src/llvm/Core/type.cpp | 4 ++-- src/llvm/Core/type.h | 4 ++-- src/llvm/Core/utils.h | 2 +- src/llvm/Core/value.cpp | 4 ++-- src/llvm/Utils.cpp | 2 +- src/llvm/{_types.h => types.h} | 21 ++++++++++--------- src/llvm/{_types => types}/PyContext.cpp | 0 src/llvm/{_types => types}/PyContext.h | 4 ++-- src/llvm/{_types => types}/PyLLVMObject.h | 4 ++-- src/llvm/{_types => types}/PyMemoryBuffer.cpp | 0 src/llvm/{_types => types}/PyMemoryBuffer.h | 4 ++-- .../{_types => types}/PyMetadataEntries.cpp | 0 .../{_types => types}/PyMetadataEntries.h | 4 ++-- src/llvm/{_types => types}/PyModule.cpp | 0 src/llvm/{_types => types}/PyModule.h | 4 ++-- .../{_types => types}/PyModuleFlagEntries.cpp | 0 .../{_types => types}/PyModuleFlagEntries.h | 4 ++-- .../{_types => types}/PyModuleProvider.cpp | 0 src/llvm/{_types => types}/PyModuleProvider.h | 4 ++-- .../{_types => types}/PyOperandBundle.cpp | 0 src/llvm/{_types => types}/PyOperandBundle.h | 4 ++-- .../{_types => types}/PyPassManagerBase.cpp | 0 .../{_types => types}/PyPassManagerBase.h | 4 ++-- src/llvm/{_utils.h => utils.h} | 1 + src/llvmpym_ext.cpp | 2 +- 33 files changed, 58 insertions(+), 57 deletions(-) rename src/llvm/{_types.h => types.h} (97%) rename src/llvm/{_types => types}/PyContext.cpp (100%) rename src/llvm/{_types => types}/PyContext.h (92%) rename src/llvm/{_types => types}/PyLLVMObject.h (90%) rename src/llvm/{_types => types}/PyMemoryBuffer.cpp (100%) rename src/llvm/{_types => types}/PyMemoryBuffer.h (91%) rename src/llvm/{_types => types}/PyMetadataEntries.cpp (100%) rename src/llvm/{_types => types}/PyMetadataEntries.h (91%) rename src/llvm/{_types => types}/PyModule.cpp (100%) rename src/llvm/{_types => types}/PyModule.h (91%) rename src/llvm/{_types => types}/PyModuleFlagEntries.cpp (100%) rename src/llvm/{_types => types}/PyModuleFlagEntries.h (90%) rename src/llvm/{_types => types}/PyModuleProvider.cpp (100%) rename src/llvm/{_types => types}/PyModuleProvider.h (89%) rename src/llvm/{_types => types}/PyOperandBundle.cpp (100%) rename src/llvm/{_types => types}/PyOperandBundle.h (90%) rename src/llvm/{_types => types}/PyPassManagerBase.cpp (100%) rename src/llvm/{_types => types}/PyPassManagerBase.h (89%) rename src/llvm/{_utils.h => utils.h} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f2c488..ce8ccbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") include_directories(${CMAKE_SOURCE_DIR}/src/llvm) -include_directories(${CMAKE_SOURCE_DIR}/src/llvm/_types) +include_directories(${CMAKE_SOURCE_DIR}/src/llvm/types) include_directories(${CMAKE_SOURCE_DIR}/src/llvm/Core) include_directories(${LLVM_INCLUDE_DIRS}) @@ -80,14 +80,14 @@ nanobind_add_module( src/llvm/Utils.cpp src/llvm/Support.cpp - src/llvm/_types/PyModule.cpp - src/llvm/_types/PyContext.cpp - src/llvm/_types/PyMetadataEntries.cpp - src/llvm/_types/PyModuleFlagEntries.cpp - src/llvm/_types/PyOperandBundle.cpp - src/llvm/_types/PyPassManagerBase.cpp - src/llvm/_types/PyMemoryBuffer.cpp - src/llvm/_types/PyModuleProvider.cpp + src/llvm/types/PyModule.cpp + src/llvm/types/PyContext.cpp + src/llvm/types/PyMetadataEntries.cpp + src/llvm/types/PyModuleFlagEntries.cpp + src/llvm/types/PyOperandBundle.cpp + src/llvm/types/PyPassManagerBase.cpp + src/llvm/types/PyMemoryBuffer.cpp + src/llvm/types/PyModuleProvider.cpp ${LLVM_INCLUDE_DIRS} ) diff --git a/pyproject.toml b/pyproject.toml index 7c4273d..fd61d3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,10 +48,10 @@ environment = { SKBUILD_CMAKE_ARGS="-DLLVM_DIR=D:/a/llvmpym/llvmpym/llvm-build/l [tool.cibuildwheel.macos.environment] MACOSX_DEPLOYMENT_TARGET = "14.0" -# PATH="/opt/homebrew/opt/llvm/bin:$PATH" +PATH="/opt/homebrew/opt/llvm/bin:$PATH" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib -lunwind" CPPFLAGS="-I/opt/homebrew/opt/llvm/include" -SKBUILD_CMAKE_ARGS="-DLLVM_DIR=/opt/homebrew/opt/llvm/lib/cmake/llvm" +# SKBUILD_CMAKE_ARGS="-DLLVM_DIR=/opt/homebrew/opt/llvm/lib/cmake/llvm" diff --git a/src/llvm/Core.cpp b/src/llvm/Core.cpp index e81e237..f1defdd 100644 --- a/src/llvm/Core.cpp +++ b/src/llvm/Core.cpp @@ -1,6 +1,6 @@ #include "Core.h" -#include "_types.h" -#include "_utils.h" +#include "types.h" +#include "utils.h" #include "Core/utils.h" #include "Core/enum.h" diff --git a/src/llvm/Core/enum.cpp b/src/llvm/Core/enum.cpp index d9eff46..ff3c461 100644 --- a/src/llvm/Core/enum.cpp +++ b/src/llvm/Core/enum.cpp @@ -1,6 +1,6 @@ #include "enum.h" #include -#include "../_types.h" +#include "../types.h" namespace nb = nanobind; diff --git a/src/llvm/Core/globalFunc.cpp b/src/llvm/Core/globalFunc.cpp index e7ced25..f11c2b0 100644 --- a/src/llvm/Core/globalFunc.cpp +++ b/src/llvm/Core/globalFunc.cpp @@ -1,5 +1,7 @@ #include "globalFunc.h" #include +#include +#include "../types.h" namespace nb = nanobind; using namespace nb::literals; diff --git a/src/llvm/Core/globalFunc.h b/src/llvm/Core/globalFunc.h index 476711f..66f2005 100644 --- a/src/llvm/Core/globalFunc.h +++ b/src/llvm/Core/globalFunc.h @@ -2,8 +2,6 @@ #define LLVMPYM_CORE_GLOBALFUNC_H #include -#include -#include "../_types.h" void bindGlobalFunctions(nanobind::module_ &m); diff --git a/src/llvm/Core/iterator.cpp b/src/llvm/Core/iterator.cpp index da6a40e..5efe27e 100644 --- a/src/llvm/Core/iterator.cpp +++ b/src/llvm/Core/iterator.cpp @@ -1,6 +1,5 @@ #include "iterator.h" - -#include "../_types.h" +#include "../types.h" namespace nb = nanobind; using namespace nb::literals; diff --git a/src/llvm/Core/miscClasses.cpp b/src/llvm/Core/miscClasses.cpp index 3b612aa..62c61ba 100644 --- a/src/llvm/Core/miscClasses.cpp +++ b/src/llvm/Core/miscClasses.cpp @@ -6,8 +6,8 @@ #include #include #include -#include "../_types.h" -#include "../_utils.h" +#include "../types.h" +#include "../utils.h" #include "utils.h" namespace nb = nanobind; diff --git a/src/llvm/Core/type.cpp b/src/llvm/Core/type.cpp index fc093bf..2eae1e2 100644 --- a/src/llvm/Core/type.cpp +++ b/src/llvm/Core/type.cpp @@ -6,8 +6,8 @@ #include #include #include -#include "../_types.h" -#include "../_utils.h" +#include "../types.h" +#include "../utils.h" #include "utils.h" namespace nb = nanobind; diff --git a/src/llvm/Core/type.h b/src/llvm/Core/type.h index 6019958..fb5b34f 100644 --- a/src/llvm/Core/type.h +++ b/src/llvm/Core/type.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM_CORE_TYPES_H -#define LLVMPYM_CORE_TYPES_H +#ifndef LLVMPYM_CORE_TYPE_H +#define LLVMPYM_CORE_TYPE_H #include diff --git a/src/llvm/Core/utils.h b/src/llvm/Core/utils.h index 1cadd2b..e2aa069 100644 --- a/src/llvm/Core/utils.h +++ b/src/llvm/Core/utils.h @@ -3,7 +3,7 @@ #include #include -#include "../_types.h" +#include "../types.h" #include #include diff --git a/src/llvm/Core/value.cpp b/src/llvm/Core/value.cpp index 0a667df..b60ff2d 100644 --- a/src/llvm/Core/value.cpp +++ b/src/llvm/Core/value.cpp @@ -6,8 +6,8 @@ #include #include #include -#include "../_types.h" -#include "../_utils.h" +#include "../types.h" +#include "../utils.h" #include "utils.h" namespace nb = nanobind; diff --git a/src/llvm/Utils.cpp b/src/llvm/Utils.cpp index 4ddce90..330eb75 100644 --- a/src/llvm/Utils.cpp +++ b/src/llvm/Utils.cpp @@ -2,7 +2,7 @@ #include #include #include "Utils.h" -#include "_types.h" +#include "types.h" #include "Core/utils.h" namespace nb = nanobind; diff --git a/src/llvm/_types.h b/src/llvm/types.h similarity index 97% rename from src/llvm/_types.h rename to src/llvm/types.h index 8352dab..a3747a9 100644 --- a/src/llvm/_types.h +++ b/src/llvm/types.h @@ -2,6 +2,7 @@ // // ==================================== +// note the flag has extra underscore #ifndef LLVMPYM__TYPES_H #define LLVMPYM__TYPES_H @@ -13,16 +14,16 @@ #include #include -#include "_types/PyModule.h" -#include "_types/PyContext.h" -#include "_types/PyMetadataEntries.h" -#include "_types/PyModuleFlagEntries.h" -#include "_types/PyOperandBundle.h" -#include "_types/PyPassManagerBase.h" -#include "_types/PyMemoryBuffer.h" -#include "_types/PyModuleProvider.h" -#include "_types/PyLLVMObject.h" -#include "_types/PyLLVMObject.h" +#include "types/PyModule.h" +#include "types/PyContext.h" +#include "types/PyMetadataEntries.h" +#include "types/PyModuleFlagEntries.h" +#include "types/PyOperandBundle.h" +#include "types/PyPassManagerBase.h" +#include "types/PyMemoryBuffer.h" +#include "types/PyModuleProvider.h" +#include "types/PyLLVMObject.h" +#include "types/PyLLVMObject.h" #define DEFINE_PY_WRAPPER_CLASS(ClassName, UnderlyingType) \ diff --git a/src/llvm/_types/PyContext.cpp b/src/llvm/types/PyContext.cpp similarity index 100% rename from src/llvm/_types/PyContext.cpp rename to src/llvm/types/PyContext.cpp diff --git a/src/llvm/_types/PyContext.h b/src/llvm/types/PyContext.h similarity index 92% rename from src/llvm/_types/PyContext.h rename to src/llvm/types/PyContext.h index 3501bbc..93778fb 100644 --- a/src/llvm/_types/PyContext.h +++ b/src/llvm/types/PyContext.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYCONTEXT_H -#define LLVMPYM__TYPES_PYCONTEXT_H +#ifndef LLVMPYM_TYPES_PYCONTEXT_H +#define LLVMPYM_TYPES_PYCONTEXT_H #include #include diff --git a/src/llvm/_types/PyLLVMObject.h b/src/llvm/types/PyLLVMObject.h similarity index 90% rename from src/llvm/_types/PyLLVMObject.h rename to src/llvm/types/PyLLVMObject.h index 256eba5..6d1b0ee 100644 --- a/src/llvm/_types/PyLLVMObject.h +++ b/src/llvm/types/PyLLVMObject.h @@ -1,5 +1,5 @@ -#ifndef PYLLVMOBJECT_H -#define PYLLVMOBJECT_H +#ifndef LLVMPYM_TYPES_PYLLVMOBJECT_H +#define LLVMPYM_TYPES_PYLLVMOBJECT_H #include #include diff --git a/src/llvm/_types/PyMemoryBuffer.cpp b/src/llvm/types/PyMemoryBuffer.cpp similarity index 100% rename from src/llvm/_types/PyMemoryBuffer.cpp rename to src/llvm/types/PyMemoryBuffer.cpp diff --git a/src/llvm/_types/PyMemoryBuffer.h b/src/llvm/types/PyMemoryBuffer.h similarity index 91% rename from src/llvm/_types/PyMemoryBuffer.h rename to src/llvm/types/PyMemoryBuffer.h index 54f9c58..93a69ef 100644 --- a/src/llvm/_types/PyMemoryBuffer.h +++ b/src/llvm/types/PyMemoryBuffer.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYMEMORYBUFFER_H -#define LLVMPYM__TYPES_PYMEMORYBUFFER_H +#ifndef LLVMPYM_TYPES_PYMEMORYBUFFER_H +#define LLVMPYM_TYPES_PYMEMORYBUFFER_H #include #include diff --git a/src/llvm/_types/PyMetadataEntries.cpp b/src/llvm/types/PyMetadataEntries.cpp similarity index 100% rename from src/llvm/_types/PyMetadataEntries.cpp rename to src/llvm/types/PyMetadataEntries.cpp diff --git a/src/llvm/_types/PyMetadataEntries.h b/src/llvm/types/PyMetadataEntries.h similarity index 91% rename from src/llvm/_types/PyMetadataEntries.h rename to src/llvm/types/PyMetadataEntries.h index 486d7ea..47dc1c6 100644 --- a/src/llvm/_types/PyMetadataEntries.h +++ b/src/llvm/types/PyMetadataEntries.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYMETADATAENTRIES_H -#define LLVMPYM__TYPES_PYMETADATAENTRIES_H +#ifndef LLVMPYM_TYPES_PYMETADATAENTRIES_H +#define LLVMPYM_TYPES_PYMETADATAENTRIES_H #include #include diff --git a/src/llvm/_types/PyModule.cpp b/src/llvm/types/PyModule.cpp similarity index 100% rename from src/llvm/_types/PyModule.cpp rename to src/llvm/types/PyModule.cpp diff --git a/src/llvm/_types/PyModule.h b/src/llvm/types/PyModule.h similarity index 91% rename from src/llvm/_types/PyModule.h rename to src/llvm/types/PyModule.h index c46e29e..afa52c3 100644 --- a/src/llvm/_types/PyModule.h +++ b/src/llvm/types/PyModule.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYMODULE_H -#define LLVMPYM__TYPES_PYMODULE_H +#ifndef LLVMPYM_TYPES_PYMODULE_H +#define LLVMPYM_TYPES_PYMODULE_H #include #include diff --git a/src/llvm/_types/PyModuleFlagEntries.cpp b/src/llvm/types/PyModuleFlagEntries.cpp similarity index 100% rename from src/llvm/_types/PyModuleFlagEntries.cpp rename to src/llvm/types/PyModuleFlagEntries.cpp diff --git a/src/llvm/_types/PyModuleFlagEntries.h b/src/llvm/types/PyModuleFlagEntries.h similarity index 90% rename from src/llvm/_types/PyModuleFlagEntries.h rename to src/llvm/types/PyModuleFlagEntries.h index 9d20a7d..4ebdd32 100644 --- a/src/llvm/_types/PyModuleFlagEntries.h +++ b/src/llvm/types/PyModuleFlagEntries.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYMODULEFLAGENTRIES_H -#define LLVMPYM__TYPES_PYMODULEFLAGENTRIES_H +#ifndef LLVMPYM_TYPES_PYMODULEFLAGENTRIES_H +#define LLVMPYM_TYPES_PYMODULEFLAGENTRIES_H #include #include diff --git a/src/llvm/_types/PyModuleProvider.cpp b/src/llvm/types/PyModuleProvider.cpp similarity index 100% rename from src/llvm/_types/PyModuleProvider.cpp rename to src/llvm/types/PyModuleProvider.cpp diff --git a/src/llvm/_types/PyModuleProvider.h b/src/llvm/types/PyModuleProvider.h similarity index 89% rename from src/llvm/_types/PyModuleProvider.h rename to src/llvm/types/PyModuleProvider.h index 929050f..1359c71 100644 --- a/src/llvm/_types/PyModuleProvider.h +++ b/src/llvm/types/PyModuleProvider.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYMODULEPROVIDER_H -#define LLVMPYM__TYPES_PYMODULEPROVIDER_H +#ifndef LLVMPYM_TYPES_PYMODULEPROVIDER_H +#define LLVMPYM_TYPES_PYMODULEPROVIDER_H #include #include diff --git a/src/llvm/_types/PyOperandBundle.cpp b/src/llvm/types/PyOperandBundle.cpp similarity index 100% rename from src/llvm/_types/PyOperandBundle.cpp rename to src/llvm/types/PyOperandBundle.cpp diff --git a/src/llvm/_types/PyOperandBundle.h b/src/llvm/types/PyOperandBundle.h similarity index 90% rename from src/llvm/_types/PyOperandBundle.h rename to src/llvm/types/PyOperandBundle.h index 511660d..2c37092 100644 --- a/src/llvm/_types/PyOperandBundle.h +++ b/src/llvm/types/PyOperandBundle.h @@ -1,5 +1,5 @@ -#ifndef PYOPERANDBUNDLE_H -#define PYOPERANDBUNDLE_H +#ifndef LLVMPYM_TYPES_PYOPERANDBUNDLE_H +#define LLVMPYM_TYPES_PYOPERANDBUNDLE_H #include #include diff --git a/src/llvm/_types/PyPassManagerBase.cpp b/src/llvm/types/PyPassManagerBase.cpp similarity index 100% rename from src/llvm/_types/PyPassManagerBase.cpp rename to src/llvm/types/PyPassManagerBase.cpp diff --git a/src/llvm/_types/PyPassManagerBase.h b/src/llvm/types/PyPassManagerBase.h similarity index 89% rename from src/llvm/_types/PyPassManagerBase.h rename to src/llvm/types/PyPassManagerBase.h index ae4fe2b..4d2a7ce 100644 --- a/src/llvm/_types/PyPassManagerBase.h +++ b/src/llvm/types/PyPassManagerBase.h @@ -1,5 +1,5 @@ -#ifndef LLVMPYM__TYPES_PYPASSMANAGERBASE_H -#define LLVMPYM__TYPES_PYPASSMANAGERBASE_H +#ifndef LLVMPYM_TYPES_PYPASSMANAGERBASE_H +#define LLVMPYM_TYPES_PYPASSMANAGERBASE_H #include #include diff --git a/src/llvm/_utils.h b/src/llvm/utils.h similarity index 96% rename from src/llvm/_utils.h rename to src/llvm/utils.h index a68a96f..c76e74c 100644 --- a/src/llvm/_utils.h +++ b/src/llvm/utils.h @@ -1,3 +1,4 @@ +// note the flag has extra underscore #ifndef LLVMPYM__UTILS_H #define LLVMPYM__UTILS_H diff --git a/src/llvmpym_ext.cpp b/src/llvmpym_ext.cpp index e35ddd5..e90f1f7 100644 --- a/src/llvmpym_ext.cpp +++ b/src/llvmpym_ext.cpp @@ -3,7 +3,7 @@ #include "llvm/ErrorHandling.h" #include "llvm/Utils.h" #include "llvm/Support.h" -#include "llvm/_types.h" +#include "llvm/types.h" namespace nb = nanobind; using namespace nb::literals;