diff --git a/.gitignore b/.gitignore index 4db740d6e9..c2533d44c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ working */archives -.vscode \ No newline at end of file +.vscode +**/gafferBuild +llvm*/build-release +qt*/**/*.qm +c-blosc*/** +qt-adsk-*/** diff --git a/Alembic/config.py b/Alembic/config.py index a30f749264..ce7e13cc75 100644 --- a/Alembic/config.py +++ b/Alembic/config.py @@ -38,19 +38,50 @@ "manifest" : [ - "bin/abcconvert", - "bin/abcecho", - "bin/abcechobounds", - "bin/abcls", - "bin/abcstitcher", - "bin/abctree", + "bin/abcconvert{executableExtension}", + "bin/abcecho{executableExtension}", + "bin/abcechobounds{executableExtension}", + "bin/abcls{executableExtension}", + "bin/abcstitcher{executableExtension}", + "bin/abctree{executableExtension}", "include/Alembic", - "lib/libAlembic*", + "lib/{libraryPrefix}Alembic*", + "lib/{libraryPrefix}Alembic*.lib", "python/alembic*", ], + "platform:windows" : { + + "commands" : [ + + "cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D HDF5_ROOT={buildDir}" + " -D USE_STATIC_HDF5=ON" + " -D ILMBASE_ROOT={buildDir}" + " -D USE_TESTS=OFF" + " -D USE_HDF5=ON" + " -D USE_PYALEMBIC=OFF" + " -D USE_ARNOLD=OFF" + " -D USE_PRMAN=OFF" + " -D USE_MAYA=OFF" + " -D ALEMBIC_ILMBASE_HALF_LIB={buildDir}\\lib\\half.lib" + " -D ALEMBIC_ILMBASE_IEX_LIB={buildDir}\\lib\\Iex.lib" + " -D ALEMBIC_ILMBASE_IEXMATH_LIB={buildDir}\\lib\\IexMath.lib" + " -D ALEMBIC_ILMBASE_ILMTHREAD_LIB={buildDir}\\lib\\IlmThread.lib" + " -D ALEMBIC_ILMBASE_IMATH_LIB={buildDir}\\lib\\Imath.lib" + " .", + "cmake --build . --config {cmakeBuildType} --target install" + + ], + + }, + } diff --git a/Appleseed/config.py b/Appleseed/config.py index 24f6f1f279..7227b5b7b1 100644 --- a/Appleseed/config.py +++ b/Appleseed/config.py @@ -2,7 +2,7 @@ "downloads" : [ - "https://github.com/appleseedhq/appleseed/archive/2.1.0-beta.tar.gz" + "https://github.com/appleseedhq/appleseed/archive/2.0.5-beta.tar.gz" ], @@ -57,7 +57,7 @@ " -D BOOST_ROOT={buildDir}" " -D Boost_NO_SYSTEM_PATHS=ON" " ..", - + "cd build && make install -j {jobs} VERBOSE=1" ], @@ -105,6 +105,76 @@ "appleseed/shaders", ], + "platform:windows" : { + + "enabled" : False, + + "variables" : { + "cmakeGenerator" : "\"Visual Studio 16 2019\"", + }, + + "environment" : { + + "PATH" : "%PATH%;{buildDir}\\lib;{buildDir}\\bin", + + }, + + "commands" : [ + "if not exist \"build\" mkdir build", + "cd build &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D PYTHON_LIBRARY={pythonLibDir}\\python{pythonMajorVersion}{pythonMinorVersion}.lib" + " -D PYTHON_INCLUDE_DIR={pythonIncludeDir}" + " -D WITH_OSL=ON" + " -D WITH_CLI=ON" + " -D WITH_STUDIO=OFF" + " -D WITH_TOOLS=OFF" + " -D WITH_PYTHON=ON" + " -D WITH_PYTHON2_BINDINGS=OFF" + " -D WITH_PYTHON3_BINDINGS=ON" + " -D PYTHON3_INCLUDE_DIR={pythonIncludeDir}" + " -D PYTHON_MAJOR_VERSION={pythonMajorVersion}" + " -D PYTHON_MINOR_VERSION={pythonMinorVersion}" + " -D Boost_PYTHON3_LIBRARY={buildDir}/lib/boost_python{pythonMajorVersion}{pythonMinorVersion}{sharedLibraryExtension}" + " -D WITH_OSL=ON" + " -D WITH_TESTS=OFF" + " -D USE_STATIC_BOOST=OFF" + " -D USE_STATIC_OIIO=OFF" + " -D USE_STATIC_EXR=OFF" + " -D USE_STATIC_OSL=OFF" + " -D USE_EXTERNAL_ZLIB=ON" + " -D USE_EXTERNAL_EXR=ON" + " -D USE_EXTERNAL_PNG=ON" + " -D USE_EXTERNAL_XERCES=ON" + " -D USE_EXTERNAL_OSL=ON" + " -D USE_EXTERNAL_OIIO=ON" + " -D USE_EXTERNAL_ALEMBIC=ON" + " -D WARNINGS_AS_ERRORS=OFF" + " -D USE_SSE=ON" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D CMAKE_INSTALL_PREFIX={buildDir}\\appleseed" + " -D BOOST_ROOT={buildDir}" + " -D IMATH_INCLUDE_DIRS={buildDir}\\include" + " -D IMATH_HALF_LIBRARY={buildDir}\\lib\\Half.lib" + " -D IMATH_IEX_LIBRARY={buildDir}\\lib\\Iex.lib" + " -D IMATH_MATH_LIBRARY={buildDir}\\lib\\Imath.lib" + " -D OPENEXR_INCLUDE_DIRS={buildDir}\\include" + " -D OPENEXR_IMF_LIBRARY={buildDir}\\lib\\IlmImf.lib" + " -D OPENEXR_THREADS_LIBRARY={buildDir}\\lib\\IlmThread.lib" + " -D XERCES_LIBRARY={buildDir}\\lib\\xerces-c_3.lib" + " -D OSL_INCLUDE_DIR={buildDir}\\include" + " -D LLVM_LIBS_DIR={buildDir}\\lib" + " OSL_EXEC_LIBRARY={buildDir}\\lib\\oslexec.lib" + " OSL_COMP_LIBRARY={buildDir}\\lib\\oslcomp.lib" + " OSL_QUERY_LIBRARY={buildDir}\\lib\\oslquery.lib" + " ..", + "cd build && cmake --build . --config {cmakeBuildType} --target install", + ] + + }, "platform:linux" : { diff --git a/Appleseed/patches/windows/0001-remove_boost_namespace.patch b/Appleseed/patches/windows/0001-remove_boost_namespace.patch new file mode 100644 index 0000000000..9119ff1a7d --- /dev/null +++ b/Appleseed/patches/windows/0001-remove_boost_namespace.patch @@ -0,0 +1,10 @@ +--- a/src/appleseed/renderer/meta/tests/test_tracer.cpp 2020-05-14 18:34:13.413540600 -0400 ++++ b/src/appleseed/renderer/meta/tests/test_tracer.cpp 2020-05-14 18:32:10.040808300 -0400 +@@ -83,7 +83,6 @@ + + using namespace foundation; + using namespace renderer; +-using namespace boost; + using namespace std; + + TEST_SUITE(Renderer_Kernel_Lighting_Tracer) diff --git a/Appleseed/patches/windows/0002-win-vs.patch b/Appleseed/patches/windows/0002-win-vs.patch new file mode 100644 index 0000000000..18c80ab9da --- /dev/null +++ b/Appleseed/patches/windows/0002-win-vs.patch @@ -0,0 +1,17 @@ +--- a/cmake/config/win-vs.txt 2020-05-14 19:22:32.135735200 -0400 ++++ b/cmake/config/win-vs.txt 2020-05-14 19:24:49.460860100 -0400 +@@ -312,10 +312,10 @@ + + macro (link_against_osl target) + set (LLVM_LIBS +- LLVMLTO LLVMLinker LLVMipo LLVMVectorize LLVMBitWriter LLVMTableGen LLVMDebugInfo LLVMOption LLVMX86Disassembler LLVMX86AsmParser ++ LLVMLTO LLVMLinker LLVMipo LLVMVectorize LLVMBitWriter LLVMTableGen LLVMOption LLVMX86Disassembler LLVMX86AsmParser +- LLVMX86CodeGen LLVMSelectionDAG LLVMAsmPrinter LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter LLVMX86Utils LLVMIRReader LLVMBitReader ++ LLVMX86CodeGen LLVMSelectionDAG LLVMAsmPrinter LLVMX86Desc LLVMX86Info LLVMX86Utils LLVMIRReader LLVMBitReader +- LLVMAsmParser LLVMMCDisassembler LLVMMCParser LLVMInstrumentation LLVMInterpreter LLVMMCJIT LLVMJIT LLVMCodeGen LLVMObjCARCOpts +- LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMRuntimeDyld LLVMExecutionEngine LLVMTarget LLVMMC ++ LLVMAsmParser LLVMMCDisassembler LLVMMCParser LLVMInstrumentation LLVMInterpreter LLVMMCJIT LLVMCodeGen LLVMObjCARCOpts ++ LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMAnalysis LLVMRuntimeDyld LLVMExecutionEngine LLVMTarget LLVMMC + LLVMObject LLVMCore LLVMSupport + ) + diff --git a/Appleseed/patches/windows/unique_ptr_1.patch b/Appleseed/patches/windows/unique_ptr_1.patch new file mode 100644 index 0000000000..2b270b9e1f --- /dev/null +++ b/Appleseed/patches/windows/unique_ptr_1.patch @@ -0,0 +1,11 @@ +--- ./src/appleseed/foundation/image/genericimagefilewriter.cpp ++++ ./src/appleseed/foundation/image/genericimagefilewriter.cpp +@@ -79,7 +79,7 @@ + { + // Destroy the ImageOutput stucture. + if (m_writer != nullptr) +- OIIO::ImageOutput::destroy(m_writer); ++ OIIO::ImageOutput::destroy(m_writer.release()); + + delete impl; + } diff --git a/Appleseed/patches/windows/unique_ptr_2.patch b/Appleseed/patches/windows/unique_ptr_2.patch new file mode 100644 index 0000000000..3c9809a0b0 --- /dev/null +++ b/Appleseed/patches/windows/unique_ptr_2.patch @@ -0,0 +1,11 @@ +--- ./src/appleseed/foundation/image/genericimagefilewriter.h ++++ ./src/appleseed/foundation/image/genericimagefilewriter.h +@@ -92,7 +92,7 @@ + struct Impl; + Impl* impl; + +- OIIO::ImageOutput* m_writer; ++ std::unique_ptr m_writer; + const char* m_filename; + }; + diff --git a/Appleseed/patches/windows/unique_ptr_3.patch b/Appleseed/patches/windows/unique_ptr_3.patch new file mode 100644 index 0000000000..d8c1222bd7 --- /dev/null +++ b/Appleseed/patches/windows/unique_ptr_3.patch @@ -0,0 +1,22 @@ +--- ./src/appleseed/foundation/image/genericprogressiveimagefilereader.cpp ++++ ./src/appleseed/foundation/image/genericprogressiveimagefilereader.cpp +@@ -65,7 +65,7 @@ + { + Logger* m_logger; + string m_filename; +- OIIO::ImageInput* m_input; ++ std::unique_ptr m_input; + bool m_supports_random_access; + bool m_is_tiled; + CanvasProperties m_props; +@@ -177,9 +177,7 @@ + // but OpenImageIO 1.5.20 (the version included in appleseed-deps at the time + // of writing) is too old to have this method. Since on Windows we link to + // OpenImageIO statically, this should be safe anyway. +- delete impl->m_input; +- +- impl->m_input = nullptr; ++ OIIO::ImageInput::destroy(impl->m_input.release()); + } + + bool GenericProgressiveImageFileReader::is_open() const diff --git a/BitstreamVera/config.py b/BitstreamVera/config.py index 0e1e4391dc..3ba67f9a5d 100644 --- a/BitstreamVera/config.py +++ b/BitstreamVera/config.py @@ -21,5 +21,15 @@ "fonts", ], + "platform:windows" : { + + "commands" : [ + + "if not exist \"{buildDir}\\fonts\" mkdir {buildDir}\\fonts", + "copy *.ttf {buildDir}\\fonts" + + ] + + } } diff --git a/Blosc/config.py b/Blosc/config.py index 5ee088147d..ce57e9718e 100644 --- a/Blosc/config.py +++ b/Blosc/config.py @@ -22,8 +22,31 @@ "manifest" : [ "include/blosc*.h", - "lib/libblosc*{sharedLibraryExtension}*", + "lib/{libraryPrefix}blosc*{sharedLibraryExtension}*", + "lib/{libraryPrefix}blosc*.lib", ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D BUILD_TESTS=OFF" + " -D BUILD_BENCHMARKS=OFF" + " -D BUILD_STATIC=OFF" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "move {buildDir}\\bin\\blosc.dll {buildDir}\\lib" + + ], + + }, } diff --git a/Boost/config.py b/Boost/config.py index 8b191ab869..b3583ae997 100644 --- a/Boost/config.py +++ b/Boost/config.py @@ -35,9 +35,30 @@ "manifest" : [ "include/boost", - "lib/libboost_*{sharedLibraryExtension}*", - "lib/libboost_test_exec_monitor.a", + "lib/{libraryPrefix}boost_*{sharedLibraryExtension}*", + "lib/{libraryPrefix}boost_*.lib", + "lib/libboost_test_exec_monitor*{staticLibraryExtension}", # Windows and Linux both use the "lib" prefix ], + "platform:windows" : { + + "dependencies" : [ "Python", "Zlib" ], + + "environment" : { + + # Boost needs help finding Python + "PATH" : "%PATH%;{buildDir}\\bin", + "PYTHONPATH" : "{buildDir};{buildDir}\\bin;{buildDir}\\lib\\python{pythonVersion};{buildDir}\\lib" + + }, + + "commands" : [ + # "echo using python : {pythonVersion} : \"{buildDirFwd}/bin/python\" : {pythonIncludeDir} : {pythonLibDir} ; >> tools\\build\\src\\user-config.jam", # best to use forward slashes in user-config.jam + "bootstrap.bat --prefix={buildDir} --without-libraries=log", + "b2 -d+2 --prefix={buildDir} --layout=system --toolset=msvc architecture=x86 address-model=64 variant=release link=shared threading=multi cxxflags=\"/std:c++{c++Standard}\" cxxstd={c++Standard} -s ZLIB_SOURCE=%ROOT_DIR%\\Zlib\\working\\zlib-1.2.11 -s ZLIB_INCLUDE={buildDir}\\include -s ZLIB_LIBPATH={buildDir}\\lib -s ZLIB_BINARY=zlib install" + + ], + + }, } diff --git a/CMark/config.py b/CMark/config.py index bb086a383b..7c6dad3d7b 100644 --- a/CMark/config.py +++ b/CMark/config.py @@ -20,8 +20,28 @@ "manifest" : [ - "lib/libcmark*{sharedLibraryExtension}*" + "lib/{libraryPrefix}cmark*{sharedLibraryExtension}*", + "lib/{libraryPrefix}cmark*.lib", ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}cmark*{sharedLibraryExtension}* {buildDir}\\lib\\", + + ], + + } + } diff --git a/Changes.md b/Changes.md index 6655813d43..03325fde5b 100644 --- a/Changes.md +++ b/Changes.md @@ -24,6 +24,12 @@ - Subprocess32 : Changed to regular install rather than `.egg`. - TBB : Updated to version 2020.3. - USD : Updated to version 21.11. +- Update compiler to Visual Studio 2019. + +5.0.0 +----- + +- Boost : Remove version and build configuration suffixes from libraries and header directories. 4.0.0 ----- diff --git a/Cortex/config.py b/Cortex/config.py index 4a60789106..4173b38b76 100644 --- a/Cortex/config.py +++ b/Cortex/config.py @@ -69,7 +69,8 @@ "manifest" : [ "include/IECore*", - "lib/libIECore*{sharedLibraryExtension}", + "lib/{libraryPrefix}IECore*{sharedLibraryExtension}", + "lib/{libraryPrefix}IECore*.lib", "python/IECore*", "renderMan", "appleseedDisplays", @@ -98,5 +99,57 @@ }, + "platform:windows" : { + + "dependencies" : [ + "Python", "OpenImageIO", "OpenEXR", "Boost", "OpenShadingLanguage", + "Blosc", "FreeType", "GLEW", "TBB", "OpenVDB", "USD", "Six" + ], + + "commands" : [ + + "scons install installDoc --debug=findlibs" + " -j {jobs}" + " CXXSTD=c++{c++Standard}" + " ENV_VARS_TO_IMPORT='PATH'" + " INSTALL_PREFIX={buildDir}" + " INSTALL_DOC_DIR={buildDir}\\doc\\cortex" + " INSTALL_RMANPROCEDURAL_NAME={buildDir}\\renderMan\\procedurals\\iePython" + " INSTALL_RMANDISPLAY_NAME={buildDir}\\renderMan\\displayDrivers\\ieDisplay" + " INSTALL_PYTHON_DIR={buildDir}\\python" + " INSTALL_ARNOLDOUTPUTDRIVER_NAME={buildDir}\\arnold\\plugins\\ieOutputDriver.dll" + " BUILD_TYPE=RELEASE" + " PYTHON={buildDir}\\bin\\python.exe" + " PYTHON_INCLUDE_PATH={buildDir}\\include" + " PYTHON_LIB_PATH={buildDir}\\libs" + " PYTHON_LINK_FLAGS=" + " BOOST_INCLUDE_PATH={buildDir}\\include" + " BOOST_LIB_PATH={buildDir}\\lib" + " BOOST_LIB_SUFFIX=" + " OPENEXR_INCLUDE_PATH={buildDir}\\include" + " OPENEXR_LIB_SUFFIX=" + " OIIO_INCLUDE_PATH={buildDir}\\include\\OpenImageIO" + " OIIO_LIB_PATH={buildDir}\\lib" + " OSL_INCLUDE_PATH={buildDir}\\include" + " BLOSC_INCLUDE_PATH={buildDir}\\include" + " FREETYPE_INCLUDE_PATH={buildDir}\\include\\freetype2" + " FREETYPE_LIB_PATH={buildDir}\\lib" + " WITH_GL=1" + " GLEW_INCLUDE_PATH={buildDir}\\include" + " GLEW_LIB_SUFFIX=32" + " VDB_INCLUDE_PATH={buildDir}\\include" + " TBB_INCLUDE_PATH={buildDir}\\include" + " ALEMBIC_INCLUDE_PATH={buildDir}\\include" + " ARNOLD_ROOT=%ARNOLD_ROOT%" + " RMAN_ROOT=%RMAN_ROOT%" + " USD_INCLUDE_PATH={buildDir}\\include" + " USD_LIB_PATH={buildDir}\\lib" + " USD_LIB_PREFIX=usd_" + " PYTHONPATH={buildDir}\\python" + " OPTIONS=" + " WARNINGS_AS_ERRORS=1" + ] + + }, } diff --git a/Cortex/patches/windows/0001-Windows-build-options-HQ-5.0-Windows-6.0-compatibili.patch b/Cortex/patches/windows/0001-Windows-build-options-HQ-5.0-Windows-6.0-compatibili.patch new file mode 100644 index 0000000000..cdbc981a65 --- /dev/null +++ b/Cortex/patches/windows/0001-Windows-build-options-HQ-5.0-Windows-6.0-compatibili.patch @@ -0,0 +1,79 @@ +From bac8850e7b9c2fe19085c604ab835483a1459512 Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 10 Mar 2022 13:00:47 -0500 +Subject: [PATCH] Windows build options : HQ 5.0 / Windows 6.0 compatibility + +- Dependencies now use simplified Boost packaging in https://github.com/hypothetical-inc/gafferDependencies/releases/tag/5.0.0, making the file and directory names less verbose. +- Move `CXXFLAGS` into `SConstruct`. It's not possible to set a list value from a batch script, which is what the dependencies project uses to build Cortex. Also these flags are required, so this move makes them less prone to being left out. +- USD 21.11 prefixes libraries with `usd_` +--- + .github/workflows/main/options.windows | 14 ++++---------- + SConstruct | 10 +++++++++- + 2 files changed, 13 insertions(+), 11 deletions(-) + +diff --git a/.github/workflows/main/options.windows b/.github/workflows/main/options.windows +index 1b809920b..881c8f52e 100644 +--- a/.github/workflows/main/options.windows ++++ b/.github/workflows/main/options.windows +@@ -13,14 +13,6 @@ INSTALL_RMANDISPLAY_NAME = build + "\\renderMan\\displayDrivers\\ieDisplay" + INSTALL_PYTHON_DIR = build + "\\python" + INSTALL_IECORE_OPS = "" + +-# disable permissive mode, making MSVC more standards compliant +-# /D_USE_MATH_DEFINES is needed with permissive mode off for +-# common definitions like M_P +-# /Zc:externC- fixes a compilation error with Boost::interprocess +-# described here: +-# https://developercommunity.visualstudio.com/content/problem/756694/including-windowsh-and-boostinterprocess-headers-l.html +-CXXFLAGS = ["/permissive-", "/D_USE_MATH_DEFINES", "/Zc:externC-"] +- + LIBPATH = libs + + PYTHON = deps + "\\bin\\python" +@@ -33,8 +25,9 @@ PYTHONPATH = deps + "\\python" + # Libs + # ==== + +-BOOST_INCLUDE_PATH = includes + "\\boost-1_68" +-BOOST_LIB_SUFFIX = "-vc141-mt-x64-1_68" ++BOOST_INCLUDE_PATH = includes ++BOOST_LIB_SUFFIX = "" ++BOOST_LIB_PATH = libs + + OPENEXR_INCLUDE_PATH = includes + OIIO_INCLUDE_PATH = includes + "\\OpenImageIO" +@@ -53,6 +46,7 @@ GLEW_LIB_SUFFIX = "32" + TBB_INCLUDE_PATH = includes + USD_INCLUDE_PATH = includes + USD_LIB_PATH = libs ++USD_LIB_PREFIX = "usd_" + DOXYGEN = deps + "\\doxygen\\doxygen.exe" + + # Renderers +diff --git a/SConstruct b/SConstruct +index fafbdb83d..cf5865ae4 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -84,10 +84,18 @@ o.Add( + "g++" if Environment()["PLATFORM"] != "win32" else "cl", + ) + ++# Windows : Disable permissive mode, making MSVC more standards compliant. ++# /D_USE_MATH_DEFINES is needed with permissive mode off for ++# common definitions like M_P. ++# /Zc:externC- fixes a compilation error with Boost::interprocess ++# described here: ++# https://developercommunity.visualstudio.com/content/problem/756694/including-windowsh-and-boostinterprocess-headers-l.html ++# /DBOOST_ALL_NO_LIB is needed to find Boost when it is built without ++# verbose system information added to file and directory names. + o.Add( + "CXXFLAGS", + "The extra flags to pass to the C++ compiler during compilation.", +- [ "-pipe", "-Wall", "-Wextra" ] if Environment()["PLATFORM"] != "win32" else [], ++ [ "-pipe", "-Wall", "-Wextra" ] if Environment()["PLATFORM"] != "win32" else [ "/permissive-", "/D_USE_MATH_DEFINES", "/Zc:externC-", "/DBOOST_ALL_NO_LIB" ], + ) + + o.Add( +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0002-Fix-MSVC-warning-C4456-declaration-hides-previous-de.patch b/Cortex/patches/windows/0002-Fix-MSVC-warning-C4456-declaration-hides-previous-de.patch new file mode 100644 index 0000000000..93e025175a --- /dev/null +++ b/Cortex/patches/windows/0002-Fix-MSVC-warning-C4456-declaration-hides-previous-de.patch @@ -0,0 +1,538 @@ +From 7df569d5c3a1c323180dcdd361a21181013111a2 Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 10 Mar 2022 13:03:57 -0500 +Subject: [PATCH] Fix MSVC warning C4456 (declaration hides previous + declaration) + +--- + .../src/IECoreAlembic/AlembicScene.cpp | 172 +++++++++--------- + src/IECoreGL/LuminanceTexture.cpp | 6 +- + src/IECoreGL/Renderer.cpp | 8 +- + src/IECoreGL/ToGLStateConverter.cpp | 12 +- + src/IECoreImage/ImageThinner.cpp | 4 +- + src/IECoreScene/CurveExtrudeOp.cpp | 50 ++--- + src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp | 6 +- + src/IECoreScene/Primitive.cpp | 6 +- + 8 files changed, 132 insertions(+), 132 deletions(-) + +diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp +index 1d9c150d3..b1081f06f 100644 +--- a/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp ++++ b/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp +@@ -1564,196 +1564,196 @@ class AlembicScene::AlembicWriter : public AlembicIO + return; + } + +- if( const IECore::BoolData *data = runTimeCast( attribute ) ) ++ if( const IECore::BoolData *bData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, bData ); + } +- else if( const IECore::UCharData *data = runTimeCast( attribute ) ) ++ else if( const IECore::UCharData *ucData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, ucData ); + } +- else if( const IECore::CharData *data = runTimeCast( attribute ) ) ++ else if( const IECore::CharData *cData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, cData ); + } +- else if( const IECore::UShortData *data = runTimeCast( attribute ) ) ++ else if( const IECore::UShortData *usData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, usData ); + } +- else if( const IECore::ShortData *data = runTimeCast( attribute ) ) ++ else if( const IECore::ShortData *sData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, sData ); + } +- else if( const IECore::UIntData *data = runTimeCast( attribute ) ) ++ else if( const IECore::UIntData *uiData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, uiData ); + } +- else if( const IECore::IntData *data = runTimeCast( attribute ) ) ++ else if( const IECore::IntData *iData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, iData ); + } +- else if( const IECore::UInt64Data *data = runTimeCast( attribute ) ) ++ else if( const IECore::UInt64Data *ui64Data = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, ui64Data ); + } +- else if( const IECore::Int64Data *data = runTimeCast( attribute ) ) ++ else if( const IECore::Int64Data *i64Data = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, i64Data ); + } +- else if( const IECore::HalfData *data = runTimeCast( attribute ) ) ++ else if( const IECore::HalfData *hData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, hData ); + } +- else if( const IECore::FloatData *data = runTimeCast( attribute ) ) ++ else if( const IECore::FloatData *fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, fData ); + } +- else if( const IECore::DoubleData *data = runTimeCast( attribute ) ) ++ else if( const IECore::DoubleData *dData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, dData ); + } +- else if( const IECore::StringData *data = runTimeCast( attribute ) ) ++ else if( const IECore::StringData *strData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, strData ); + } +- else if( const IECore::V2iData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V2iData *v2iData = runTimeCast( attribute ) ) + { +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v2iData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2iData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2iData ); + } + } +- else if( const IECore::V2fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V2fData *v2fData = runTimeCast( attribute ) ) + { +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v2fData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2fData ); + } +- else if( data->getInterpretation() == GeometricData::Interpretation::Normal ) ++ else if( v2fData->getInterpretation() == GeometricData::Interpretation::Normal ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2fData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2fData ); + } + } +- else if( const IECore::V2dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V2dData *v2dData = runTimeCast( attribute ) ) + { +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v2dData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2dData ); + } +- else if( data->getInterpretation() == GeometricData::Interpretation::Normal ) ++ else if( v2dData->getInterpretation() == GeometricData::Interpretation::Normal ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2dData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v2dData ); + } + } +- else if( const IECore::V3iData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V3iData *v3iData = runTimeCast( attribute ) ) + { +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v3iData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3iData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3iData ); + } + } +- else if( const IECore::V3fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V3fData *v3fData = runTimeCast( attribute ) ) + { +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v3fData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3fData ); + } +- else if( data->getInterpretation() == GeometricData::Interpretation::Normal ) ++ else if( v3fData->getInterpretation() == GeometricData::Interpretation::Normal ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3fData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3fData ); + } + } +- else if( const IECore::V3dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::V3dData *v3dData = runTimeCast( attribute ) ) + { + +- if( data->getInterpretation() == GeometricData::Interpretation::Point ) ++ if( v3dData->getInterpretation() == GeometricData::Interpretation::Point ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3dData ); + } +- else if( data->getInterpretation() == GeometricData::Interpretation::Normal ) ++ else if( v3dData->getInterpretation() == GeometricData::Interpretation::Normal ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3dData ); + } + else + { +- setProperty( name, time, data ); ++ setProperty( name, time, v3dData ); + } + } +- else if( const IECore::Box2iData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box2iData *b2iData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b2iData ); + } +- else if( const IECore::Box2fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box2fData *b2fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b2fData ); + } +- else if( const IECore::Box2dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box2dData *b2dData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b2dData ); + } +- else if( const IECore::Box3iData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box3iData *b3iData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b3iData ); + } +- else if( const IECore::Box3fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box3fData *b3fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b3fData ); + } +- else if( const IECore::Box3dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Box3dData *b3dData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, b3dData ); + } +- else if( const IECore::M33fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::M33fData *m33fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, m33fData ); + } +- else if( const IECore::M33dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::M33dData *m33dData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, m33dData ); + } +- else if( const IECore::M44fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::M44fData *m44fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, m44fData ); + } +- else if( const IECore::M44dData *data = runTimeCast( attribute ) ) ++ else if( const IECore::M44dData *m44dData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, m44dData ); + } +- else if( const IECore::QuatfData *data = runTimeCast( attribute ) ) ++ else if( const IECore::QuatfData *qfData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, qfData ); + } +- else if( const IECore::QuatdData *data = runTimeCast( attribute ) ) ++ else if( const IECore::QuatdData *qdData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, qdData ); + } +- else if( const IECore::Color3fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Color3fData *c3fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, c3fData ); + } +- else if( const IECore::Color4fData *data = runTimeCast( attribute ) ) ++ else if( const IECore::Color4fData *c4fData = runTimeCast( attribute ) ) + { +- setProperty( name, time, data ); ++ setProperty( name, time, c4fData ); + } + else + { +diff --git a/src/IECoreGL/LuminanceTexture.cpp b/src/IECoreGL/LuminanceTexture.cpp +index e2e8fafaa..27a6531d8 100644 +--- a/src/IECoreGL/LuminanceTexture.cpp ++++ b/src/IECoreGL/LuminanceTexture.cpp +@@ -95,10 +95,10 @@ struct LuminanceTexture::Constructor + std::vector interleaved( n * (ra ? 2 : 1) ); + + unsigned int i = 0; +- for( int y=height-1; y>=0; y-- ) ++ for( int iy=height-1; iy>=0; iy-- ) + { +- const ElementType *dy = &ry[y*width]; +- const ElementType *da = ra ? &(*ra)[y*width] : nullptr; ++ const ElementType *dy = &ry[iy*width]; ++ const ElementType *da = ra ? &(*ra)[iy*width] : nullptr; + + for( unsigned int x=0; xoptions.user.find( name ); +- if( it!=m_data->options.user.end() ) ++ IECore::CompoundDataMap::const_iterator optionIt = m_data->options.user.find( name ); ++ if( optionIt!=m_data->options.user.end() ) + { +- return it->second; ++ return optionIt->second; + } + else + { +@@ -1938,7 +1938,7 @@ bool removeObjectWalk( IECoreGL::GroupPtr parent, IECoreGL::GroupPtr child, cons + { + // group after removal became empty, remove it too. + { +- std::lock_guard lock( parent->mutex() ); ++ std::lock_guard parentLock( parent->mutex() ); + parent->removeChild( child.get() ); + } + { +diff --git a/src/IECoreGL/ToGLStateConverter.cpp b/src/IECoreGL/ToGLStateConverter.cpp +index 8be62b6b4..6d280da1b 100644 +--- a/src/IECoreGL/ToGLStateConverter.cpp ++++ b/src/IECoreGL/ToGLStateConverter.cpp +@@ -147,9 +147,9 @@ StateComponentPtr attributeToColorState( const IECore::Object *attribute ) + { + Imath::Color4f color( 1 ); + +- if( auto d = runTimeCast( attribute ) ) ++ if( auto vectorData = runTimeCast( attribute ) ) + { +- const std::vector &v = d->readable(); ++ const std::vector &v = vectorData->readable(); + if( v.size() == 1 ) + { + const Imath::Color3f &c = v[0]; +@@ -160,13 +160,13 @@ StateComponentPtr attributeToColorState( const IECore::Object *attribute ) + IECore::msg( IECore::Msg::Warning, "ToGLStateConverter", "Expected array of length 1 for \"render:displayColor\"" ); + } + } +- else if( auto d = runTimeCast( attribute ) ) ++ else if( auto color4fData = runTimeCast( attribute ) ) + { +- color = d->readable(); ++ color = color4fData->readable(); + } +- else if( auto d = runTimeCast( attribute ) ) ++ else if( auto color3fData = runTimeCast( attribute ) ) + { +- const Imath::Color3f &c = d->readable(); ++ const Imath::Color3f &c = color3fData->readable(); + color = Imath::Color4f( c[0], c[1], c[2], 1.0f ); + } + else +diff --git a/src/IECoreImage/ImageThinner.cpp b/src/IECoreImage/ImageThinner.cpp +index 0b96602d2..ba3701c24 100644 +--- a/src/IECoreImage/ImageThinner.cpp ++++ b/src/IECoreImage/ImageThinner.cpp +@@ -148,10 +148,10 @@ void ImageThinner::modifyChannels( const Imath::Box2i &displayWindow, const Imat + { + count = 0; + +- for( int i = 0; i < 4 ; i++ ) ++ for( int j = 0; j < 4 ; j++ ) + { + +- int m = g_masks[i]; ++ int m = g_masks[j]; + + // Build initial previous scan buffer + +diff --git a/src/IECoreScene/CurveExtrudeOp.cpp b/src/IECoreScene/CurveExtrudeOp.cpp +index 929df1429..4d4655679 100644 +--- a/src/IECoreScene/CurveExtrudeOp.cpp ++++ b/src/IECoreScene/CurveExtrudeOp.cpp +@@ -390,40 +390,40 @@ PatchMeshPrimitivePtr CurveExtrudeOp::buildPatchMesh( const CurvesPrimitive * cu + false + ); + +- for ( PrimitiveVariableMap::const_iterator it = curves->variables.begin(); it != curves->variables.end(); ++it ) ++ for ( PrimitiveVariableMap::const_iterator vIt = curves->variables.begin(); vIt != curves->variables.end(); ++vIt ) + { +- if ( it->second.interpolation == PrimitiveVariable::FaceVarying || it->second.interpolation == PrimitiveVariable::Varying ) ++ if ( vIt->second.interpolation == PrimitiveVariable::FaceVarying || vIt->second.interpolation == PrimitiveVariable::Varying ) + { +- VaryingFn varyingFn( it->first, curves, curveIndex, varyingOffset, resolution ); +- assert( it->second.data ); ++ VaryingFn varyingFn( vIt->first, curves, curveIndex, varyingOffset, resolution ); ++ assert( vIt->second.data ); + +- patchMesh->variables[ it->first ] = PrimitiveVariable( +- it->second.interpolation, +- despatchTypedData( it->second.data.get(), varyingFn ) ++ patchMesh->variables[ vIt->first ] = PrimitiveVariable( ++ vIt->second.interpolation, ++ despatchTypedData( vIt->second.data.get(), varyingFn ) + ); + + } +- else if ( it->second.interpolation == PrimitiveVariable::Vertex ) ++ else if ( vIt->second.interpolation == PrimitiveVariable::Vertex ) + { +- VertexFn vertexFn( it->first, curves, curveIndex, vertexOffset, resolution ); +- assert( it->second.data ); ++ VertexFn vertexFn( vIt->first, curves, curveIndex, vertexOffset, resolution ); ++ assert( vIt->second.data ); + +- patchMesh->variables[ it->first ] = PrimitiveVariable( +- it->second.interpolation, +- despatchTypedData( it->second.data.get(), vertexFn ) ++ patchMesh->variables[ vIt->first ] = PrimitiveVariable( ++ vIt->second.interpolation, ++ despatchTypedData( vIt->second.data.get(), vertexFn ) + ); + + } +- else if ( it->second.interpolation == PrimitiveVariable::Constant ) ++ else if ( vIt->second.interpolation == PrimitiveVariable::Constant ) + { +- patchMesh->variables[ it->first ] = PrimitiveVariable( it->second.interpolation, it->second.data->copy() ); ++ patchMesh->variables[ vIt->first ] = PrimitiveVariable( vIt->second.interpolation, vIt->second.data->copy() ); + } +- else if ( it->second.interpolation == PrimitiveVariable::Uniform ) ++ else if ( vIt->second.interpolation == PrimitiveVariable::Uniform ) + { +- UniformFn uniformFn( it->first, curves, curveIndex ); +- patchMesh->variables[ it->first ] = PrimitiveVariable( ++ UniformFn uniformFn( vIt->first, curves, curveIndex ); ++ patchMesh->variables[ vIt->first ] = PrimitiveVariable( + PrimitiveVariable::Constant, +- despatchTypedData( it->second.data.get(), uniformFn ) ++ despatchTypedData( vIt->second.data.get(), uniformFn ) + ); + } + } +@@ -431,18 +431,18 @@ PatchMeshPrimitivePtr CurveExtrudeOp::buildPatchMesh( const CurvesPrimitive * cu + if ( varyingWidthData ) + { + assert( !vertexWidthData ); +- PrimitiveVariableMap::const_iterator it = patchMesh->variables.find( "width" ); +- assert( it != patchMesh->variables.end() ); ++ PrimitiveVariableMap::const_iterator vIt = patchMesh->variables.find( "width" ); ++ assert( vIt != patchMesh->variables.end() ); + +- varyingWidthData = runTimeCast< const FloatVectorData >( it->second.data ); ++ varyingWidthData = runTimeCast< const FloatVectorData >( vIt->second.data ); + assert( varyingWidthData ); + } + else if ( vertexWidthData ) + { +- PrimitiveVariableMap::const_iterator it = patchMesh->variables.find( "width" ); +- assert( it != patchMesh->variables.end() ); ++ PrimitiveVariableMap::const_iterator vIt = patchMesh->variables.find( "width" ); ++ assert( vIt != patchMesh->variables.end() ); + +- vertexWidthData = runTimeCast< const FloatVectorData >( it->second.data ); ++ vertexWidthData = runTimeCast< const FloatVectorData >( vIt->second.data ); + assert( vertexWidthData ); + } + +diff --git a/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp b/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp +index 29ce68285..558c49b22 100644 +--- a/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp ++++ b/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp +@@ -372,13 +372,13 @@ void MeshPrimitiveShrinkWrapOp::modifyTypedPrimitive( MeshPrimitive * mesh, cons + throw InvalidArgumentException( "Direction mesh with invalid primitive variables given to MeshPrimitiveShrinkWrapOp" ); + } + +- PrimitiveVariableMap::const_iterator it = directionMesh->variables.find("P"); +- if (it == directionMesh->variables.end()) ++ PrimitiveVariableMap::const_iterator pIt = directionMesh->variables.find("P"); ++ if (pIt == directionMesh->variables.end()) + { + throw InvalidArgumentException("Direction mesh has no primitive variable \"P\" in MeshPrimitiveShrinkWrapOp" ); + } + +- directionVerticesData = it->second.data; ++ directionVerticesData = pIt->second.data; + } + + ShrinkWrapFn fn( mesh, target.get(), directionVerticesData.get(), direction, method ); +diff --git a/src/IECoreScene/Primitive.cpp b/src/IECoreScene/Primitive.cpp +index b1a5de003..997e0d8b3 100644 +--- a/src/IECoreScene/Primitive.cpp ++++ b/src/IECoreScene/Primitive.cpp +@@ -405,9 +405,9 @@ PrimitiveVariableMap Primitive::loadPrimitiveVariables( const IndexedIO *ioInter + } + + PrimitiveVariableMap variables; +- for( const auto &name : names ) ++ for( const auto &primVarName : names ) + { +- ConstIndexedIOPtr ioPrimVar = ioVariables->subdirectory( name, IndexedIO::NullIfMissing ); ++ ConstIndexedIOPtr ioPrimVar = ioVariables->subdirectory( primVarName, IndexedIO::NullIfMissing ); + if ( !ioPrimVar ) + { + continue; +@@ -424,7 +424,7 @@ PrimitiveVariableMap Primitive::loadPrimitiveVariables( const IndexedIO *ioInter + + Canceller::check( canceller ); + variables.insert( +- PrimitiveVariableMap::value_type( name, PrimitiveVariable( (PrimitiveVariable::Interpolation)i, context->load( ioPrimVar.get(), g_dataEntry ), indices ) ) ++ PrimitiveVariableMap::value_type( primVarName, PrimitiveVariable( (PrimitiveVariable::Interpolation)i, context->load( ioPrimVar.get(), g_dataEntry ), indices ) ) + ); + } + +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0003-Fix-MSVC-warning-C4701-Potentially-unitialized-local.patch b/Cortex/patches/windows/0003-Fix-MSVC-warning-C4701-Potentially-unitialized-local.patch new file mode 100644 index 0000000000..04ee3a570a --- /dev/null +++ b/Cortex/patches/windows/0003-Fix-MSVC-warning-C4701-Potentially-unitialized-local.patch @@ -0,0 +1,30 @@ +From 64a9161dd089ecbce738c97df20023b5c2307f0b Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 10 Mar 2022 13:05:28 -0500 +Subject: [PATCH] Fix MSVC warning C4701 (Potentially unitialized local + variable) + +- Warnings were being generated by Boost::Wave : + include\boost\wave\util\cpp_macromap.hpp(1819) : warning C4701: potentially uninitialized local variable 'is_system' used + include\boost\wave\util\cpp_macromap.hpp(1819) : warning C4701: potentially uninitialized local variable 'is_quoted_filename' used + include\boost\wave\util\cpp_macromap.hpp(1819) : warning C4701: potentially uninitialized local variable 'is_system' used + include\boost\wave\util\cpp_macromap.hpp(1819) : warning C4701: potentially uninitialized local variable 'is_quoted_filename' used +--- + SConstruct | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/SConstruct b/SConstruct +index cf5865ae4..786946ed8 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -2165,6 +2165,7 @@ if env["WITH_GL"] and doConfigure : + # while still using -Werror. + "-Wno-format" if env["PLATFORM"] != "win32" else "", + "-Wno-strict-aliasing" if env["PLATFORM"] != "win32" else "", ++ "/wd4701" if env["PLATFORM"] == "win32" else "", + systemIncludeArgument, "$GLEW_INCLUDE_PATH", + systemIncludeArgument, "$OIIO_INCLUDE_PATH", + ], +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0004-Suppress-MSVC-warning-4127-Conditional-expression-is.patch b/Cortex/patches/windows/0004-Suppress-MSVC-warning-4127-Conditional-expression-is.patch new file mode 100644 index 0000000000..4a15d92964 --- /dev/null +++ b/Cortex/patches/windows/0004-Suppress-MSVC-warning-4127-Conditional-expression-is.patch @@ -0,0 +1,128 @@ +From e9d1d397909d9646bb926077351165d11f307b9d Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 10 Mar 2022 13:07:43 -0500 +Subject: [PATCH] Suppress MSVC warning 4127 (Conditional expression is + constant) + +- This warning seems to have come up as a result of upgrading Boost from 1.68 to 1.76. +- The Microsoft recommended solution is to use `if constexpr` which is available in c++17. We can switch to that solution and remove the warning suppression when Cortex moves to that standard. +- The full warning sequence is : + cortex\src\iecore\datainterleaveop.cpp(182): error C2220: warning treated as error - no 'object' file generated + cortex\src\iecore\datainterleaveop.cpp(182): warning C4127: conditional expression is constant + cortex\src\iecore\datainterleaveop.cpp(182): note: consider using 'if constexpr' statement instead + cortex\include\iecore\despatchtypeddata.inl(78): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage2::ReturnType IECore::DataInterleaveOp::InterleaveFnStage2::operator ()(boost::intrusive_ptr)' being compiled + with + [ + DataType=IECore::Color4fVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(78): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage2::ReturnType IECore::DataInterleaveOp::InterleaveFnStage2::operator ()(boost::intrusive_ptr)' being compiled + with + [ + DataType=IECore::Color4fVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(75): note: while compiling class template member function 'boost::intrusive_ptr IECore::Detail::DespatchTypedData::Func::operator ()(DataType *,Functor &,ErrorHandler &)' + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericBasedVectorTypedData, + DataType=IECore::Color4fVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(387): note: see reference to function template instantiation 'boost::intrusive_ptr IECore::Detail::DespatchTypedData::Func::operator ()(DataType *,Functor &,ErrorHandler &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericBasedVectorTypedData, + DataType=IECore::Color4fVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(389): note: see reference to class template instantiation 'IECore::Detail::DespatchTypedData::Func' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericBasedVectorTypedData + ] + cortex\include\iecore\despatchtypeddata.inl(407): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage2::ReturnType IECore::despatchTypedData(IECore::Data *,Functor &,ErrorHandler &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2, + Enabler=IECore::TypeTraits::IsNumericBasedVectorTypedData, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError + ] + cortex\include\iecore\despatchtypeddata.inl(413): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage2::ReturnType IECore::despatchTypedData(IECore::Data *,Functor &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2, + Enabler=IECore::TypeTraits::IsNumericBasedVectorTypedData + ] + cortex\src\iecore\datainterleaveop.cpp(154): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage2::ReturnType IECore::despatchTypedData,IECore::TypeTraits::IsNumericBasedVectorTypedData>(IECore::Data *,Functor &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage2 + ] + cortex\include\iecore\despatchtypeddata.inl(78): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage1::ReturnType IECore::DataInterleaveOp::InterleaveFnStage1::operator ()(boost::intrusive_ptr)' being compiled + with + [ + DataType=IECore::FloatVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(75): note: while compiling class template member function 'boost::intrusive_ptr IECore::Detail::DespatchTypedData::Func::operator ()(DataType *,Functor &,ErrorHandler &)' + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericVectorTypedData, + DataType=IECore::FloatVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(275): note: see reference to function template instantiation 'boost::intrusive_ptr IECore::Detail::DespatchTypedData::Func::operator ()(DataType *,Functor &,ErrorHandler &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericVectorTypedData, + DataType=IECore::FloatVectorData + ] + cortex\include\iecore\despatchtypeddata.inl(277): note: see reference to class template instantiation 'IECore::Detail::DespatchTypedData::Func' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError, + Enabler=IECore::TypeTraits::IsNumericVectorTypedData + ] + cortex\include\iecore\despatchtypeddata.inl(407): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage1::ReturnType IECore::despatchTypedData(IECore::Data *,Functor &,ErrorHandler &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1, + Enabler=IECore::TypeTraits::IsNumericVectorTypedData, + ErrorHandler=IECore::Detail::DespatchTypedDataExceptionError + ] + cortex\include\iecore\despatchtypeddata.inl(413): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage1::ReturnType IECore::despatchTypedData(IECore::Data *,Functor &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1, + Enabler=IECore::TypeTraits::IsNumericVectorTypedData + ] + cortex\src\iecore\datainterleaveop.cpp(236): note: see reference to function template instantiation 'IECore::DataInterleaveOp::InterleaveFnStage1::ReturnType IECore::despatchTypedData(IECore::Data *,Functor &)' being compiled + with + [ + Functor=IECore::DataInterleaveOp::InterleaveFnStage1 + ] +--- + SConstruct | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/SConstruct b/SConstruct +index 786946ed8..1ea5fb536 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -1198,6 +1198,7 @@ else: + "/wd4244", # suppress warning about possible loss of data in type conversion + "/wd4305", # suppress warning about conversion from double to float + "/wd4506", # suppress warning about no definition for inline function. Needed for USD::Glf ++ "/wd4127", # suppress warning "conditional expression is constant" \todo: Remove this when Cortex moves to c++17 and use `if constexpr` in `datainterleaveop.cpp:182` + # suppress warning about exported class deriving from non-exported class. + # Microsoft states (in https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170) + # that "C4275 can be ignored if you are deriving from a type in the +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0005-IECoreGL-TextPrimitive-Fix-warning-C4701.patch b/Cortex/patches/windows/0005-IECoreGL-TextPrimitive-Fix-warning-C4701.patch new file mode 100644 index 0000000000..d200e4cc67 --- /dev/null +++ b/Cortex/patches/windows/0005-IECoreGL-TextPrimitive-Fix-warning-C4701.patch @@ -0,0 +1,31 @@ +From 1c5669f5bdfcf0c48dfcb858e631f0a444022686 Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 10 Mar 2022 13:11:21 -0500 +Subject: [PATCH] IECoreGL::TextPrimitive : Fix warning C4701 + +- Rename second `b` variable and expand bound calculation in loop. +--- + src/IECoreGL/TextPrimitive.cpp | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/IECoreGL/TextPrimitive.cpp b/src/IECoreGL/TextPrimitive.cpp +index e803bb83a..88b3ba570 100644 +--- a/src/IECoreGL/TextPrimitive.cpp ++++ b/src/IECoreGL/TextPrimitive.cpp +@@ -62,9 +62,10 @@ TextPrimitive::TextPrimitive( const std::string &text, FontPtr font ) + V2f advanceSum( 0 ); + for( unsigned i=0; icoreFont()->bound( m_text[i] ); +- b.min += advanceSum; +- b.max += advanceSum; ++ Box2f characterB = m_font->coreFont()->bound( m_text[i] ); ++ characterB.min += advanceSum; ++ characterB.max += advanceSum; ++ b.extendBy( characterB ); + if( icoreFont()->advance( m_text[i], m_text[i+1] ); +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0006-ScaledDataConversion-Fix-warning-4244-possible-loss-.patch b/Cortex/patches/windows/0006-ScaledDataConversion-Fix-warning-4244-possible-loss-.patch new file mode 100644 index 0000000000..7df1f35029 --- /dev/null +++ b/Cortex/patches/windows/0006-ScaledDataConversion-Fix-warning-4244-possible-loss-.patch @@ -0,0 +1,27 @@ +From e17a15c86a70e15a2aca98fbf12f1a2fb36fefb6 Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Fri, 29 Apr 2022 14:19:24 -0400 +Subject: [PATCH] ScaledDataConversion : Fix warning 4244 ( possible loss of + data in conversion ) + +- The constructor for `half` only takes a `float` value, causing an implicit cast and warning 4244 when casting a `double` to `half`. Since this function is only being called for `unsigned` types, we can safely replace `std::numeric_limits::min` with 0. +--- + include/IECore/ScaledDataConversion.inl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/IECore/ScaledDataConversion.inl b/include/IECore/ScaledDataConversion.inl +index d5832c10a..d7b4ec18e 100644 +--- a/include/IECore/ScaledDataConversion.inl ++++ b/include/IECore/ScaledDataConversion.inl +@@ -163,7 +163,7 @@ struct ScaledDataConversion< + T operator()( F f ) const + { + BOOST_STATIC_ASSERT( boost::is_unsigned< T >::value ); +- f = std::max( f, (F)(std::numeric_limits::min() ) ); ++ f = std::max( f, (F)( 0.0 ) ); + f = std::min( f, (F)( 1.0 ) ); + float result = static_cast(f) * std::numeric_limits::max(); + return static_cast( round( result ) ); +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0007-Windows-Disable-some-warnings-from-external-dependen.patch b/Cortex/patches/windows/0007-Windows-Disable-some-warnings-from-external-dependen.patch new file mode 100644 index 0000000000..d65538c70e --- /dev/null +++ b/Cortex/patches/windows/0007-Windows-Disable-some-warnings-from-external-dependen.patch @@ -0,0 +1,39 @@ +From 33272b777e73873b299888cab24d7e67ecd9e12f Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Fri, 29 Apr 2022 17:44:00 -0400 +Subject: [PATCH] Windows : Disable some warnings from external dependencies. + +- MSVC seems to be inconsistent with considering headers included via double quotes as external. Rather than breaking with convention and including external dependencies in angle brackets, we disable these warnings until MSVC handles external warnings correctly. +- See https://developercommunity.visualstudio.com/t/analyze:external--and-external:I-flags/1688240#T-N1689542 for additional information. They are using `/analyze` but it seems to apply to compiling as well. +--- + SConstruct | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/SConstruct b/SConstruct +index a491b1ffe..fc6eebec4 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -1173,7 +1173,6 @@ else: + "/D_WINDLL", + "/D_MBCS", + "/W4", +- "/experimental:external", + "/external:W0", + "/Zc:inline", # Remove unreferenced function or data if it is COMDAT or has internal linkage only + "/GR", # enable RTTI +@@ -1199,6 +1198,12 @@ else: + "/wd4305", # suppress warning about conversion from double to float + "/wd4506", # suppress warning about no definition for inline function. Needed for USD::Glf + "/wd4127", # suppress warning "conditional expression is constant" \todo: Remove this when Cortex moves to c++17 and use `if constexpr` in `datainterleaveop.cpp:182` ++ # NOTE : the following warnings are generated by external dependencies, even when using /external ++ # They may be able to be re-enabled after updating to MSVC 2022. ++ "/wd4456", # suppress warning "declaration of 'x' hides previous local declaration" ++ "/wd4459", # suppress warning "declaration of 'x' hides global declaration" ++ "/wd4201", # suppress warning "nonstandard extension used : nameless struct/union" ++ "/wd4245", # suppress warning "'initializing': conversion from 'int' to 'size_t', signed / unsigned mismatch + # suppress warning about exported class deriving from non-exported class. + # Microsoft states (in https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170) + # that "C4275 can be ignored if you are deriving from a type in the +-- +2.33.1.windows.1 + diff --git a/Cortex/patches/windows/0008-SceneCacheFileFormat-Fix-MSVC-warning-C4003-not-enou.patch b/Cortex/patches/windows/0008-SceneCacheFileFormat-Fix-MSVC-warning-C4003-not-enou.patch new file mode 100644 index 0000000000..99c51031ce --- /dev/null +++ b/Cortex/patches/windows/0008-SceneCacheFileFormat-Fix-MSVC-warning-C4003-not-enou.patch @@ -0,0 +1,57 @@ +From 09361e8552b0f08de39ec41c6e7064f9544b8ebe Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Fri, 29 Apr 2022 17:46:52 -0400 +Subject: [PATCH] SceneCacheFileFormat : Fix MSVC "warning C4003: not enough + arguments for function-like macro invocation + +- This came back after upgrading to MSVC 2019 and the latest USD. Despite USD trying to handle suppressing this warning, it seems to be stubborn and continues to be raised without further efforts. +- Using `ARCH_PRAGMA_*` is a bit cleaner and gracefully degrades to a no-op on non-Windows builds. +--- + .../src/IECoreUSD/SceneCacheFileFormat.cpp | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp +index 76e10720f..e811ea444 100644 +--- a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp ++++ b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp +@@ -49,6 +49,9 @@ + #include "pxr/base/tf/registryManager.h" + #include "pxr/base/tf/staticData.h" + ++ARCH_PRAGMA_PUSH ++ARCH_PRAGMA_MACRO_TOO_FEW_ARGUMENTS ++ + #include "pxr/pxr.h" + + #include "pxr/usd/sdf/layer.h" +@@ -57,6 +60,8 @@ + #include "pxr/usd/usd/usdaFileFormat.h" + #include "pxr/usd/usdGeom/tokens.h" + ++ARCH_PRAGMA_POP ++ + #include "boost/assign.hpp" + + #include +@@ -73,13 +78,12 @@ using std::string; + // to be accessible. + PXR_NAMESPACE_OPEN_SCOPE + +-#ifdef _MSC_VER +-#pragma warning( disable:4003 ) // Following USD's lead, disable warning about not enough parameters for macro +-#endif ++ARCH_PRAGMA_PUSH ++ARCH_PRAGMA_MACRO_TOO_FEW_ARGUMENTS ++ + TF_DEFINE_PUBLIC_TOKENS( UsdSceneCacheFileFormatTokens, USD_SCENE_CACHE_FILE_FORMAT_TOKENS ); +-#ifdef _MSC_VER +-#pragma warning( default:4003 ) +-#endif ++ ++ARCH_PRAGMA_POP + + TF_REGISTRY_FUNCTION(TfType) + { +-- +2.33.1.windows.1 + diff --git a/Cycles/config.py b/Cycles/config.py index bce7f42029..5f5168bb54 100644 --- a/Cycles/config.py +++ b/Cycles/config.py @@ -43,4 +43,36 @@ ], + "platform:windows" : { + + "commands" : [ + + "mkdir build", + "cd build &&" + " cmake" + " -W-nodev -G {cmakeGenerator}" + " -D CMAKE_INSTALL_PREFIX={buildDir}/cycles" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D WITH_CYCLES_OPENIMAGEDENOISE=OFF" + " -D WITH_CYCLES_DEVICE_CUDA=OFF" + " -D WITH_CYCLES_DEVICE_OPTIX=OFF" + " -D CMAKE_POSITION_INDEPENDENT_CODE=ON" + " -D TBB_ROOT_DIR={buildDirFwd}" + " -D OPENVDB_ROOT_DIR={buildDirFwd}" + " -D NANOVDB_INCLUDE_DIR={buildDirFwd}/include" + " -D GLEW_ROOT_DIR={buildDirFwd}" + " ..", + "set PATH={buildDir}/lib;%PATH% && cd build && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "if not exist \"{buildDir}\\cycles\\bin\" mkdir {buildDir}\\cycles\\bin", + "if not exist \"{buildDir}\\cycles\\include\" mkdir {buildDir}\\cycles\\include", + "copy build\\bin\\cycles.* {buildDir}\\cycles\\bin", + "xcopy /sehyi build\\lib {buildDir}\\cycles\\lib", + "xcopy /sehyi third_party\\atomic\\* {buildDir}\\cycles\\include", + "xcopy /shyi src\\*.h K:\\build\\gaffer\\cycles\\include", + + ] + + } + } diff --git a/Cycles/patches/windows/001-library-locations.patch b/Cycles/patches/windows/001-library-locations.patch new file mode 100644 index 0000000000..042672809c --- /dev/null +++ b/Cycles/patches/windows/001-library-locations.patch @@ -0,0 +1,23 @@ +diff --git a/src/cmake/macros.cmake b/src/cmake/macros.cmake +index 11b32afd37..786d061599 100644 +--- a/src/cmake/macros.cmake ++++ b/src/cmake/macros.cmake +@@ -167,14 +167,14 @@ macro(cycles_install_libraries target) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install( + FILES +- ${TBB_ROOT_DIR}/bin/tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${OPENVDB_ROOT_DIR}/bin/openvdb_d${CMAKE_SHARED_LIBRARY_SUFFIX} ++ ${TBB_ROOT_DIR}/lib/tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX} ++ ${OPENVDB_ROOT_DIR}/lib/openvdb_d${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + install( + FILES +- ${TBB_ROOT_DIR}/bin/tbb${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${OPENVDB_ROOT_DIR}/bin/openvdb${CMAKE_SHARED_LIBRARY_SUFFIX} ++ ${TBB_ROOT_DIR}/lib/tbb${CMAKE_SHARED_LIBRARY_SUFFIX} ++ ${OPENVDB_ROOT_DIR}/lib/openvdb${CMAKE_SHARED_LIBRARY_SUFFIX} + DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif() + endif() diff --git a/Cycles/patches/windows/002-glew.patch b/Cycles/patches/windows/002-glew.patch new file mode 100644 index 0000000000..e23c4acd1f --- /dev/null +++ b/Cycles/patches/windows/002-glew.patch @@ -0,0 +1,13 @@ +diff --git /src/cmake/Modules/FindGLEW.cmake b/src/cmake/Modules/FindGLEW.cmake +index 33b989ec49..3c95738d74 100644 +--- a/src/cmake/Modules/FindGLEW.cmake ++++ b/src/cmake/Modules/FindGLEW.cmake +@@ -33,7 +33,7 @@ FIND_PATH(GLEW_INCLUDE_DIR + + FIND_LIBRARY(GLEW_LIBRARY + NAMES +- GLEW ++ GLEW glew32 + HINTS + ${_glew_SEARCH_DIRS} + PATH_SUFFIXES diff --git a/Cycles/patches/windows/002-glew.patchcd b/Cycles/patches/windows/002-glew.patchcd new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Embree/config.py b/Embree/config.py index efd9246234..1622f6dd87 100644 --- a/Embree/config.py +++ b/Embree/config.py @@ -41,4 +41,33 @@ ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && cmake" + " -G {cmakeGenerator}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D CMAKE_INSTALL_LIBDIR={buildDir}/lib" + " -D TBB_ROOT={buildDir}" + " -D EMBREE_STATIC_LIB=OFF" + " -D EMBREE_ISPC_SUPPORT=OFF" + " -D EMBREE_TUTORIALS=OFF" + " -D EMBREE_RAY_MASK=ON" + " -D EMBREE_FILTER_FUNCTION=ON" + " -D EMBREE_BACKFACE_CULLING=OFF" + " -D EMBREE_TASKING_SYSTEM=TBB" + + # " -D CMAKE_INSTALL_INCLUDEDIR={buildDir}/include" + # " -D CMAKE_INSTALL_DATAROOTDIR=" + # " -D CMAKE_INSTALL_DOCDIR=doc" + # " -D CMAKE_INSTALL_BINDIR=bin" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install", + ] + + }, + } diff --git a/FreeType/config.py b/FreeType/config.py index 1f454e4f26..469999ef43 100644 --- a/FreeType/config.py +++ b/FreeType/config.py @@ -28,8 +28,29 @@ "manifest" : [ "include/freetype2", - "lib/libfreetype*{sharedLibraryExtension}*", + "lib/{libraryPrefix}freetype*{sharedLibraryExtension}*", + "lib/{libraryPrefix}freetype*.lib*", ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE" + " ..", + # FreeType 2.9.1 does not copy the ftconfig.h header + # the binary directory, help it out here + "copy include\\freetype\\config\\ftconfig.h gafferBuild\\include\\freetype\\config\\ftconfig.h", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + + ] + + } } diff --git a/GLEW/config.py b/GLEW/config.py index 5c6e376761..22a734f476 100644 --- a/GLEW/config.py +++ b/GLEW/config.py @@ -19,8 +19,25 @@ "manifest" : [ "include/GL", - "lib/libGLEW*{sharedLibraryExtension}*", + "lib/{libraryPrefix}GLEW*{sharedLibraryExtension}*", + "lib/{libraryPrefix}GLEW*.lib", ], + "platform:windows" : { + + "commands" : [ + + "if not exist \"build\" mkdir build", + "cd build &&" + " cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -DCMAKE_INSTALL_PREFIX={buildDir}" + " ..\\build\\cmake", + "cd build && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}GLEW*{sharedLibraryExtension}* {buildDir}\\lib\\", + ] + + } } diff --git a/GafferResources/config.py b/GafferResources/config.py index a66ed41b71..89b7532fd1 100644 --- a/GafferResources/config.py +++ b/GafferResources/config.py @@ -21,5 +21,14 @@ "resources", ], + "platform:windows" : { + + "commands" : [ + + "xcopy /s /e /h /y /i resources {buildDir}\\resources", + + ], + + } } diff --git a/HDF5/config.py b/HDF5/config.py index 92bf5b1507..482e20a01c 100644 --- a/HDF5/config.py +++ b/HDF5/config.py @@ -21,8 +21,52 @@ "manifest" : [ - "lib/libhdf5*{sharedLibraryExtension}*", + "lib/{libraryPrefix}hdf5*{sharedLibraryExtension}*", + "lib/{libraryPrefix}hdf5*.lib", ], + + # Note that JOM can't be used due to it generating the following errors: + # [ 1%] Generating ../H5Tinit.c + # The process cannot access the file because it is being used by another process. + # [ 1%] Generating ../H5lib_settings.c + # jom: M:\gafferDependencies\HDF5\working\hdf5-1.8.20\build\src\CMakeFiles\hdf5-shared.dir\build.make [H5Tinit.c] Error 1 + # The process cannot access the file because it is being used by another process. + # jom: M:\gafferDependencies\HDF5\working\hdf5-1.8.20\build\src\CMakeFiles\hdf5-shared.dir\build.make [H5lib_settings.c] Error 1 + # Scanning dependencies of target hdf5-static + # jom: M:\gafferDependencies\HDF5\working\hdf5-1.8.20\build\CMakeFiles\Makefile2 [src\CMakeFiles\hdf5-shared.dir\all] Error 2 + # jom: M:\gafferDependencies\HDF5\working\hdf5-1.8.20\build\Makefile [all] Error 2 + + "platform:windows" : { + + "variables" : { + + "cmakeGenerator" : "\"Visual Studio 16 2019\"", + + }, + + "commands" : [ + "if not exist \"build\" mkdir build", + "cd build &&" + " cmake" + " -C ..\\config\\cmake\\cacheinit.cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D HDF5_ENABLE_THREADSAFE=ON" + " -D BUILD_SHARED_LIBS=ON" + " -D BUILD_TESTING=OFF" + " -D HDF5_BUILD_EXAMPLES=OFF" + " -D HDF5_BUILD_FORTRAN=OFF" + " -D HDF5_ENABLE_SZIP_SUPPORT=OFF" + " -D ZLIB_ROOT={buildDir}" + " -D BUILD_STATIC_LIBS=OFF" + " ..", + "cd build && cmake --build . --config {cmakeBuildType} --target install", + "copy {buildDir}\\bin\\{libraryPrefix}hdf5*{sharedLibraryExtension}* {buildDir}\\lib\\", + ], + + } } diff --git a/HDF5/patches/windows/h50mtime.patch b/HDF5/patches/windows/h50mtime.patch new file mode 100644 index 0000000000..30cb3f58f1 --- /dev/null +++ b/HDF5/patches/windows/h50mtime.patch @@ -0,0 +1,575 @@ +From 4078bf8d5c36212d63684284277bf4f9d114d6eb Mon Sep 17 00:00:00 2001 +From: Alex Fuller +Date: Sun, 17 Sep 2017 18:58:41 -0700 +Subject: [PATCH] Small MSVC 2015 fix for HDF5 + +--- + hdf5-1.8.20/src/H5Omtime.c | 556 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 556 insertions(+) + create mode 100644 hdf5-1.8.20/src/H5Omtime.c + +diff --git a/hdf5-1.8.20/src/H5Omtime.c b/hdf5-1.8.20/src/H5Omtime.c +new file mode 100644 +index 0000000000..71fca5f222 +--- /dev/null ++++ b/hdf5-1.8.20/src/H5Omtime.c +@@ -0,0 +1,556 @@ ++/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ++ * Copyright by The HDF Group. * ++ * Copyright by the Board of Trustees of the University of Illinois. * ++ * All rights reserved. * ++ * * ++ * This file is part of HDF5. The full HDF5 copyright notice, including * ++ * terms governing use, modification, and redistribution, is contained in * ++ * the files COPYING and Copyright.html. COPYING can be found at the root * ++ * of the source code distribution tree; Copyright.html can be found at the * ++ * root level of an installed copy of the electronic HDF5 document set and * ++ * is linked from the top-level documents page. It can also be found at * ++ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * ++ * access to either file, you may request a copy from help@hdfgroup.org. * ++ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ++ ++/* Programmer: Robb Matzke ++ * Friday, July 24, 1998 ++ * ++ * Purpose: The object modification time message. ++ */ ++ ++#define H5O_PACKAGE /*suppress error about including H5Opkg */ ++ ++#include "H5private.h" /* Generic Functions */ ++#include "H5Eprivate.h" /* Error handling */ ++#include "H5FLprivate.h" /* Free lists */ ++#include "H5MMprivate.h" /* Memory management */ ++#include "H5Opkg.h" /* Object headers */ ++ ++ ++static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, ++ unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); ++static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); ++static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); ++ ++static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, ++ unsigned mesg_flags, unsigned *ioflags, const uint8_t *p); ++static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); ++static void *H5O_mtime_copy(const void *_mesg, void *_dest); ++static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); ++static herr_t H5O_mtime_reset(void *_mesg); ++static herr_t H5O_mtime_free(void *_mesg); ++static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, ++ int indent, int fwidth); ++ ++/* This message derives from H5O message class */ ++const H5O_msg_class_t H5O_MSG_MTIME[1] = {{ ++ H5O_MTIME_ID, /*message id number */ ++ "mtime", /*message name for debugging */ ++ sizeof(time_t), /*native message size */ ++ 0, /* messages are sharable? */ ++ H5O_mtime_decode, /*decode message */ ++ H5O_mtime_encode, /*encode message */ ++ H5O_mtime_copy, /*copy the native value */ ++ H5O_mtime_size, /*raw message size */ ++ H5O_mtime_reset, /* reset method */ ++ H5O_mtime_free, /* free method */ ++ NULL, /* file delete method */ ++ NULL, /* link method */ ++ NULL, /*set share method */ ++ NULL, /*can share method */ ++ NULL, /* pre copy native value to file */ ++ NULL, /* copy native value to file */ ++ NULL, /* post copy native value to file */ ++ NULL, /* get creation index */ ++ NULL, /* set creation index */ ++ H5O_mtime_debug /*debug the message */ ++}}; ++ ++/* This message derives from H5O message class */ ++/* (Only encode, decode & size routines are different from old mtime routines) */ ++const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ ++ H5O_MTIME_NEW_ID, /*message id number */ ++ "mtime_new", /*message name for debugging */ ++ sizeof(time_t), /*native message size */ ++ 0, /* messages are sharable? */ ++ H5O_mtime_new_decode, /*decode message */ ++ H5O_mtime_new_encode, /*encode message */ ++ H5O_mtime_copy, /*copy the native value */ ++ H5O_mtime_new_size, /*raw message size */ ++ H5O_mtime_reset, /* reset method */ ++ H5O_mtime_free, /* free method */ ++ NULL, /* file delete method */ ++ NULL, /* link method */ ++ NULL, /*set share method */ ++ NULL, /*can share method */ ++ NULL, /* pre copy native value to file */ ++ NULL, /* copy native value to file */ ++ NULL, /* post copy native value to file */ ++ NULL, /* get creation index */ ++ NULL, /* set creation index */ ++ H5O_mtime_debug /*debug the message */ ++}}; ++ ++/* Current version of new mtime information */ ++#define H5O_MTIME_VERSION 1 ++ ++/* Track whether tzset routine was called */ ++static hbool_t ntzset = FALSE; ++ ++/* Declare a free list to manage the time_t struct */ ++H5FL_DEFINE(time_t); ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_new_decode ++ * ++ * Purpose: Decode a new modification time message and return a pointer to a ++ * new time_t value. ++ * ++ * Return: Success: Ptr to new message in native struct. ++ * ++ * Failure: NULL ++ * ++ * Programmer: Quincey Koziol ++ * koziol@ncsa.uiuc.edu ++ * Jan 3 2002 ++ * ++ *------------------------------------------------------------------------- ++ */ ++static void * ++H5O_mtime_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, ++ unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) ++{ ++ time_t *mesg; ++ uint32_t tmp_time; /* Temporary copy of the time */ ++ void *ret_value; /* Return value */ ++ ++ FUNC_ENTER_NOAPI_NOINIT ++ ++ /* check args */ ++ assert(f); ++ assert(p); ++ ++ /* decode */ ++ if(*p++ != H5O_MTIME_VERSION) ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for mtime message"); ++ ++ /* Skip reserved bytes */ ++ p+=3; ++ ++ /* Get the time_t from the file */ ++ UINT32DECODE(p, tmp_time); ++ ++ /* The return value */ ++ if (NULL==(mesg = H5FL_MALLOC(time_t))) ++ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); ++ *mesg = (time_t)tmp_time; ++ ++ /* Set return value */ ++ ret_value=mesg; ++ ++done: ++ FUNC_LEAVE_NOAPI(ret_value) ++} /* end H5O_mtime_new_decode() */ ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_decode ++ * ++ * Purpose: Decode a modification time message and return a pointer to a ++ * new time_t value. ++ * ++ * Return: Success: Ptr to new message in native struct. ++ * ++ * Failure: NULL ++ * ++ * Programmer: Robb Matzke ++ * matzke@llnl.gov ++ * Jul 24 1998 ++ * ++ *------------------------------------------------------------------------- ++ */ ++static void * ++H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, ++ unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p) ++{ ++ time_t *mesg, the_time; ++ int i; ++ struct tm tm; ++ void *ret_value; /* Return value */ ++ ++ FUNC_ENTER_NOAPI_NOINIT ++ ++ /* check args */ ++ HDassert(f); ++ HDassert(p); ++ ++ /* Initialize time zone information */ ++ if(!ntzset) { ++ HDtzset(); ++ ntzset = TRUE; ++ } /* end if */ ++ ++ /* decode */ ++ for(i = 0; i < 14; i++) ++ if(!HDisdigit(p[i])) ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") ++ ++ /* ++ * Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic ++ * because mktime() operates on local times. We convert to local time ++ * and then figure out the adjustment based on the local time zone and ++ * daylight savings setting. ++ */ ++ HDmemset(&tm, 0, sizeof tm); ++ tm.tm_year = (p[0]-'0')*1000 + (p[1]-'0')*100 + ++ (p[2]-'0')*10 + (p[3]-'0') - 1900; ++ tm.tm_mon = (p[4]-'0')*10 + (p[5]-'0') - 1; ++ tm.tm_mday = (p[6]-'0')*10 + (p[7]-'0'); ++ tm.tm_hour = (p[8]-'0')*10 + (p[9]-'0'); ++ tm.tm_min = (p[10]-'0')*10 + (p[11]-'0'); ++ tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0'); ++ tm.tm_isdst = -1; /*figure it out*/ ++ if((time_t)-1 == (the_time = HDmktime(&tm))) ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") ++ ++#if defined(H5_HAVE_TM_GMTOFF) ++ /* FreeBSD, OSF 4.0 */ ++ the_time += tm.tm_gmtoff; ++#elif defined(H5_HAVE___TM_GMTOFF) ++ /* Linux libc-4 */ ++ the_time += tm.__tm_gmtoff; ++#elif defined(H5_HAVE_TIMEZONE) ++ /* Linux libc-5 */ ++ /* Fix for MSVC >= 1900 */ ++#ifdef _MSC_VER >= 1900 ++ the_time -= _timezone - (tm.tm_isdst?3600:0); ++#else ++ the_time -= timezone - (tm.tm_isdst?3600:0); ++#endif ++#elif defined(H5_HAVE_BSDGETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) ++ /* Irix5.3 */ ++ { ++ struct timezone tz; ++ ++ if(HDBSDgettimeofday(NULL, &tz) < 0) ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") ++ the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); ++ } ++#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ) ++ { ++ struct timezone tz; ++ struct timeval tv; /* Used as a placebo; some systems don't like NULL */ ++ ++ if(HDgettimeofday(&tv, &tz) < 0) ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") ++ ++ the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); ++ } ++#else ++ /* ++ * The catch-all. If we can't convert a character string universal ++ * coordinated time to a time_t value reliably then we can't decode the ++ * modification time message. This really isn't as bad as it sounds -- the ++ * only way a user can get the modification time is from our internal ++ * query routines, which can gracefully recover. ++ */ ++ ++ /* Irix64 */ ++ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") ++#endif ++ ++ /* The return value */ ++ if(NULL == (mesg = H5FL_MALLOC(time_t))) ++ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") ++ *mesg = the_time; ++ ++ /* Set return value */ ++ ret_value = mesg; ++ ++done: ++ FUNC_LEAVE_NOAPI(ret_value) ++} /* end H5O_mtime_decode() */ ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_new_encode ++ * ++ * Purpose: Encodes a new modification time message. ++ * ++ * Return: Non-negative on success/Negative on failure ++ * ++ * Programmer: Quincey Koziol ++ * koziol@ncsa.uiuc.edu ++ * Jan 3 2002 ++ * ++ *------------------------------------------------------------------------- ++ */ ++static herr_t ++H5O_mtime_new_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) ++{ ++ const time_t *mesg = (const time_t *) _mesg; ++ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ /* check args */ ++ assert(f); ++ assert(p); ++ assert(mesg); ++ ++ /* Version */ ++ *p++ = H5O_MTIME_VERSION; ++ ++ /* Reserved bytes */ ++ *p++ = 0; ++ *p++ = 0; ++ *p++ = 0; ++ ++ /* Encode time */ ++ UINT32ENCODE(p, *mesg); ++ ++ FUNC_LEAVE_NOAPI(SUCCEED) ++} /* end H5O_mtime_new_encode() */ ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_encode ++ * ++ * Purpose: Encodes a modification time message. ++ * ++ * Return: Non-negative on success/Negative on failure ++ * ++ * Programmer: Robb Matzke ++ * matzke@llnl.gov ++ * Jul 24 1998 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static herr_t ++H5O_mtime_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg) ++{ ++ const time_t *mesg = (const time_t *) _mesg; ++ struct tm *tm; ++ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ /* check args */ ++ assert(f); ++ assert(p); ++ assert(mesg); ++ ++ /* encode */ ++ tm = HDgmtime(mesg); ++ sprintf((char*)p, "%04d%02d%02d%02d%02d%02d", ++ 1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday, ++ tm->tm_hour, tm->tm_min, tm->tm_sec); ++ ++ FUNC_LEAVE_NOAPI(SUCCEED) ++} ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_copy ++ * ++ * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if ++ * necessary. ++ * ++ * Return: Success: Ptr to _DEST ++ * ++ * Failure: NULL ++ * ++ * Programmer: Robb Matzke ++ * matzke@llnl.gov ++ * Jul 24 1998 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static void * ++H5O_mtime_copy(const void *_mesg, void *_dest) ++{ ++ const time_t *mesg = (const time_t *) _mesg; ++ time_t *dest = (time_t *) _dest; ++ void *ret_value; /* Return value */ ++ ++ FUNC_ENTER_NOAPI_NOINIT ++ ++ /* check args */ ++ assert(mesg); ++ if (!dest && NULL==(dest = H5FL_MALLOC(time_t))) ++ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); ++ ++ /* copy */ ++ *dest = *mesg; ++ ++ /* Set return value */ ++ ret_value=dest; ++ ++done: ++ FUNC_LEAVE_NOAPI(ret_value) ++} ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_new_size ++ * ++ * Purpose: Returns the size of the raw message in bytes not ++ * counting the message type or size fields, but only the data ++ * fields. This function doesn't take into account ++ * alignment. ++ * ++ * Return: Success: Message data size in bytes w/o alignment. ++ * ++ * Failure: 0 ++ * ++ * Programmer: Quincey Koziol ++ * koziol@ncsa.uiuc.edu ++ * Jan 3 2002 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static size_t ++H5O_mtime_new_size(const H5F_t UNUSED * f, hbool_t UNUSED disable_shared, const void UNUSED * mesg) ++{ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ /* check args */ ++ assert(f); ++ assert(mesg); ++ ++ FUNC_LEAVE_NOAPI(8) ++} /* end H5O_mtime_new_size() */ ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_size ++ * ++ * Purpose: Returns the size of the raw message in bytes not ++ * counting the message type or size fields, but only the data ++ * fields. This function doesn't take into account ++ * alignment. ++ * ++ * Return: Success: Message data size in bytes w/o alignment. ++ * ++ * Failure: 0 ++ * ++ * Programmer: Robb Matzke ++ * matzke@llnl.gov ++ * Jul 14 1998 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static size_t ++H5O_mtime_size(const H5F_t UNUSED * f, hbool_t UNUSED disable_shared, const void UNUSED * mesg) ++{ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ /* check args */ ++ assert(f); ++ assert(mesg); ++ ++ FUNC_LEAVE_NOAPI(16) ++} ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_reset ++ * ++ * Purpose: Frees resources within a modification time message, but doesn't free ++ * the message itself. ++ * ++ * Return: Non-negative on success/Negative on failure ++ * ++ * Programmer: Quincey Koziol ++ * Mondey, December 23, 2002 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static herr_t ++H5O_mtime_reset(void UNUSED *_mesg) ++{ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ FUNC_LEAVE_NOAPI(SUCCEED) ++} ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_free ++ * ++ * Purpose: Free's the message ++ * ++ * Return: Non-negative on success/Negative on failure ++ * ++ * Programmer: Quincey Koziol ++ * Thursday, March 30, 2000 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static herr_t ++H5O_mtime_free(void *mesg) ++{ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ HDassert(mesg); ++ ++ mesg = H5FL_FREE(time_t, mesg); ++ ++ FUNC_LEAVE_NOAPI(SUCCEED) ++} /* end H5O_mtime_free() */ ++ ++ ++/*------------------------------------------------------------------------- ++ * Function: H5O_mtime_debug ++ * ++ * Purpose: Prints debugging info for the message. ++ * ++ * Return: Non-negative on success/Negative on failure ++ * ++ * Programmer: Robb Matzke ++ * matzke@llnl.gov ++ * Jul 24 1998 ++ * ++ * Modifications: ++ * ++ *------------------------------------------------------------------------- ++ */ ++static herr_t ++H5O_mtime_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *stream, ++ int indent, int fwidth) ++{ ++ const time_t *mesg = (const time_t *)_mesg; ++ struct tm *tm; ++ char buf[128]; ++ ++ FUNC_ENTER_NOAPI_NOINIT_NOERR ++ ++ /* check args */ ++ assert(f); ++ assert(mesg); ++ assert(stream); ++ assert(indent >= 0); ++ assert(fwidth >= 0); ++ ++ /* debug */ ++ tm = HDlocaltime(mesg); ++ ++ HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); ++ fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, ++ "Time:", buf); ++ ++ FUNC_LEAVE_NOAPI(SUCCEED) ++} ++ +-- +2.15.1.windows.2 + diff --git a/HDF5/patches/windows/long_long_test_fix.patch b/HDF5/patches/windows/long_long_test_fix.patch new file mode 100644 index 0000000000..286c279e84 --- /dev/null +++ b/HDF5/patches/windows/long_long_test_fix.patch @@ -0,0 +1,1695 @@ +From eea38538c65f52abceb4edbb22527779a150cc4e Mon Sep 17 00:00:00 2001 +From: Eric Mehl +Date: Thu, 15 Mar 2018 20:37:56 -0400 +Subject: [PATCH] change long_long tests to allow windows to build without + popups + +--- + hdf5-1.8.20/config/cmake/ConfigureChecks.cmake | 1176 ++++++++++++++++++++++++ + hdf5-1.8.20/config/cmake/HDF5Tests.c | 491 ++++++++++ + 2 files changed, 1667 insertions(+) + create mode 100644 hdf5-1.8.20/config/cmake/ConfigureChecks.cmake + create mode 100644 hdf5-1.8.20/config/cmake/HDF5Tests.c + +diff --git a/hdf5-1.8.20/config/cmake/ConfigureChecks.cmake b/hdf5-1.8.20/config/cmake/ConfigureChecks.cmake +new file mode 100644 +index 0000000000..4227157a2a +--- /dev/null ++++ b/hdf5-1.8.20/config/cmake/ConfigureChecks.cmake +@@ -0,0 +1,1176 @@ ++#----------------------------------------------------------------------------- ++# Include all the necessary files for macros ++#----------------------------------------------------------------------------- ++INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) ++INCLUDE (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) ++ ++#----------------------------------------------------------------------------- ++# APPLE/Darwin setup ++#----------------------------------------------------------------------------- ++IF (APPLE) ++ LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) ++ IF(ARCH_LENGTH GREATER 1) ++ set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE) ++ message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" ++ "due to technical reasons. The best approach would be build each architecture in separate directories" ++ "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'" ++ "variable has been set to a blank value which will build the default architecture for this system.") ++ ENDIF() ++ SET (H5_AC_APPLE_UNIVERSAL_BUILD 0) ++ENDIF (APPLE) ++ ++# Check for Darwin (not just Apple - we also want to catch OpenDarwin) ++IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ++ SET (H5_HAVE_DARWIN 1) ++ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ++ ++#----------------------------------------------------------------------------- ++# Option to Clear File Buffers before write --enable-clear-file-buffers ++#----------------------------------------------------------------------------- ++OPTION (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) ++IF (HDF5_Enable_Clear_File_Buffers) ++ SET (H5_CLEAR_MEMORY 1) ++ENDIF (HDF5_Enable_Clear_File_Buffers) ++MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) ++ ++#----------------------------------------------------------------------------- ++# Option for --enable-strict-format-checks ++#----------------------------------------------------------------------------- ++OPTION (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) ++IF (HDF5_STRICT_FORMAT_CHECKS) ++ SET (H5_STRICT_FORMAT_CHECKS 1) ++ENDIF (HDF5_STRICT_FORMAT_CHECKS) ++MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) ++ ++#----------------------------------------------------------------------------- ++# Option for --enable-metadata-trace-file ++#----------------------------------------------------------------------------- ++OPTION (HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF) ++IF (HDF5_METADATA_TRACE_FILE) ++ SET (H5_METADATA_TRACE_FILE 1) ++ENDIF (HDF5_METADATA_TRACE_FILE) ++MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) ++ ++# ---------------------------------------------------------------------- ++# Decide whether the data accuracy has higher priority during data ++# conversions. If not, some hard conversions will still be prefered even ++# though the data may be wrong (for example, some compilers don't ++# support denormalized floating values) to maximize speed. ++# ++OPTION (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) ++IF (HDF5_WANT_DATA_ACCURACY) ++ SET (H5_WANT_DATA_ACCURACY 1) ++ENDIF(HDF5_WANT_DATA_ACCURACY) ++MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) ++ ++# ---------------------------------------------------------------------- ++# Decide whether the presence of user's exception handling functions is ++# checked and data conversion exceptions are returned. This is mainly ++# for the speed optimization of hard conversions. Soft conversions can ++# actually benefit little. ++# ++OPTION (HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON) ++IF (HDF5_WANT_DCONV_EXCEPTION) ++ SET (H5_WANT_DCONV_EXCEPTION 1) ++ENDIF (HDF5_WANT_DCONV_EXCEPTION) ++MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) ++ ++# ---------------------------------------------------------------------- ++# Check if they would like the function stack support compiled in ++# ++OPTION (HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF) ++IF (HDF5_ENABLE_CODESTACK) ++ SET (H5_HAVE_CODESTACK 1) ++ENDIF (HDF5_ENABLE_CODESTACK) ++MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) ++ ++OPTION (HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON) ++ ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can handle converting ++# floating-point to long long values. ++# (This flag should be _unset_ for all machines) ++# ++# SET (H5_HW_FP_TO_LLONG_NOT_WORKS 0) ++ ++# so far we have no check for this ++SET(H5_HAVE_TMPFILE 1) ++ ++#----------------------------------------------------------------------------- ++# This MACRO checks IF the symbol exists in the library and IF it ++# does, it appends library to the list. ++#----------------------------------------------------------------------------- ++SET (LINK_LIBS "") ++MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) ++ CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) ++ IF (${VARIABLE}) ++ SET (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) ++ ENDIF (${VARIABLE}) ++ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT) ++ ++# ---------------------------------------------------------------------- ++# WINDOWS Hard code Values ++# ---------------------------------------------------------------------- ++ ++SET (WINDOWS) ++IF (WIN32) ++ IF (MINGW) ++ SET (H5_HAVE_MINGW 1) ++ SET (WINDOWS 1) # MinGW tries to imitate Windows ++ SET (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") ++ ENDIF (MINGW) ++ SET (H5_HAVE_WIN32_API 1) ++ SET (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") ++ IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) ++ SET (WINDOWS 1) ++ SET (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") ++ IF (MSVC) ++ SET (H5_HAVE_VISUAL_STUDIO 1) ++ ENDIF (MSVC) ++ ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW) ++ENDIF (WIN32) ++ ++#IF (WIN32) ++# SET (DEFAULT_STREAM_VFD OFF) ++#ELSE (WIN32) ++# SET (DEFAULT_STREAM_VFD ON) ++#ENDIF (WIN32) ++#OPTION (HDF5_STREAM_VFD "Compile Stream Virtual File Driver support" ${DEFAULT_STREAM_VFD}) ++ ++# TODO -------------------------------------------------------------------------- ++# Should the Default Virtual File Driver be compiled? ++# This is hard-coded now but option should added to match configure ++# ++SET (H5_DEFAULT_VFD H5FD_SEC2) ++ ++IF (WINDOWS) ++ SET (H5_HAVE_WINDOWS 1) ++ # ---------------------------------------------------------------------- ++ # Set the flag to indicate that the machine has window style pathname, ++ # that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). ++ # (This flag should be _unset_ for all machines, except for Windows) ++ SET (H5_HAVE_WINDOW_PATH 1) ++ENDIF (WINDOWS) ++ ++IF (WINDOWS) ++ SET (H5_HAVE_STDDEF_H 1) ++ SET (H5_HAVE_SYS_STAT_H 1) ++ SET (H5_HAVE_SYS_TYPES_H 1) ++ SET (H5_HAVE_LIBM 1) ++ SET (H5_HAVE_STRDUP 1) ++ SET (H5_HAVE_SYSTEM 1) ++ SET (H5_HAVE_LONGJMP 1) ++ IF (NOT MINGW) ++ SET (H5_HAVE_GETHOSTNAME 1) ++ ENDIF (NOT MINGW) ++ SET (H5_HAVE_GETCONSOLESCREENBUFFERINFO 1) ++ SET (H5_HAVE_FUNCTION 1) ++ SET (H5_GETTIMEOFDAY_GIVES_TZ 1) ++ SET (H5_HAVE_TIMEZONE 1) ++ SET (H5_HAVE_GETTIMEOFDAY 1) ++ SET (H5_LONE_COLON 0) ++ IF (MINGW) ++ SET (H5_HAVE_WINSOCK2_H 1) ++ ENDIF (MINGW) ++ SET (H5_HAVE_LIBWS2_32 1) ++ SET (H5_HAVE_LIBWSOCK32 1) ++ENDIF (WINDOWS) ++ ++#----------------------------------------------------------------------------- ++# These tests need to be manually SET for windows since there is currently ++# something not quite correct with the actual test implementation. This affects ++# the 'dt_arith' test and most likely lots of other code ++# ---------------------------------------------------------------------------- ++SET (H5_FP_TO_ULLONG_RIGHT_MAXIMUM "" CACHE INTERNAL "") ++ ++# ---------------------------------------------------------------------- ++# END of WINDOWS Hard code Values ++# ---------------------------------------------------------------------- ++ ++IF (CYGWIN) ++ SET (H5_HAVE_LSEEK64 0) ++ENDIF (CYGWIN) ++ ++#----------------------------------------------------------------------------- ++# Check for the math library "m" ++#----------------------------------------------------------------------------- ++IF (NOT WINDOWS) ++ CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil H5_HAVE_LIBM) ++ CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen H5_HAVE_LIBDL) ++ CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32) ++ CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32) ++ENDIF (NOT WINDOWS) ++ ++CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname H5_HAVE_LIBUCB) ++CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect H5_HAVE_LIBSOCKET) ++CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL) ++ ++IF (NOT NOT_NEED_LIBNSL) ++ CHECK_LIBRARY_EXISTS_CONCAT ("nsl" gethostbyname H5_HAVE_LIBNSL) ++ENDIF (NOT NOT_NEED_LIBNSL) ++ ++# For other tests to use the same libraries ++SET (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS}) ++ ++SET (USE_INCLUDES "") ++IF (WINDOWS) ++ SET (USE_INCLUDES ${USE_INCLUDES} "windows.h") ++ENDIF (WINDOWS) ++ ++IF (NOT WINDOWS) ++ TEST_BIG_ENDIAN(H5_WORDS_BIGENDIAN) ++ENDIF (NOT WINDOWS) ++ ++# For other specific tests, use this MACRO. ++MACRO (HDF5_FUNCTION_TEST OTHER_TEST) ++ IF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") ++ SET (OTHER_TEST_ADD_LIBRARIES) ++ IF (CMAKE_REQUIRED_LIBRARIES) ++ SET (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") ++ ENDIF (CMAKE_REQUIRED_LIBRARIES) ++ ++ FOREACH (def ${HDF5_EXTRA_TEST_DEFINITIONS}) ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") ++ ENDFOREACH (def) ++ ++ FOREACH (def ++ HAVE_SYS_TIME_H ++ HAVE_UNISTD_H ++ HAVE_SYS_TYPES_H ++ HAVE_SYS_SOCKET_H ++ ) ++ IF ("${H5_${def}}") ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") ++ ENDIF ("${H5_${def}}") ++ ENDFOREACH (def) ++ ++ IF (LARGEFILE) ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS ++ "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ++ ) ++ ENDIF (LARGEFILE) ++ ++ #MESSAGE (STATUS "Performing ${OTHER_TEST}") ++ TRY_COMPILE (${OTHER_TEST} ++ ${CMAKE_BINARY_DIR} ++ ${HDF5_RESOURCES_DIR}/HDF5Tests.c ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ++ "${OTHER_TEST_ADD_LIBRARIES}" ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (${OTHER_TEST}) ++ SET (H5_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") ++ MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Success") ++ ELSE (${OTHER_TEST}) ++ MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Failed") ++ SET (H5_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Performing Other Test ${OTHER_TEST} failed with the following output:\n" ++ "${OUTPUT}\n" ++ ) ++ ENDIF (${OTHER_TEST}) ++ ENDIF ("H5_${OTHER_TEST}" MATCHES "^H5_${OTHER_TEST}$") ++ENDMACRO (HDF5_FUNCTION_TEST) ++ ++#----------------------------------------------------------------------------- ++# Check for these functions before the time headers are checked ++#----------------------------------------------------------------------------- ++HDF5_FUNCTION_TEST (STDC_HEADERS) ++ ++CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME) ++#CHECK_FUNCTION_EXISTS (gettimeofday H5_HAVE_GETTIMEOFDAY) ++# Since gettimeofday is not defined any where standard, lets look in all the ++# usual places. On MSVC we are just going to use ::clock() ++IF (NOT MSVC) ++ IF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") ++ TRY_COMPILE (HAVE_TIME_GETTIMEOFDAY ++ ${CMAKE_BINARY_DIR} ++ ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp ++ COMPILE_DEFINITIONS -DTRY_TIME_H ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") ++ SET (H5_HAVE_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_TIME_GETTIMEOFDAY") ++ SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") ++ ENDIF (HAVE_TIME_GETTIMEOFDAY STREQUAL "TRUE") ++ ENDIF ("H5_HAVE_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_TIME_GETTIMEOFDAY$") ++ ++ IF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") ++ TRY_COMPILE (HAVE_SYS_TIME_GETTIMEOFDAY ++ ${CMAKE_BINARY_DIR} ++ ${HDF5_RESOURCES_DIR}/GetTimeOfDayTest.cpp ++ COMPILE_DEFINITIONS -DTRY_SYS_TIME_H ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") ++ SET (H5_HAVE_SYS_TIME_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_SYS_TIME_GETTIMEOFDAY") ++ SET (H5_HAVE_GETTIMEOFDAY "1" CACHE INTERNAL "H5_HAVE_GETTIMEOFDAY") ++ ENDIF (HAVE_SYS_TIME_GETTIMEOFDAY STREQUAL "TRUE") ++ ENDIF ("H5_HAVE_SYS_TIME_GETTIMEOFDAY" MATCHES "^H5_HAVE_SYS_TIME_GETTIMEOFDAY$") ++ ++ IF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) ++ MESSAGE (STATUS "---------------------------------------------------------------") ++ MESSAGE (STATUS "Function 'gettimeofday()' was not found. HDF5 will use its") ++ MESSAGE (STATUS " own implementation.. This can happen on older versions of") ++ MESSAGE (STATUS " MinGW on Windows. Consider upgrading your MinGW installation") ++ MESSAGE (STATUS " to a newer version such as MinGW 3.12") ++ MESSAGE (STATUS "---------------------------------------------------------------") ++ ENDIF (NOT HAVE_SYS_TIME_GETTIMEOFDAY AND NOT H5_HAVE_GETTIMEOFDAY) ++ENDIF (NOT MSVC) ++ ++# Find the library containing clock_gettime() ++IF (NOT WINDOWS) ++ CHECK_FUNCTION_EXISTS(clock_gettime CLOCK_GETTIME_IN_LIBC) ++ CHECK_LIBRARY_EXISTS(rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) ++ CHECK_LIBRARY_EXISTS(posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) ++ IF(CLOCK_GETTIME_IN_LIBC) ++ SET(H5_HAVE_CLOCK_GETTIME 1) ++ ELSEIF(CLOCK_GETTIME_IN_LIBRT) ++ SET(H5_HAVE_CLOCK_GETTIME 1) ++ LIST(APPEND LINK_LIBS rt) ++ ELSEIF(CLOCK_GETTIME_IN_LIBPOSIX4) ++ SET(H5_HAVE_CLOCK_GETTIME 1) ++ LIST(APPEND LINK_LIBS posix4) ++ ENDIF(CLOCK_GETTIME_IN_LIBC) ++ENDIF (NOT WINDOWS) ++#----------------------------------------------------------------------------- ++ ++#----------------------------------------------------------------------------- ++# Check IF header file exists and add it to the list. ++#----------------------------------------------------------------------------- ++MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) ++ CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) ++ IF (${VARIABLE}) ++ SET (USE_INCLUDES ${USE_INCLUDES} ${FILE}) ++ ENDIF (${VARIABLE}) ++ENDMACRO (CHECK_INCLUDE_FILE_CONCAT) ++ ++#----------------------------------------------------------------------------- ++# Check for the existence of certain header files ++#----------------------------------------------------------------------------- ++CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" H5_HAVE_SYS_RESOURCE_H) ++CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" H5_HAVE_SYS_TIME_H) ++CHECK_INCLUDE_FILE_CONCAT ("unistd.h" H5_HAVE_UNISTD_H) ++CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" H5_HAVE_SYS_IOCTL_H) ++CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" H5_HAVE_SYS_STAT_H) ++CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" H5_HAVE_SYS_SOCKET_H) ++CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" H5_HAVE_SYS_TYPES_H) ++CHECK_INCLUDE_FILE_CONCAT ("stddef.h" H5_HAVE_STDDEF_H) ++CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" H5_HAVE_SETJMP_H) ++CHECK_INCLUDE_FILE_CONCAT ("features.h" H5_HAVE_FEATURES_H) ++CHECK_INCLUDE_FILE_CONCAT ("dirent.h" H5_HAVE_DIRENT_H) ++CHECK_INCLUDE_FILE_CONCAT ("stdint.h" H5_HAVE_STDINT_H) ++ ++# IF the c compiler found stdint, check the C++ as well. On some systems this ++# file will be found by C but not C++, only do this test IF the C++ compiler ++# has been initialized (e.g. the project also includes some c++) ++IF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) ++ CHECK_INCLUDE_FILE_CXX ("stdint.h" H5_HAVE_STDINT_H_CXX) ++ IF (NOT H5_HAVE_STDINT_H_CXX) ++ SET (H5_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") ++ SET (USE_INCLUDES ${USE_INCLUDES} "stdint.h") ++ ENDIF (NOT H5_HAVE_STDINT_H_CXX) ++ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) ++ ++# Darwin ++CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" H5_HAVE_MACH_MACH_TIME_H) ++ ++# Windows ++CHECK_INCLUDE_FILE_CONCAT ("io.h" H5_HAVE_IO_H) ++IF (NOT CYGWIN) ++ CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" H5_HAVE_WINSOCK2_H) ++ENDIF (NOT CYGWIN) ++CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" H5_HAVE_SYS_TIMEB_H) ++ ++IF (CMAKE_SYSTEM_NAME MATCHES "OSF") ++ CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" H5_HAVE_SYS_SYSINFO_H) ++ CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" H5_HAVE_SYS_PROC_H) ++ELSE (CMAKE_SYSTEM_NAME MATCHES "OSF") ++ SET (H5_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) ++ SET (H5_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) ++ENDIF (CMAKE_SYSTEM_NAME MATCHES "OSF") ++ ++CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" H5_HAVE_GLOBUS_COMMON_H) ++CHECK_INCLUDE_FILE_CONCAT ("pdb.h" H5_HAVE_PDB_H) ++CHECK_INCLUDE_FILE_CONCAT ("pthread.h" H5_HAVE_PTHREAD_H) ++CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" H5_HAVE_SRBCLIENT_H) ++CHECK_INCLUDE_FILE_CONCAT ("string.h" H5_HAVE_STRING_H) ++CHECK_INCLUDE_FILE_CONCAT ("strings.h" H5_HAVE_STRINGS_H) ++CHECK_INCLUDE_FILE_CONCAT ("time.h" H5_HAVE_TIME_H) ++CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" H5_HAVE_STDLIB_H) ++CHECK_INCLUDE_FILE_CONCAT ("memory.h" H5_HAVE_MEMORY_H) ++CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" H5_HAVE_DLFCN_H) ++CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" H5_HAVE_INTTYPES_H) ++CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" H5_HAVE_NETINET_IN_H) ++ ++#----------------------------------------------------------------------------- ++# Check for large file support ++#----------------------------------------------------------------------------- ++ ++# The linux-lfs option is deprecated. ++SET (LINUX_LFS 0) ++ ++SET (HDF5_EXTRA_C_FLAGS) ++SET (HDF5_EXTRA_FLAGS) ++IF (NOT WINDOWS) ++ # Linux Specific flags ++ # This was originally defined as _POSIX_SOURCE which was updated to ++ # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX ++ # functionality so clock_gettime and CLOCK_MONOTONIC are defined ++ # correctly. ++ # POSIX feature information can be found in the gcc manual at: ++ # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html ++ SET (HDF5_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L) ++ SET (HDF5_EXTRA_FLAGS -D_BSD_SOURCE) ++ ++ OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) ++ IF (HDF5_ENABLE_LARGE_FILE) ++ SET (msg "Performing TEST_LFS_WORKS") ++ TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ++ ${HDF5_BINARY_DIR}/CMake ++ ${HDF5_RESOURCES_DIR}/HDF5Tests.c ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (TEST_LFS_WORKS_COMPILE) ++ IF (TEST_LFS_WORKS_RUN MATCHES 0) ++ SET (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) ++ SET (LARGEFILE 1) ++ SET (HDF5_EXTRA_FLAGS ${HDF5_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) ++ MESSAGE (STATUS "${msg}... yes") ++ ELSE (TEST_LFS_WORKS_RUN MATCHES 0) ++ SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" ++ ) ++ ENDIF (TEST_LFS_WORKS_RUN MATCHES 0) ++ ELSE (TEST_LFS_WORKS_COMPILE ) ++ SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" ++ ) ++ ENDIF (TEST_LFS_WORKS_COMPILE) ++ ENDIF (HDF5_ENABLE_LARGE_FILE) ++ SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF5_EXTRA_FLAGS}) ++ENDIF (NOT WINDOWS) ++ ++ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS}) ++ ++#----------------------------------------------------------------------------- ++# Check for HAVE_OFF64_T functionality ++#----------------------------------------------------------------------------- ++IF (NOT WINDOWS OR MINGW) ++ HDF5_FUNCTION_TEST (HAVE_OFF64_T) ++ IF (H5_HAVE_OFF64_T) ++ CHECK_FUNCTION_EXISTS (lseek64 H5_HAVE_LSEEK64) ++ CHECK_FUNCTION_EXISTS (fseeko64 H5_HAVE_FSEEKO64) ++ CHECK_FUNCTION_EXISTS (ftello64 H5_HAVE_FTELLO64) ++ CHECK_FUNCTION_EXISTS (ftruncate64 H5_HAVE_FTRUNCATE64) ++ ENDIF (H5_HAVE_OFF64_T) ++ ++ CHECK_FUNCTION_EXISTS (fseeko H5_HAVE_FSEEKO) ++ CHECK_FUNCTION_EXISTS (ftello H5_HAVE_FTELLO) ++ ++ HDF5_FUNCTION_TEST (HAVE_STAT64_STRUCT) ++ IF (HAVE_STAT64_STRUCT) ++ CHECK_FUNCTION_EXISTS (fstat64 H5_HAVE_FSTAT64) ++ CHECK_FUNCTION_EXISTS (stat64 H5_HAVE_STAT64) ++ ENDIF (HAVE_STAT64_STRUCT) ++ENDIF (NOT WINDOWS OR MINGW) ++ ++#----------------------------------------------------------------------------- ++# Check the size in bytes of all the int and float types ++#----------------------------------------------------------------------------- ++MACRO (H5_CHECK_TYPE_SIZE type var) ++ SET (aType ${type}) ++ SET (aVar ${var}) ++# MESSAGE (STATUS "Checking size of ${aType} and storing into ${aVar}") ++ CHECK_TYPE_SIZE (${aType} ${aVar}) ++ IF (NOT ${aVar}) ++ SET (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") ++# MESSAGE (STATUS "Size of ${aType} was NOT Found") ++ ENDIF (NOT ${aVar}) ++ENDMACRO (H5_CHECK_TYPE_SIZE) ++ ++H5_CHECK_TYPE_SIZE (char H5_SIZEOF_CHAR) ++H5_CHECK_TYPE_SIZE (short H5_SIZEOF_SHORT) ++H5_CHECK_TYPE_SIZE (int H5_SIZEOF_INT) ++H5_CHECK_TYPE_SIZE (unsigned H5_SIZEOF_UNSIGNED) ++IF (NOT APPLE) ++ H5_CHECK_TYPE_SIZE (long H5_SIZEOF_LONG) ++ENDIF (NOT APPLE) ++H5_CHECK_TYPE_SIZE ("long long" H5_SIZEOF_LONG_LONG) ++H5_CHECK_TYPE_SIZE (__int64 H5_SIZEOF___INT64) ++IF (NOT H5_SIZEOF___INT64) ++ SET (H5_SIZEOF___INT64 0) ++ENDIF (NOT H5_SIZEOF___INT64) ++ ++H5_CHECK_TYPE_SIZE (float H5_SIZEOF_FLOAT) ++H5_CHECK_TYPE_SIZE (double H5_SIZEOF_DOUBLE) ++H5_CHECK_TYPE_SIZE ("long double" H5_SIZEOF_LONG_DOUBLE) ++ ++H5_CHECK_TYPE_SIZE (int8_t H5_SIZEOF_INT8_T) ++H5_CHECK_TYPE_SIZE (uint8_t H5_SIZEOF_UINT8_T) ++H5_CHECK_TYPE_SIZE (int_least8_t H5_SIZEOF_INT_LEAST8_T) ++H5_CHECK_TYPE_SIZE (uint_least8_t H5_SIZEOF_UINT_LEAST8_T) ++H5_CHECK_TYPE_SIZE (int_fast8_t H5_SIZEOF_INT_FAST8_T) ++H5_CHECK_TYPE_SIZE (uint_fast8_t H5_SIZEOF_UINT_FAST8_T) ++ ++H5_CHECK_TYPE_SIZE (int16_t H5_SIZEOF_INT16_T) ++H5_CHECK_TYPE_SIZE (uint16_t H5_SIZEOF_UINT16_T) ++H5_CHECK_TYPE_SIZE (int_least16_t H5_SIZEOF_INT_LEAST16_T) ++H5_CHECK_TYPE_SIZE (uint_least16_t H5_SIZEOF_UINT_LEAST16_T) ++H5_CHECK_TYPE_SIZE (int_fast16_t H5_SIZEOF_INT_FAST16_T) ++H5_CHECK_TYPE_SIZE (uint_fast16_t H5_SIZEOF_UINT_FAST16_T) ++ ++H5_CHECK_TYPE_SIZE (int32_t H5_SIZEOF_INT32_T) ++H5_CHECK_TYPE_SIZE (uint32_t H5_SIZEOF_UINT32_T) ++H5_CHECK_TYPE_SIZE (int_least32_t H5_SIZEOF_INT_LEAST32_T) ++H5_CHECK_TYPE_SIZE (uint_least32_t H5_SIZEOF_UINT_LEAST32_T) ++H5_CHECK_TYPE_SIZE (int_fast32_t H5_SIZEOF_INT_FAST32_T) ++H5_CHECK_TYPE_SIZE (uint_fast32_t H5_SIZEOF_UINT_FAST32_T) ++ ++H5_CHECK_TYPE_SIZE (int64_t H5_SIZEOF_INT64_T) ++H5_CHECK_TYPE_SIZE (uint64_t H5_SIZEOF_UINT64_T) ++H5_CHECK_TYPE_SIZE (int_least64_t H5_SIZEOF_INT_LEAST64_T) ++H5_CHECK_TYPE_SIZE (uint_least64_t H5_SIZEOF_UINT_LEAST64_T) ++H5_CHECK_TYPE_SIZE (int_fast64_t H5_SIZEOF_INT_FAST64_T) ++H5_CHECK_TYPE_SIZE (uint_fast64_t H5_SIZEOF_UINT_FAST64_T) ++ ++IF (NOT APPLE) ++ H5_CHECK_TYPE_SIZE (size_t H5_SIZEOF_SIZE_T) ++ H5_CHECK_TYPE_SIZE (ssize_t H5_SIZEOF_SSIZE_T) ++ IF (NOT H5_SIZEOF_SSIZE_T) ++ SET (H5_SIZEOF_SSIZE_T 0) ++ ENDIF (NOT H5_SIZEOF_SSIZE_T) ++ H5_CHECK_TYPE_SIZE (ptrdiff_t H5_SIZEOF_PTRDIFF_T) ++ENDIF (NOT APPLE) ++ ++H5_CHECK_TYPE_SIZE (off_t H5_SIZEOF_OFF_T) ++H5_CHECK_TYPE_SIZE (off64_t H5_SIZEOF_OFF64_T) ++IF (NOT H5_SIZEOF_OFF64_T) ++ SET (H5_SIZEOF_OFF64_T 0) ++ENDIF (NOT H5_SIZEOF_OFF64_T) ++ ++IF (NOT WINDOWS) ++ #----------------------------------------------------------------------------- ++ # Check if the dev_t type is a scalar type ++ #----------------------------------------------------------------------------- ++ HDF5_FUNCTION_TEST (DEV_T_IS_SCALAR) ++ ++ # ---------------------------------------------------------------------- ++ # Check for MONOTONIC_TIMER support (used in clock_gettime). This has ++ # to be done after any POSIX/BSD defines to ensure that the test gets ++ # the correct POSIX level on linux. ++ CHECK_VARIABLE_EXISTS (CLOCK_MONOTONIC HAVE_CLOCK_MONOTONIC) ++ ++ #----------------------------------------------------------------------------- ++ # Check a bunch of time functions ++ #----------------------------------------------------------------------------- ++ FOREACH (test ++ HAVE_TM_GMTOFF ++ HAVE___TM_GMTOFF ++# HAVE_TIMEZONE ++ HAVE_STRUCT_TIMEZONE ++ GETTIMEOFDAY_GIVES_TZ ++ TIME_WITH_SYS_TIME ++ HAVE_TM_ZONE ++ HAVE_STRUCT_TM_TM_ZONE ++ ) ++ HDF5_FUNCTION_TEST (${test}) ++ ENDFOREACH (test) ++ IF (NOT CYGWIN AND NOT MINGW) ++ HDF5_FUNCTION_TEST (HAVE_TIMEZONE) ++# HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) ++ ENDIF (NOT CYGWIN AND NOT MINGW) ++ ++ # ---------------------------------------------------------------------- ++ # Does the struct stat have the st_blocks field? This field is not Posix. ++ # ++ HDF5_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) ++ ++ # ---------------------------------------------------------------------- ++ # How do we figure out the width of a tty in characters? ++ # ++ CHECK_FUNCTION_EXISTS (ioctl H5_HAVE_IOCTL) ++ HDF5_FUNCTION_TEST (HAVE_STRUCT_VIDEOCONFIG) ++ HDF5_FUNCTION_TEST (HAVE_STRUCT_TEXT_INFO) ++ CHECK_FUNCTION_EXISTS (_getvideoconfig H5_HAVE__GETVIDEOCONFIG) ++ CHECK_FUNCTION_EXISTS (gettextinfo H5_HAVE_GETTEXTINFO) ++ CHECK_FUNCTION_EXISTS (_scrsize H5_HAVE__SCRSIZE) ++ CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo H5_HAVE_GETCONSOLESCREENBUFFERINFO) ++ CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" H5_HAVE_TIOCGWINSZ) ++ CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" H5_HAVE_TIOCGETD) ++ENDIF (NOT WINDOWS) ++ ++#----------------------------------------------------------------------------- ++# Check for some functions that are used ++# ++CHECK_FUNCTION_EXISTS (alarm H5_HAVE_ALARM) ++#CHECK_FUNCTION_EXISTS (BSDgettimeofday H5_HAVE_BSDGETTIMEOFDAY) ++CHECK_FUNCTION_EXISTS (fork H5_HAVE_FORK) ++CHECK_FUNCTION_EXISTS (frexpf H5_HAVE_FREXPF) ++CHECK_FUNCTION_EXISTS (frexpl H5_HAVE_FREXPL) ++ ++CHECK_FUNCTION_EXISTS (gethostname H5_HAVE_GETHOSTNAME) ++CHECK_FUNCTION_EXISTS (getpwuid H5_HAVE_GETPWUID) ++CHECK_FUNCTION_EXISTS (getrusage H5_HAVE_GETRUSAGE) ++CHECK_FUNCTION_EXISTS (lstat H5_HAVE_LSTAT) ++ ++CHECK_FUNCTION_EXISTS (rand_r H5_HAVE_RAND_R) ++CHECK_FUNCTION_EXISTS (random H5_HAVE_RANDOM) ++CHECK_FUNCTION_EXISTS (setsysinfo H5_HAVE_SETSYSINFO) ++ ++CHECK_FUNCTION_EXISTS (signal H5_HAVE_SIGNAL) ++CHECK_FUNCTION_EXISTS (longjmp H5_HAVE_LONGJMP) ++CHECK_FUNCTION_EXISTS (setjmp H5_HAVE_SETJMP) ++CHECK_FUNCTION_EXISTS (siglongjmp H5_HAVE_SIGLONGJMP) ++CHECK_FUNCTION_EXISTS (sigsetjmp H5_HAVE_SIGSETJMP) ++CHECK_FUNCTION_EXISTS (sigaction H5_HAVE_SIGACTION) ++CHECK_FUNCTION_EXISTS (sigprocmask H5_HAVE_SIGPROCMASK) ++ ++CHECK_FUNCTION_EXISTS (snprintf H5_HAVE_SNPRINTF) ++CHECK_FUNCTION_EXISTS (srandom H5_HAVE_SRANDOM) ++CHECK_FUNCTION_EXISTS (strdup H5_HAVE_STRDUP) ++CHECK_FUNCTION_EXISTS (symlink H5_HAVE_SYMLINK) ++CHECK_FUNCTION_EXISTS (system H5_HAVE_SYSTEM) ++ ++CHECK_FUNCTION_EXISTS (tmpfile H5_HAVE_TMPFILE) ++CHECK_FUNCTION_EXISTS (vasprintf H5_HAVE_VASPRINTF) ++CHECK_FUNCTION_EXISTS (waitpid H5_HAVE_WAITPID) ++ ++CHECK_FUNCTION_EXISTS (vsnprintf H5_HAVE_VSNPRINTF) ++IF (NOT WINDOWS) ++ IF (H5_HAVE_VSNPRINTF) ++ HDF5_FUNCTION_TEST (VSNPRINTF_WORKS) ++ ENDIF (H5_HAVE_VSNPRINTF) ++ENDIF (NOT WINDOWS) ++ ++#----------------------------------------------------------------------------- ++# sigsetjmp is special; may actually be a macro ++#----------------------------------------------------------------------------- ++IF (NOT H5_HAVE_SIGSETJMP) ++ IF (H5_HAVE_SETJMP_H) ++ CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" H5_HAVE_MACRO_SIGSETJMP) ++ IF (H5_HAVE_MACRO_SIGSETJMP) ++ SET (H5_HAVE_SIGSETJMP 1) ++ ENDIF (H5_HAVE_MACRO_SIGSETJMP) ++ ENDIF (H5_HAVE_SETJMP_H) ++ENDIF (NOT H5_HAVE_SIGSETJMP) ++ ++#----------------------------------------------------------------------------- ++# Check for Symbols ++CHECK_SYMBOL_EXISTS (tzname "time.h" H5_HAVE_DECL_TZNAME) ++ ++#----------------------------------------------------------------------------- ++# Check a bunch of other functions ++#----------------------------------------------------------------------------- ++IF (NOT WINDOWS) ++ FOREACH (test ++ LONE_COLON ++ HAVE_ATTRIBUTE ++ HAVE_C99_FUNC ++ HAVE_FUNCTION ++ HAVE_C99_DESIGNATED_INITIALIZER ++ SYSTEM_SCOPE_THREADS ++ HAVE_SOCKLEN_T ++ CXX_HAVE_OFFSETOF ++ ) ++ HDF5_FUNCTION_TEST (${test}) ++ ENDFOREACH (test) ++ENDIF (NOT WINDOWS) ++ ++# For other CXX specific tests, use this MACRO. ++MACRO (HDF5_CXX_FUNCTION_TEST OTHER_TEST) ++ IF ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") ++ SET (OTHER_TEST_ADD_LIBRARIES) ++ IF (CMAKE_REQUIRED_LIBRARIES) ++ SET (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") ++ ENDIF (CMAKE_REQUIRED_LIBRARIES) ++ ++ FOREACH (def ${HDF5_EXTRA_TEST_DEFINITIONS}) ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}") ++ ENDFOREACH (def) ++ ++ FOREACH (def ++ HAVE_SYS_TIME_H ++ HAVE_UNISTD_H ++ HAVE_SYS_TYPES_H ++ HAVE_SYS_SOCKET_H ++ ) ++ IF ("${H5_${def}}") ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") ++ ENDIF ("${H5_${def}}") ++ ENDFOREACH (def) ++ ++ IF (LARGEFILE) ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS ++ "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ++ ) ++ ENDIF (LARGEFILE) ++ ++ #MESSAGE (STATUS "Performing ${OTHER_TEST}") ++ TRY_COMPILE (${OTHER_TEST} ++ ${CMAKE_BINARY_DIR} ++ ${HDF5_RESOURCES_DIR}/HDF5CXXTests.cpp ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ++ "${OTHER_TEST_ADD_LIBRARIES}" ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF ("${OTHER_TEST}" EQUAL 0) ++ SET (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") ++ MESSAGE (STATUS "Performing CXX Test ${OTHER_TEST} - Success") ++ ELSE ("${OTHER_TEST}" EQUAL 0) ++ MESSAGE (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") ++ SET (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" ++ "${OUTPUT}\n" ++ ) ++ ENDIF ("${OTHER_TEST}" EQUAL 0) ++ ENDIF ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$") ++ENDMACRO (HDF5_CXX_FUNCTION_TEST) ++ ++#----------------------------------------------------------------------------- ++# Check a bunch of cxx functions ++#----------------------------------------------------------------------------- ++IF (CMAKE_CXX_COMPILER_LOADED) ++ FOREACH (test ++ OLD_HEADER_FILENAME ++ H5_NO_NAMESPACE ++ H5_NO_STD ++ BOOL_NOTDEFINED ++ NO_STATIC_CAST ++ ) ++ HDF5_CXX_FUNCTION_TEST (${test}) ++ ENDFOREACH (test) ++ENDIF (CMAKE_CXX_COMPILER_LOADED) ++ ++#----------------------------------------------------------------------------- ++# Check if Direct I/O driver works ++#----------------------------------------------------------------------------- ++IF (NOT WINDOWS) ++ OPTION (HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" ON) ++ IF (HDF5_ENABLE_DIRECT_VFD) ++ SET (msg "Performing TEST_DIRECT_VFD_WORKS") ++ SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-DTEST_DIRECT_VFD_WORKS -D_GNU_SOURCE ${CMAKE_REQUIRED_FLAGS}") ++ TRY_RUN (TEST_DIRECT_VFD_WORKS_RUN TEST_DIRECT_VFD_WORKS_COMPILE ++ ${HDF5_BINARY_DIR}/CMake ++ ${HDF5_RESOURCES_DIR}/HDF5Tests.c ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (TEST_DIRECT_VFD_WORKS_COMPILE) ++ IF (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) ++ HDF5_FUNCTION_TEST (HAVE_DIRECT) ++ SET (CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") ++ ADD_DEFINITIONS ("-D_GNU_SOURCE") ++ ELSE (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) ++ SET (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test TEST_DIRECT_VFD_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" ++ ) ++ ENDIF (TEST_DIRECT_VFD_WORKS_RUN MATCHES 0) ++ ELSE (TEST_DIRECT_VFD_WORKS_COMPILE ) ++ SET (TEST_DIRECT_VFD_WORKS "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test TEST_DIRECT_VFD_WORKS Compile failed with the following output:\n ${OUTPUT}\n" ++ ) ++ ENDIF (TEST_DIRECT_VFD_WORKS_COMPILE) ++ ENDIF (HDF5_ENABLE_DIRECT_VFD) ++ENDIF (NOT WINDOWS) ++ ++#----------------------------------------------------------------------------- ++# Check for the Stream VFD driver ++#----------------------------------------------------------------------------- ++IF (HDF5_STREAM_VFD) ++ CHECK_INCLUDE_FILE_CONCAT ("netdb.h" H5_HAVE_NETDB_H) ++ CHECK_INCLUDE_FILE_CONCAT ("netinet/tcp.h" H5_HAVE_NETINET_TCP_H) ++ CHECK_INCLUDE_FILE_CONCAT ("sys/filio.h" H5_HAVE_SYS_FILIO_H) ++ SET (H5_HAVE_STREAM 1) ++ENDIF (HDF5_STREAM_VFD) ++ ++#----------------------------------------------------------------------------- ++# Check if InitOnceExecuteOnce is available ++#----------------------------------------------------------------------------- ++IF (WINDOWS) ++ IF (NOT HDF5_NO_IOEO_TEST) ++ MESSAGE (STATUS "Checking for InitOnceExecuteOnce:") ++ IF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") ++ IF (LARGEFILE) ++ SET (CMAKE_REQUIRED_DEFINITIONS ++ "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" ++ ) ++ ENDIF (LARGEFILE) ++ SET(MACRO_CHECK_FUNCTION_DEFINITIONS ++ "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") ++ IF(CMAKE_REQUIRED_LIBRARIES) ++ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES ++ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") ++ ELSE(CMAKE_REQUIRED_LIBRARIES) ++ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) ++ ENDIF(CMAKE_REQUIRED_LIBRARIES) ++ IF(CMAKE_REQUIRED_INCLUDES) ++ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES ++ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") ++ ELSE(CMAKE_REQUIRED_INCLUDES) ++ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) ++ ENDIF(CMAKE_REQUIRED_INCLUDES) ++ ++ TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED ++ ${CMAKE_BINARY_DIR} ++ ${HDF5_RESOURCES_DIR}/HDF5Tests.c ++ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ++ -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} ++ "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" ++ "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" ++ COMPILE_OUTPUT_VARIABLE OUTPUT) ++ # if it did not compile make the return value fail code of 1 ++ IF(NOT HAVE_IOEO_COMPILED) ++ SET(HAVE_IOEO_EXITCODE 1) ++ ENDIF(NOT HAVE_IOEO_COMPILED) ++ # if the return value was 0 then it worked ++ IF("${HAVE_IOEO_EXITCODE}" EQUAL 0) ++ SET(H5_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") ++ MESSAGE(STATUS "Performing Test InitOnceExecuteOnce - Success") ++ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log ++ "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n" ++ "${OUTPUT}\n" ++ "Return value: ${HAVE_IOEO}\n") ++ ELSE("${HAVE_IOEO_EXITCODE}" EQUAL 0) ++ IF(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") ++ SET(H5_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") ++ ELSE(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") ++ SET(H5_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") ++ ENDIF(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") ++ ++ MESSAGE(STATUS "Performing Test InitOnceExecuteOnce - Failed") ++ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log ++ "Performing InitOnceExecuteOnce Test failed with the following output:\n" ++ "${OUTPUT}\n" ++ "Return value: ${HAVE_IOEO_EXITCODE}\n") ++ ENDIF("${HAVE_IOEO_EXITCODE}" EQUAL 0) ++ ENDIF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$") ++ ENDIF (NOT HDF5_NO_IOEO_TEST) ++ENDIF (WINDOWS) ++ ++#----------------------------------------------------------------------------- ++# Option to see if GPFS is available on this filesystem --enable-gpfs ++#----------------------------------------------------------------------------- ++OPTION (HDF5_ENABLE_GPFS "Enable GPFS hints for the MPI/POSIX file driver" OFF) ++IF (HDF5_ENABLE_GPFS) ++ CHECK_INCLUDE_FILE_CONCAT ("gpfs.h" HAVE_GPFS) ++ IF (HAVE_GPFS) ++ HDF5_FUNCTION_TEST (HAVE_GPFS) ++ ENDIF (HAVE_GPFS) ++ENDIF (HDF5_ENABLE_GPFS) ++MARK_AS_ADVANCED (HDF5_ENABLE_GPFS) ++ ++#----------------------------------------------------------------------------- ++# Determine how 'inline' is used ++#----------------------------------------------------------------------------- ++SET (HDF5_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE) ++FOREACH (inline_test inline __inline__ __inline) ++ SET (INLINE_TEST_INLINE ${inline_test}) ++ HDF5_FUNCTION_TEST (INLINE_TEST_${inline_test}) ++ENDFOREACH (inline_test) ++ ++SET (HDF5_EXTRA_TEST_DEFINITIONS) ++IF (INLINE_TEST___inline__) ++ SET (H5_inline __inline__) ++ELSE (INLINE_TEST___inline__) ++ IF (INLINE_TEST___inline) ++ SET (H5_inline __inline) ++ ELSE (INLINE_TEST___inline) ++ IF (INLINE_TEST_inline) ++ SET (H5_inline inline) ++ ENDIF (INLINE_TEST_inline) ++ ENDIF (INLINE_TEST___inline) ++ENDIF (INLINE_TEST___inline__) ++ ++#----------------------------------------------------------------------------- ++# Check how to print a Long Long integer ++#----------------------------------------------------------------------------- ++IF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") ++ SET (PRINT_LL_FOUND 0) ++ MESSAGE (STATUS "Checking for appropriate format for 64 bit long:") ++ set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") ++ if (H5_SIZEOF_LONG_LONG) ++ set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") ++ endif (H5_SIZEOF_LONG_LONG) ++ TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE ++ ${HDF5_BINARY_DIR}/CMake ++ ${HDF5_RESOURCES_DIR}/HDF5Tests.c ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ if (HDF5_PRINTF_LL_TEST_COMPILE) ++ if (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) ++ string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" HDF5_PRINTF_LL "${OUTPUT}") ++ set (H5_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") ++ set (PRINT_LL_FOUND 1) ++ else (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) ++ message ("HDF5: Width test failed with result: ${HDF5_PRINTF_LL_TEST_RUN}") ++ endif (HDF5_PRINTF_LL_TEST_RUN MATCHES 0) ++ else (HDF5_PRINTF_LL_TEST_COMPILE) ++ file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test H5_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" ++ ) ++ endif (HDF5_PRINTF_LL_TEST_COMPILE) ++ ++ IF (PRINT_LL_FOUND) ++ MESSAGE (STATUS "Checking for appropriate format for 64 bit long: found ${H5_PRINTF_LL_WIDTH}") ++ ELSE (PRINT_LL_FOUND) ++ MESSAGE (STATUS "Checking for appropriate format for 64 bit long: not found") ++ SET (H5_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL ++ "Width for printf for type `long long' or `__int64', us. `ll" ++ ) ++ ENDIF (PRINT_LL_FOUND) ++ENDIF (NOT H5_PRINTF_LL_WIDTH OR H5_PRINTF_LL_WIDTH MATCHES "unknown") ++ ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can handle converting ++# denormalized floating-point values. ++# (This flag should be set for all machines, except for the Crays, where ++# the cache value is set in it's config file) ++# ++SET (H5_CONVERT_DENORMAL_FLOAT 1) ++ ++#----------------------------------------------------------------------------- ++# Are we going to use HSIZE_T ++#----------------------------------------------------------------------------- ++IF (HDF5_ENABLE_HSIZET) ++ SET (H5_HAVE_LARGE_HSIZET 1) ++ENDIF (HDF5_ENABLE_HSIZET) ++ ++#----------------------------------------------------------------------------- ++# Macro to determine the various conversion capabilities ++#----------------------------------------------------------------------------- ++MACRO (H5ConversionTests TEST msg) ++ IF ("${TEST}" MATCHES "^${TEST}$") ++ # MESSAGE (STATUS "===> ${TEST}") ++ TRY_RUN (${TEST}_RUN ${TEST}_COMPILE ++ ${HDF5_BINARY_DIR}/CMake ++ ${HDF5_RESOURCES_DIR}/ConversionTests.c ++ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST ++ OUTPUT_VARIABLE OUTPUT ++ ) ++ IF (${TEST}_COMPILE) ++ IF (${TEST}_RUN MATCHES 0) ++ SET (${TEST} 1 CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... yes") ++ ELSE (${TEST}_RUN MATCHES 0) ++ SET (${TEST} "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n" ++ ) ++ ENDIF (${TEST}_RUN MATCHES 0) ++ ELSE (${TEST}_COMPILE ) ++ SET (${TEST} "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log ++ "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n" ++ ) ++ ENDIF (${TEST}_COMPILE) ++ ++ ENDIF("${TEST}" MATCHES "^${TEST}$") ++ENDMACRO (H5ConversionTests) ++ ++#----------------------------------------------------------------------------- ++# Macro to make some of the conversion tests easier to write/read ++#----------------------------------------------------------------------------- ++MACRO (H5MiscConversionTest VAR TEST msg) ++ IF ("${TEST}" MATCHES "^${TEST}$") ++ IF (${VAR}) ++ SET (${TEST} 1 CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... yes") ++ ELSE (${VAR}) ++ SET (${TEST} "" CACHE INTERNAL ${msg}) ++ MESSAGE (STATUS "${msg}... no") ++ ENDIF (${VAR}) ++ ENDIF ("${TEST}" MATCHES "^${TEST}$") ++ENDMACRO (H5MiscConversionTest) ++ ++#----------------------------------------------------------------------------- ++# Check various conversion capabilities ++#----------------------------------------------------------------------------- ++ ++# ----------------------------------------------------------------------- ++# Set flag to indicate that the machine can handle conversion from ++# long double to integers accurately. This flag should be set "yes" for ++# all machines except all SGIs. For SGIs, some conversions are ++# incorrect and its cache value is set "no" in its config/irix6.x and ++# irix5.x. ++# ++H5MiscConversionTest (H5_SIZEOF_LONG_DOUBLE H5_LDOUBLE_TO_INTEGER_ACCURATE "checking IF converting from long double to integers is accurate") ++# ----------------------------------------------------------------------- ++# Set flag to indicate that the machine can do conversion from ++# long double to integers regardless of accuracy. This flag should be ++# set "yes" for all machines except HP-UX 11.00. For HP-UX 11.00, the ++# compiler has 'floating exception' when converting 'long double' to all ++# integers except 'unsigned long long'. Other HP-UX systems are unknown ++# yet. (1/8/05 - SLU) ++# ++H5ConversionTests (H5_LDOUBLE_TO_INTEGER_WORKS "Checking IF converting from long double to integers works") ++# ----------------------------------------------------------------------- ++# Set flag to indicate that the machine can handle conversion from ++# integers to long double. (This flag should be set "yes" for all ++# machines except all SGIs, where some conversions are ++# incorrect and its cache value is set "no" in its config/irix6.x and ++# irix5.x) ++# ++H5MiscConversionTest (H5_SIZEOF_LONG_DOUBLE H5_INTEGER_TO_LDOUBLE_ACCURATE "checking IF accurately converting from integers to long double") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'unsigned long' to 'float' values. ++# (This flag should be set for all machines, except for Pathscale compiler ++# on Sandia's Linux machine where the compiler interprets 'unsigned long' ++# values as negative when the first bit of 'unsigned long' is on during ++# the conversion to float.) ++# ++H5ConversionTests (H5_ULONG_TO_FLOAT_ACCURATE "Checking IF accurately converting unsigned long to float values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'unsigned (long) long' values to 'float' and 'double' values. ++# (This flag should be set for all machines, except for the SGIs, where ++# the cache value is set in the config/irix6.x config file) and Solaris ++# 64-bit machines, where the short program below tests if round-up is ++# correctly handled. ++# ++H5ConversionTests (H5_ULONG_TO_FP_BOTTOM_BIT_ACCURATE "Checking IF accurately converting unsigned long long to floating-point values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'float' or 'double' to 'unsigned long long' values. ++# (This flag should be set for all machines, except for PGI compiler ++# where round-up happens when the fraction of float-point value is greater ++# than 0.5. ++# ++H5ConversionTests (H5_FP_TO_ULLONG_ACCURATE "Checking IF accurately roundup converting floating-point to unsigned long long values" ) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'float', 'double' or 'long double' to 'unsigned long long' values. ++# (This flag should be set for all machines, except for HP-UX machines ++# where the maximal number for unsigned long long is 0x7fffffffffffffff ++# during conversion. ++# ++H5ConversionTests (H5_FP_TO_ULLONG_RIGHT_MAXIMUM "Checking IF right maximum converting floating-point to unsigned long long values" ) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'long double' to 'unsigned int' values. (This flag should be set for ++# all machines, except for some Intel compilers on some Linux.) ++# ++H5ConversionTests (H5_LDOUBLE_TO_UINT_ACCURATE "Checking IF correctly converting long double to unsigned int values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can _compile_ ++# 'unsigned long long' to 'float' and 'double' typecasts. ++# (This flag should be set for all machines.) ++# ++IF (H5_ULLONG_TO_FP_CAST_WORKS MATCHES ^H5_ULLONG_TO_FP_CAST_WORKS$) ++ SET (H5_ULLONG_TO_FP_CAST_WORKS 1 CACHE INTERNAL "Checking IF compiling unsigned long long to floating-point typecasts work") ++ MESSAGE (STATUS "Checking IF compiling unsigned long long to floating-point typecasts work... yes") ++ENDIF (H5_ULLONG_TO_FP_CAST_WORKS MATCHES ^H5_ULLONG_TO_FP_CAST_WORKS$) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can _compile_ ++# 'long long' to 'float' and 'double' typecasts. ++# (This flag should be set for all machines.) ++# ++IF (H5_LLONG_TO_FP_CAST_WORKS MATCHES ^H5_LLONG_TO_FP_CAST_WORKS$) ++ SET (H5_LLONG_TO_FP_CAST_WORKS 1 CACHE INTERNAL "Checking IF compiling long long to floating-point typecasts work") ++ MESSAGE (STATUS "Checking IF compiling long long to floating-point typecasts work... yes") ++ENDIF (H5_LLONG_TO_FP_CAST_WORKS MATCHES ^H5_LLONG_TO_FP_CAST_WORKS$) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can convert from ++# 'unsigned long long' to 'long double' without precision loss. ++# (This flag should be set for all machines, except for FreeBSD(sleipnir) ++# where the last 2 bytes of mantissa are lost when compiler tries to do ++# the conversion, and Cygwin where compiler doesn't do rounding correctly.) ++# ++H5ConversionTests (H5_ULLONG_TO_LDOUBLE_PRECISION "Checking IF converting unsigned long long to long double with precision") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can handle overflow converting ++# all floating-point to all integer types. ++# (This flag should be set for all machines, except for Cray X1 where ++# floating exception is generated when the floating-point value is greater ++# than the maximal integer value). ++# ++H5ConversionTests (H5_FP_TO_INTEGER_OVERFLOW_WORKS "Checking IF overflows normally converting floating-point to integer values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine is using a special algorithm to convert ++# 'long double' to '(unsigned) long' values. (This flag should only be set for ++# the IBM Power6 Linux. When the bit sequence of long double is ++# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long ++# is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. ++# The machine's conversion gets the correct value. We define the macro and disable ++# this kind of test until we figure out what algorithm they use. ++# ++IF (H5_LDOUBLE_TO_LONG_SPECIAL MATCHES ^H5_LDOUBLE_TO_LONG_SPECIAL$) ++ SET (H5_LDOUBLE_TO_LONG_SPECIAL 0 CACHE INTERNAL "Define if your system converts long double to (unsigned) long values with special algorithm") ++ MESSAGE (STATUS "Checking IF your system converts long double to (unsigned) long values with special algorithm... no") ++ENDIF (H5_LDOUBLE_TO_LONG_SPECIAL MATCHES ^H5_LDOUBLE_TO_LONG_SPECIAL$) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine is using a special algorithm ++# to convert some values of '(unsigned) long' to 'long double' values. ++# (This flag should be off for all machines, except for IBM Power6 Linux, ++# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., ++# ..., 7fffff..., the compiler uses a unknown algorithm. We define a ++# macro and skip the test for now until we know about the algorithm. ++# ++IF (H5_LONG_TO_LDOUBLE_SPECIAL MATCHES ^H5_LONG_TO_LDOUBLE_SPECIAL$) ++ SET (H5_LONG_TO_LDOUBLE_SPECIAL 0 CACHE INTERNAL "Define if your system can convert (unsigned) long to long double values with special algorithm") ++ MESSAGE (STATUS "Checking IF your system can convert (unsigned) long to long double values with special algorithm... no") ++ENDIF (H5_LONG_TO_LDOUBLE_SPECIAL MATCHES ^H5_LONG_TO_LDOUBLE_SPECIAL$) ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# 'long double' to '(unsigned) long long' values. (This flag should be set for ++# all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence ++# of long double is 0x4351ccf385ebc8a0bfcc2a3c..., the values of (unsigned)long long ++# start to go wrong on these two machines. Adjusting it higher to ++# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted ++# values wildly wrong. This test detects this wrong behavior and disable the test. ++# ++H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine can accurately convert ++# '(unsigned) long long' to 'long double' values. (This flag should be set for ++# all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., ++# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice ++# as big as they should be. ++# ++H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") ++# ---------------------------------------------------------------------- ++# Set the flag to indicate that the machine generates bad code ++# for the H5V_log2_gen() routine in src/H5Vprivate.h ++# (This flag should be set to no for all machines, except for SGI IRIX64, ++# where the cache value is set to yes in it's config file) ++# ++IF (H5_BAD_LOG2_CODE_GENERATED MATCHES ^H5_BAD_LOG2_CODE_GENERATED$) ++ SET (H5_BAD_LOG2_CODE_GENERATED 0 CACHE INTERNAL "Define if your system generates wrong code for log2 routine") ++ MESSAGE (STATUS "Checking IF your system generates wrong code for log2 routine... no") ++ENDIF (H5_BAD_LOG2_CODE_GENERATED MATCHES ^H5_BAD_LOG2_CODE_GENERATED$) ++# ---------------------------------------------------------------------- ++# Check if pointer alignments are enforced ++# ++H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") ++ ++# Define a macro for Cygwin (on XP only) where the compiler has rounding ++# problem converting from unsigned long long to long double */ ++IF (CYGWIN) ++ SET (H5_CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM 1) ++ENDIF (CYGWIN) +diff --git a/hdf5-1.8.20/config/cmake/HDF5Tests.c b/hdf5-1.8.20/config/cmake/HDF5Tests.c +new file mode 100644 +index 0000000000..b4523e4b60 +--- /dev/null ++++ b/hdf5-1.8.20/config/cmake/HDF5Tests.c +@@ -0,0 +1,491 @@ ++#define SIMPLE_TEST(x) int main(){ x; return 0; } ++ ++#ifdef HAVE_C99_DESIGNATED_INITIALIZER ++ ++#ifdef FC_DUMMY_MAIN ++#ifndef FC_DUMMY_MAIN_EQ_F77 ++# ifdef __cplusplus ++extern "C" ++# endif ++int FC_DUMMY_MAIN() ++{ return 1;} ++#endif ++#endif ++int ++main () ++{ ++ ++ typedef struct ++ { ++ int x; ++ union ++ { ++ int i; ++ double d; ++ }u; ++ }di_struct_t; ++ di_struct_t x = ++ { 0, ++ { .d = 0.0}}; ++ ; ++ return 0; ++} ++ ++#endif ++ ++#ifdef HAVE_C99_FUNC ++ ++#ifdef FC_DUMMY_MAIN ++#ifndef FC_DUMMY_MAIN_EQ_F77 ++# ifdef __cplusplus ++ extern "C" ++# endif ++ int FC_DUMMY_MAIN() { return 1; } ++#endif ++#endif ++int ++main () ++{ ++ const char *fname = __func__; ++ ; ++ return 0; ++} ++ ++#endif ++ ++#ifdef VSNPRINTF_WORKS ++#include ++#include ++#include ++ ++int test_vsnprintf(const char *fmt,...) ++{ ++ va_list ap; ++ char *s = malloc(16); ++ int ret; ++ ++ va_start(ap, fmt); ++ ret=vsnprintf(s,16,"%s",ap); ++ va_end(ap); ++ ++ return(ret!=42 ? 1 : 0); ++} ++ ++int main(void) ++{ ++ return(test_vsnprintf("%s","A string that is longer than 16 characters")); ++} ++#endif ++ ++ ++#ifdef TIME_WITH_SYS_TIME ++/* Time with sys/time test */ ++ ++#include ++#include ++#include ++ ++int ++main () ++{ ++if ((struct tm *) 0) ++return 0; ++ ; ++ return 0; ++} ++ ++#endif ++ ++#ifdef STDC_HEADERS ++#include ++#include ++#include ++#include ++int main() { return 0; } ++#endif /* STDC_HEADERS */ ++ ++#ifdef HAVE_TM_ZONE ++ ++#include ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(struct tm tm; tm.tm_zone); ++ ++#endif /* HAVE_TM_ZONE */ ++ ++#ifdef HAVE_STRUCT_TM_TM_ZONE ++ ++#include ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(struct tm tm; tm.tm_zone); ++ ++#endif /* HAVE_STRUCT_TM_TM_ZONE */ ++ ++#ifdef HAVE_ATTRIBUTE ++ ++#if 0 ++static void test int __attribute((unused)) var) ++{ ++ int __attribute__((unused)) x = var; ++} ++ ++int main(void) ++{ ++ test(19); ++} ++ ++#else ++int ++main () ++{ ++int __attribute__((unused)) x ++ ; ++ return 0; ++} ++#endif ++ ++ ++#endif /* HAVE_ATTRIBUTE */ ++ ++#ifdef HAVE_FUNCTION ++ ++#ifdef FC_DUMMY_MAIN ++#ifndef FC_DUMMY_MAIN_EQ_F77 ++# ifdef __cplusplus ++ extern "C" ++# endif ++ int FC_DUMMY_MAIN() { return 1; } ++#endif ++#endif ++int ++main () ++{ ++(void)__FUNCTION__ ++ ; ++ return 0; ++} ++ ++#endif /* HAVE_FUNCTION */ ++ ++#ifdef HAVE_TM_GMTOFF ++ ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); ++ ++#endif /* HAVE_TM_GMTOFF */ ++ ++#ifdef HAVE___TM_GMTOFF ++ ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0); ++ ++#endif /* HAVE_TM_GMTOFF */ ++ ++#ifdef HAVE_TIMEZONE ++ ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(timezone=0); ++ ++#endif /* HAVE_TIMEZONE */ ++ ++#ifdef HAVE_STRUCT_TIMEZONE ++ ++#include ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0); ++ ++#endif /* HAVE_STRUCT_TIMEZONE */ ++ ++#ifdef HAVE_STAT_ST_BLOCKS ++ ++#include ++SIMPLE_TEST(struct stat sb; sb.st_blocks=0); ++ ++#endif /* HAVE_STAT_ST_BLOCKS */ ++ ++#ifdef PRINTF_LL_WIDTH ++ ++#ifdef HAVE_LONG_LONG ++# define LL_TYPE long long ++#else /* HAVE_LONG_LONG */ ++# define LL_TYPE __int64 ++#endif /* HAVE_LONG_LONG */ ++ ++#include ++#include ++#include ++ ++int main(void) ++{ ++ char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL }; ++ ++ char *s = malloc(128); ++ char **currentArg = NULL; ++ LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; ++ for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) ++ { ++ char formatString[64]; ++ sprintf(formatString, "%%%sd", *currentArg); ++ sprintf(s, formatString, x); ++ if (strcmp(s, "1099511627776") == 0) ++ { ++ printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); ++ return 0; ++ } ++ } ++ return 1; ++} ++ ++#endif /* PRINTF_LL_WIDTH */ ++ ++#ifdef SYSTEM_SCOPE_THREADS ++#include ++#include ++ ++int main(void) ++{ ++ pthread_attr_t attribute; ++ int ret; ++ ++ pthread_attr_init(&attribute); ++ ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); ++ if (ret==0) ++ return 0; ++ return 1; ++} ++ ++#endif /* SYSTEM_SCOPE_THREADS */ ++ ++#ifdef HAVE_SOCKLEN_T ++ ++#include ++#include ++#ifdef HAVE_UNISTD_H ++#include ++#endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++ ++SIMPLE_TEST(socklen_t foo); ++ ++#endif /* HAVE_SOCKLEN_T */ ++ ++#ifdef DEV_T_IS_SCALAR ++ ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif ++ ++int main () ++{ ++ dev_t d1, d2; ++ if(d1==d2) ++ return 0; ++ return 1; ++} ++ ++#endif /* DEV_T_IS_SCALAR */ ++ ++#ifdef HAVE_OFF64_T ++#include ++int main() ++{ ++ off64_t n = 0; ++ return (int)n; ++} ++#endif ++ ++#ifdef HAVE_STAT64_STRUCT ++#include ++#include ], ++struct stat64 sb; ++int main() ++{ ++ return 0; ++} ++#endif ++ ++#ifdef TEST_DIRECT_VFD_WORKS ++#include ++#include ++#include ++int main(void) ++{ ++ int fid; ++ if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0) ++ return 1; ++ close(fid); ++ remove("tst_file"); ++ return 0; ++} ++#endif ++ ++#ifdef HAVE_DIRECT ++ SIMPLE_TEST(posix_memalign()); ++#endif ++ ++#ifdef TEST_LFS_WORKS ++/* Return 0 when LFS is available and 1 otherwise. */ ++#define _LARGEFILE_SOURCE ++#define _LARGEFILE64_SOURCE ++#define _LARGE_FILES ++#define _FILE_OFFSET_BITS 64 ++#include ++#include ++#include ++#include ++ ++int main(int argc, char **argv) ++{ ++ /* check that off_t can hold 2^63 - 1 and perform basic operations... */ ++#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ if (OFF_T_64 % 2147483647 != 1) ++ return 1; ++ ++ /* stat breaks on SCO OpenServer */ ++ struct stat buf; ++ stat( argv[0], &buf ); ++ if (!S_ISREG(buf.st_mode)) ++ return 2; ++ ++ FILE *file = fopen( argv[0], "r" ); ++ off_t offset = ftello( file ); ++ fseek( file, offset, SEEK_CUR ); ++ fclose( file ); ++ return 0; ++} ++#endif ++ ++#ifdef GETTIMEOFDAY_GIVES_TZ ++#ifdef HAVE_SYS_TIME_H ++#include ++#endif ++#include ++int main(void) ++{ ++ struct timeval tv; ++ struct timezone tz; ++ tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ ++ tz.tz_dsttime = 7; ++ gettimeofday(&tv, &tz); ++ /* Check whether the function returned any value at all */ ++ if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) ++ return 1; ++ else return 0; ++} ++#endif ++ ++#ifdef LONE_COLON ++int main(int argc, char * argv) ++{ ++ return 0; ++} ++#endif ++ ++#ifdef CXX_HAVE_OFFSETOF ++ ++#include ++#include ++ ++#ifdef FC_DUMMY_MAIN ++#ifndef FC_DUMMY_MAIN_EQ_F77 ++# ifdef __cplusplus ++extern "C" ++# endif ++int FC_DUMMY_MAIN() ++{ return 1;} ++#endif ++#endif ++int ++main () ++{ ++ ++ struct index_st ++ { ++ unsigned char type; ++ unsigned char num; ++ unsigned int len; ++ }; ++ typedef struct index_st index_t; ++ int x,y; ++ x = offsetof(struct index_st, len); ++ y = offsetof(index_t, num) ++ ++ ; ++ return 0; ++} ++ ++#endif ++ ++#ifdef HAVE_GPFS ++ ++#include ++int main () ++{ ++ int fd = 0; ++ gpfs_fcntl(fd, (void *)0); ++} ++ ++#endif /* HAVE_GPFS */ ++ ++#ifdef HAVE_IOEO ++ ++#include ++typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ++int main () ++{ ++ PGNSI pGNSI; ++ pGNSI = (PGNSI) GetProcAddress( ++ GetModuleHandle(TEXT("kernel32.dll")), ++ "InitOnceExecuteOnce"); ++ if(NULL == pGNSI) ++ return 1; ++ else ++ return 0; ++} ++ ++#endif /* HAVE_IOEO */ ++ ++#ifdef HAVE_STRUCT_VIDEOCONFIG ++ ++SIMPLE_TEST(struct videoconfig w; w.numtextcols=0); ++ ++#endif /* HAVE_TM_GMTOFF */ ++ ++#ifdef HAVE_STRUCT_TEXT_INFO ++ ++SIMPLE_TEST(struct text_info w; w.screenwidth=0); ++ ++#endif /* HAVE_TM_GMTOFF */ ++ ++ ++#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline ) ++#ifndef __cplusplus ++typedef int foo_t; ++static INLINE_TEST_INLINE foo_t static_foo () { return 0; } ++INLINE_TEST_INLINE foo_t foo () {return 0; } ++int main() { return 0; } ++#endif ++ ++#endif /* INLINE_TEST */ +-- +2.15.1.windows.2 + diff --git a/Jemalloc/config.py b/Jemalloc/config.py index 5041bf7416..25822536df 100644 --- a/Jemalloc/config.py +++ b/Jemalloc/config.py @@ -21,7 +21,23 @@ "manifest" : [ "include/jemalloc", - "lib/libjemalloc*{sharedLibraryExtension}*", + "lib/{libraryPrefix}jemalloc*{sharedLibraryExtension}*", + "lib/{libraryPrefix}jemalloc*.obj", ], + + "platform:windows" : { + + "commands" : [ + + "sh -c \"CC=cl ./autogen.sh\" --prefix={buildDir}", + "msbuild msvc\jemalloc_vc2017.sln -target:jemalloc /property:Configuration=\"Release\" /property:WindowsTargetPlatformVersion=10.0.17763.0" , + "copy msvc\\x64\\Release\\jemalloc.dll {buildDir}\\lib", + "copy msvc\\x64\\Release\\jemalloc.lib {buildDir}\\lib", + "xcopy /s /e /h /y /i include\\jemalloc {buildDir}\\include\\jemalloc", + "xcopy /s /e /h /y /i include\\msvc_compat {buildDir}\\include\\msvc_compat", + + ], + + }, } diff --git a/Jemalloc/patches/windows/0001-Backport-MSVC-build.patch b/Jemalloc/patches/windows/0001-Backport-MSVC-build.patch new file mode 100644 index 0000000000..35e0e1c255 --- /dev/null +++ b/Jemalloc/patches/windows/0001-Backport-MSVC-build.patch @@ -0,0 +1,655 @@ +From 22d0450e0f8b3c82f104ac879f3e4274af105d46 Mon Sep 17 00:00:00 2001 +From: ericmehl +Date: Fri, 4 Dec 2020 17:05:58 -0500 +Subject: [PATCH] Backport MSVC build + +--- + configure.ac | 16 +- + include/msvc_compat/stdbool.h | 16 - + msvc/jemalloc_vc2017.sln | 61 ++++ + .../projects/vc2017/jemalloc/jemalloc.vcxproj | 339 ++++++++++++++++++ + .../vc2017/jemalloc/jemalloc.vcxproj.filters | 161 +++++++++ + 5 files changed, 570 insertions(+), 23 deletions(-) + delete mode 100644 include/msvc_compat/stdbool.h + create mode 100644 msvc/jemalloc_vc2017.sln + create mode 100644 msvc/projects/vc2017/jemalloc/jemalloc.vcxproj + create mode 100644 msvc/projects/vc2017/jemalloc/jemalloc.vcxproj.filters + +diff --git a/configure.ac b/configure.ac +index 4de81dc1..df389999 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -141,7 +141,7 @@ if test "x$CFLAGS" = "x" ; then + JE_CFLAGS_APPEND([-Zi]) + JE_CFLAGS_APPEND([-MT]) + JE_CFLAGS_APPEND([-W3]) +- CPPFLAGS="$CPPFLAGS -I${srcroot}/include/msvc_compat" ++ CPPFLAGS="$CPPFLAGS -I${srcroot}include/msvc_compat" + fi + fi + dnl Append EXTRA_CFLAGS to CFLAGS, if defined. +@@ -1045,12 +1045,14 @@ dnl ============================================================================ + dnl Configure pthreads. + + if test "x$abi" != "xpecoff" ; then +- AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) +- dnl Some systems may embed pthreads functionality in libc; check for libpthread +- dnl first, but try libc too before failing. +- AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], +- [AC_SEARCH_LIBS([pthread_create], , , +- AC_MSG_ERROR([libpthread is missing]))]) ++ if test "x$je_cv_msvc" != "xyes" ; then ++ AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])]) ++ dnl Some systems may embed pthreads functionality in libc; check for libpthread ++ dnl first, but try libc too before failing. ++ AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], ++ [AC_SEARCH_LIBS([pthread_create], , , ++ AC_MSG_ERROR([libpthread is missing]))]) ++ fi + fi + + CPPFLAGS="$CPPFLAGS -D_REENTRANT" +diff --git a/include/msvc_compat/stdbool.h b/include/msvc_compat/stdbool.h +deleted file mode 100644 +index da9ee8b8..00000000 +--- a/include/msvc_compat/stdbool.h ++++ /dev/null +@@ -1,16 +0,0 @@ +-#ifndef stdbool_h +-#define stdbool_h +- +-#include +- +-/* MSVC doesn't define _Bool or bool in C, but does have BOOL */ +-/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ +-typedef BOOL _Bool; +- +-#define bool _Bool +-#define true 1 +-#define false 0 +- +-#define __bool_true_false_are_defined 1 +- +-#endif /* stdbool_h */ +diff --git a/msvc/jemalloc_vc2017.sln b/msvc/jemalloc_vc2017.sln +new file mode 100644 +index 00000000..47d3d26c +--- /dev/null ++++ b/msvc/jemalloc_vc2017.sln +@@ -0,0 +1,61 @@ ++ ++Microsoft Visual Studio Solution File, Format Version 12.00 ++# Visual Studio 14 ++VisualStudioVersion = 14.0.24720.0 ++MinimumVisualStudioVersion = 10.0.40219.1 ++Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{70A99006-6DE9-472B-8F83-4CEE6C616DF3}" ++ ProjectSection(SolutionItems) = preProject ++ ReadMe.txt = ReadMe.txt ++ EndProjectSection ++EndProject ++Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jemalloc", "projects\vc2017\jemalloc\jemalloc.vcxproj", "{8D6BB292-9E1C-413D-9F98-4864BDC1514A}" ++EndProject ++Global ++ GlobalSection(SolutionConfigurationPlatforms) = preSolution ++ Debug|x64 = Debug|x64 ++ Debug|x86 = Debug|x86 ++ Debug-static|x64 = Debug-static|x64 ++ Debug-static|x86 = Debug-static|x86 ++ Release|x64 = Release|x64 ++ Release|x86 = Release|x86 ++ Release-static|x64 = Release-static|x64 ++ Release-static|x86 = Release-static|x86 ++ EndGlobalSection ++ GlobalSection(ProjectConfigurationPlatforms) = postSolution ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x64.ActiveCfg = Debug|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x64.Build.0 = Debug|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x86.ActiveCfg = Debug|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x86.Build.0 = Debug|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x64.ActiveCfg = Debug-static|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x64.Build.0 = Debug-static|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x86.ActiveCfg = Debug-static|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x86.Build.0 = Debug-static|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x64.ActiveCfg = Release|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x64.Build.0 = Release|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x86.ActiveCfg = Release|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x86.Build.0 = Release|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x64.ActiveCfg = Release-static|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x64.Build.0 = Release-static|x64 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x86.ActiveCfg = Release-static|Win32 ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x86.Build.0 = Release-static|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x64.ActiveCfg = Debug|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x64.Build.0 = Debug|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x86.ActiveCfg = Debug|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x86.Build.0 = Debug|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x64.ActiveCfg = Debug-static|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x64.Build.0 = Debug-static|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x86.ActiveCfg = Debug-static|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x86.Build.0 = Debug-static|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x64.ActiveCfg = Release|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x64.Build.0 = Release|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x86.ActiveCfg = Release|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x86.Build.0 = Release|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x64.ActiveCfg = Release-static|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x64.Build.0 = Release-static|x64 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x86.ActiveCfg = Release-static|Win32 ++ {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x86.Build.0 = Release-static|Win32 ++ EndGlobalSection ++ GlobalSection(SolutionProperties) = preSolution ++ HideSolutionNode = FALSE ++ EndGlobalSection ++EndGlobal +diff --git a/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj b/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj +new file mode 100644 +index 00000000..7a3a4df8 +--- /dev/null ++++ b/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj +@@ -0,0 +1,339 @@ ++ ++ ++ ++ ++ Debug-static ++ Win32 ++ ++ ++ Debug-static ++ x64 ++ ++ ++ Debug ++ Win32 ++ ++ ++ Release-static ++ Win32 ++ ++ ++ Release-static ++ x64 ++ ++ ++ Release ++ Win32 ++ ++ ++ Debug ++ x64 ++ ++ ++ Release ++ x64 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ {8D6BB292-9E1C-413D-9F98-4864BDC1514A} ++ Win32Proj ++ jemalloc ++ ++ ++ ++ DynamicLibrary ++ true ++ v141 ++ MultiByte ++ ++ ++ StaticLibrary ++ true ++ v141 ++ MultiByte ++ ++ ++ DynamicLibrary ++ false ++ v141 ++ true ++ MultiByte ++ ++ ++ StaticLibrary ++ false ++ v141 ++ true ++ MultiByte ++ ++ ++ DynamicLibrary ++ true ++ v141 ++ MultiByte ++ ++ ++ StaticLibrary ++ true ++ v141 ++ MultiByte ++ ++ ++ DynamicLibrary ++ false ++ v141 ++ true ++ MultiByte ++ ++ ++ StaticLibrary ++ false ++ v141 ++ true ++ MultiByte ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)d ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)-$(PlatformToolset)-$(Configuration) ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)-$(PlatformToolset)-$(Configuration) ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)d ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)-vc$(PlatformToolsetVersion)-$(Configuration) ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ ++ ++ $(SolutionDir)$(Platform)\$(Configuration)\ ++ $(Platform)\$(Configuration)\ ++ $(ProjectName)-vc$(PlatformToolsetVersion)-$(Configuration) ++ ++ ++ ++ ++ ++ Level3 ++ Disabled ++ _REENTRANT;_WINDLL;DLLEXPORT;JEMALLOC_DEBUG;_DEBUG;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ ++ ++ ++ ++ ++ ++ Level3 ++ Disabled ++ JEMALLOC_DEBUG;_REENTRANT;JEMALLOC_EXPORT=;_DEBUG;_LIB;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ MultiThreadedDebug ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ ++ ++ ++ ++ ++ ++ Level3 ++ Disabled ++ JEMALLOC_NO_PRIVATE_NAMESPACE;_REENTRANT;_WINDLL;DLLEXPORT;JEMALLOC_DEBUG;_DEBUG;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ ++ ++ ++ ++ ++ ++ Level3 ++ Disabled ++ JEMALLOC_NO_PRIVATE_NAMESPACE;JEMALLOC_DEBUG;_REENTRANT;JEMALLOC_EXPORT=;_DEBUG;_LIB;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ MultiThreadedDebug ++ 4090;4146;4267;4334 ++ OldStyle ++ false ++ ++ ++ Windows ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ MaxSpeed ++ true ++ true ++ _REENTRANT;_WINDLL;DLLEXPORT;NDEBUG;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ true ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ MaxSpeed ++ true ++ true ++ _REENTRANT;JEMALLOC_EXPORT=;NDEBUG;_LIB;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ MultiThreaded ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ true ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ MaxSpeed ++ true ++ true ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;__STDC_LIMIT_MACROS;%(AdditionalIncludeDirectories) ++ JEMALLOC_NO_PRIVATE_NAMESPACE;_REENTRANT;_WINDLL;DLLEXPORT;NDEBUG;%(PreprocessorDefinitions) ++ 4090;4146;4267;4334 ++ $(OutputPath)$(TargetName).pdb ++ ++ ++ Windows ++ true ++ true ++ true ++ ++ ++ ++ ++ Level3 ++ ++ ++ MaxSpeed ++ true ++ true ++ JEMALLOC_NO_PRIVATE_NAMESPACE;_REENTRANT;JEMALLOC_EXPORT=;NDEBUG;_LIB;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) ++ ..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories) ++ MultiThreaded ++ 4090;4146;4267;4334 ++ OldStyle ++ ++ ++ Windows ++ true ++ true ++ true ++ ++ ++ ++ ++ ++ +diff --git a/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj.filters b/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj.filters +new file mode 100644 +index 00000000..e3b7e0c5 +--- /dev/null ++++ b/msvc/projects/vc2017/jemalloc/jemalloc.vcxproj.filters +@@ -0,0 +1,161 @@ ++ ++ ++ ++ ++ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} ++ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx ++ ++ ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ Source Files ++ ++ ++ +-- +2.29.2.windows.2 + diff --git a/LLVM/config.py b/LLVM/config.py index e0c8d6df03..e9a638dd09 100644 --- a/LLVM/config.py +++ b/LLVM/config.py @@ -23,8 +23,29 @@ " -DLLVM_ENABLE_RTTI=ON" " -DLLVM_ENABLE_LIBXML2=OFF" " ..", - "cd build && make install -j {jobs}" + "cd build && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}" ], + "platform:windows" : { + + "commands" : [ + + "move ..\\clang* tools\\clang", + "mkdir build", + "cd build &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D BUILD_SHARED_LIBS=OFF" + " -D LLVM_REQUIRES_RTTI=ON" + " -D LLVM_TARGETS_TO_BUILD=\"X86\"" + " ..", + "cd build && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + + ], + + } + } diff --git a/LLVM/patches/windows/001-refactor_propogation_dependency_bits.patch.txt b/LLVM/patches/windows/001-refactor_propogation_dependency_bits.patch.txt new file mode 100644 index 0000000000..0b0d9a3958 --- /dev/null +++ b/LLVM/patches/windows/001-refactor_propogation_dependency_bits.patch.txt @@ -0,0 +1,1863 @@ +From ec3060c72de6ab6992269318d92764199856e5fe Mon Sep 17 00:00:00 2001 +From: Ilya Biryukov +Date: Mon, 2 Mar 2020 16:07:09 +0100 +Subject: [PATCH] [AST] Refactor propagation of dependency bits. NFC + +Summary: +This changes introduces an enum to represent dependencies as a bitmask +and extract common patterns from code that computes dependency bits into +helper functions. + +Reviewers: rsmith, martong, shafik, ilya-biryukov, hokein + +Subscribers: hokein, sammccall, Mordante, riccibruno, merge_guards_bot, rnkovacs, cfe-commits + +Tags: #clang + +Differential Revision: https://reviews.llvm.org/D71920 +--- + clang/include/clang/AST/DependencyFlags.h | 138 +++++++++++ + clang/include/clang/AST/Expr.h | 78 +++--- + clang/include/clang/AST/ExprConcepts.h | 1 + + clang/include/clang/AST/NestedNameSpecifier.h | 3 + + clang/include/clang/AST/Stmt.h | 8 +- + clang/include/clang/AST/TemplateBase.h | 8 +- + clang/include/clang/AST/TemplateName.h | 3 + + clang/include/clang/AST/Type.h | 82 ++++--- + clang/lib/AST/ASTImporter.cpp | 6 +- + clang/lib/AST/Expr.cpp | 227 +++++------------- + clang/lib/AST/ExprCXX.cpp | 88 ++----- + clang/lib/AST/ExprConcepts.cpp | 33 +-- + clang/lib/AST/ExprObjC.cpp | 34 +-- + clang/lib/AST/NestedNameSpecifier.cpp | 67 ++---- + clang/lib/AST/TemplateBase.cpp | 130 +++------- + clang/lib/AST/TemplateName.cpp | 70 +++--- + clang/lib/Sema/SemaOverload.cpp | 7 +- + clang/lib/Serialization/ASTReaderStmt.cpp | 24 +- + 18 files changed, 471 insertions(+), 536 deletions(-) + create mode 100644 clang/include/clang/AST/DependencyFlags.h + +diff --git a/../clang-10.0.1.src/include/clang/AST/DependencyFlags.h b/../clang-10.0.1.src/include/clang/AST/DependencyFlags.h +new file mode 100644 +index 0000000000000..c27016aa9aec4 +--- /dev/null ++++ b/../clang-10.0.1.src/include/clang/AST/DependencyFlags.h +@@ -0,0 +1,138 @@ ++//===--- DependencyFlags.h ------------------------------------------------===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++#ifndef LLVM_CLANG_AST_DEPENDENCYFLAGS_H ++#define LLVM_CLANG_AST_DEPENDENCYFLAGS_H ++ ++#include "clang/Basic/BitmaskEnum.h" ++#include "llvm/ADT/BitmaskEnum.h" ++#include ++ ++namespace clang { ++struct ExprDependenceScope { ++ enum ExprDependence : uint8_t { ++ UnexpandedPack = 1, ++ Instantiation = 2, ++ Type = 4, ++ Value = 8, ++ ++ None = 0, ++ All = 15, ++ ++ TypeInstantiation = Type | Instantiation, ++ ValueInstantiation = Value | Instantiation, ++ TypeValueInstantiation = Type | Value | Instantiation, ++ ++ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Value) ++ }; ++}; ++using ExprDependence = ExprDependenceScope::ExprDependence; ++static constexpr unsigned ExprDependenceBits = 4; ++ ++struct TypeDependenceScope { ++ enum TypeDependence : uint8_t { ++ /// Whether this type contains an unexpanded parameter pack ++ /// (for C++11 variadic templates) ++ UnexpandedPack = 1, ++ /// Whether this type somehow involves a template parameter, even ++ /// if the resolution of the type does not depend on a template parameter. ++ Instantiation = 2, ++ /// Whether this type is a dependent type (C++ [temp.dep.type]). ++ Dependent = 4, ++ /// Whether this type is a variably-modified type (C99 6.7.5). ++ VariablyModified = 8, ++ ++ None = 0, ++ All = 15, ++ ++ DependentInstantiation = Dependent | Instantiation, ++ ++ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/VariablyModified) ++ }; ++}; ++using TypeDependence = TypeDependenceScope::TypeDependence; ++static constexpr unsigned TypeDependenceBits = 4; ++ ++#define LLVM_COMMON_DEPENDENCE(NAME) \ ++ struct NAME##Scope { \ ++ enum NAME : uint8_t { \ ++ UnexpandedPack = 1, \ ++ Instantiation = 2, \ ++ Dependent = 4, \ ++ \ ++ None = 0, \ ++ DependentInstantiation = Dependent | Instantiation, \ ++ All = 7, \ ++ \ ++ LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/Dependent) \ ++ }; \ ++ }; \ ++ using NAME = NAME##Scope::NAME; \ ++ static constexpr unsigned NAME##Bits = 3; ++ ++LLVM_COMMON_DEPENDENCE(NestedNameSpecifierDependence) ++LLVM_COMMON_DEPENDENCE(TemplateNameDependence) ++LLVM_COMMON_DEPENDENCE(TemplateArgumentDependence) ++#undef LLVM_COMMON_DEPENDENCE ++ ++/// Computes dependencies of a reference with the name having template arguments ++/// with \p TA dependencies. ++inline ExprDependence toExprDependence(TemplateArgumentDependence TA) { ++ auto E = ++ static_cast(TA & ~TemplateArgumentDependence::Dependent); ++ if (TA & TemplateArgumentDependence::Dependent) ++ return E | ExprDependence::Type | ExprDependence::Value; ++ return E; ++} ++inline ExprDependence toExprDependence(TypeDependence TD) { ++ // This hack works because TypeDependence and TemplateArgumentDependence ++ // share the same bit representation, apart from variably-modified. ++ return toExprDependence(static_cast( ++ TD & ~TypeDependence::VariablyModified)); ++} ++inline ExprDependence turnTypeToValueDependence(ExprDependence D) { ++ // Type-dependent expressions are always be value-dependent, so we simply drop ++ // type dependency. ++ return D & ~ExprDependence::Type; ++} ++ ++inline NestedNameSpecifierDependence ++toNestedNameSpecifierDependendence(TypeDependence D) { ++ // This works because both classes share the same bit representation. ++ return static_cast( ++ D & ~TypeDependence::VariablyModified); ++} ++ ++inline TemplateArgumentDependence ++toTemplateArgumentDependence(TypeDependence D) { ++ // This works because both classes share the same bit representation. ++ return static_cast( ++ D & ~TypeDependence::VariablyModified); ++} ++inline TemplateArgumentDependence ++toTemplateArgumentDependence(TemplateNameDependence D) { ++ // This works because both classes share the same bit representation. ++ return static_cast(D); ++} ++inline TemplateArgumentDependence ++toTemplateArgumentDependence(ExprDependence ED) { ++ TemplateArgumentDependence TAD = static_cast( ++ ED & ~(ExprDependence::Type | ExprDependence::Value)); ++ if (ED & (ExprDependence::Type | ExprDependence::Value)) ++ TAD |= TemplateArgumentDependence::Dependent; ++ return TAD; ++} ++ ++inline TemplateNameDependence ++toTemplateNameDependence(NestedNameSpecifierDependence D) { ++ return static_cast(D); ++} ++ ++LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); ++ ++} // namespace clang ++#endif +diff --git a/../clang-10.0.1.src/include/clang/AST/Expr.h b/../clang-10.0.1.src/include/clang/AST/Expr.h +index 87f9b883486af..ffc1f54fe82d4 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Expr.h ++++ b/../clang-10.0.1.src/include/clang/AST/Expr.h +@@ -17,6 +17,7 @@ + #include "clang/AST/ASTVector.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclAccessPair.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/OperationKinds.h" + #include "clang/AST/Stmt.h" + #include "clang/AST/TemplateBase.h" +@@ -28,10 +29,10 @@ + #include "clang/Basic/TypeTraits.h" + #include "llvm/ADT/APFloat.h" + #include "llvm/ADT/APSInt.h" +-#include "llvm/ADT/iterator.h" +-#include "llvm/ADT/iterator_range.h" + #include "llvm/ADT/SmallVector.h" + #include "llvm/ADT/StringRef.h" ++#include "llvm/ADT/iterator.h" ++#include "llvm/ADT/iterator_range.h" + #include "llvm/Support/AtomicOrdering.h" + #include "llvm/Support/Compiler.h" + #include "llvm/Support/TrailingObjects.h" +@@ -120,13 +121,20 @@ class Expr : public ValueStmt { + bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack) + : ValueStmt(SC) + { +- ExprBits.TypeDependent = TD; +- ExprBits.ValueDependent = VD; +- ExprBits.InstantiationDependent = ID; ++ auto D = ExprDependence::None; ++ if (TD) ++ D |= ExprDependence::Type; ++ if (VD) ++ D |= ExprDependence::Value; ++ if (ID) ++ D |= ExprDependence::Instantiation; ++ if (ContainsUnexpandedParameterPack) ++ D |= ExprDependence::UnexpandedPack; ++ ++ ExprBits.Dependent = static_cast(D); + ExprBits.ValueKind = VK; + ExprBits.ObjectKind = OK; + assert(ExprBits.ObjectKind == OK && "truncated kind"); +- ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack; + setType(T); + } + +@@ -148,6 +156,20 @@ class Expr : public ValueStmt { + TR = t; + } + ++ ExprDependence getDependence() const { ++ return static_cast(ExprBits.Dependent); ++ } ++ ++ void setDependence(ExprDependence Deps) { ++ ExprBits.Dependent = static_cast(Deps); ++ } ++ void addDependence(ExprDependence Deps) { ++ ExprBits.Dependent |= static_cast(Deps); ++ } ++ void removeDependence(ExprDependence Deps) { ++ ExprBits.Dependent &= ~static_cast(Deps); ++ } ++ + /// isValueDependent - Determines whether this expression is + /// value-dependent (C++ [temp.dep.constexpr]). For example, the + /// array bound of "Chars" in the following example is +@@ -155,11 +177,8 @@ class Expr : public ValueStmt { + /// @code + /// template struct meta_string; + /// @endcode +- bool isValueDependent() const { return ExprBits.ValueDependent; } +- +- /// Set whether this expression is value-dependent or not. +- void setValueDependent(bool VD) { +- ExprBits.ValueDependent = VD; ++ bool isValueDependent() const { ++ return static_cast(getDependence() & ExprDependence::Value); + } + + /// isTypeDependent - Determines whether this expression is +@@ -173,11 +192,8 @@ class Expr : public ValueStmt { + /// x + y; + /// } + /// @endcode +- bool isTypeDependent() const { return ExprBits.TypeDependent; } +- +- /// Set whether this expression is type-dependent or not. +- void setTypeDependent(bool TD) { +- ExprBits.TypeDependent = TD; ++ bool isTypeDependent() const { ++ return static_cast(getDependence() & ExprDependence::Type); + } + + /// Whether this expression is instantiation-dependent, meaning that +@@ -198,12 +214,7 @@ class Expr : public ValueStmt { + /// \endcode + /// + bool isInstantiationDependent() const { +- return ExprBits.InstantiationDependent; +- } +- +- /// Set whether this expression is instantiation-dependent or not. +- void setInstantiationDependent(bool ID) { +- ExprBits.InstantiationDependent = ID; ++ return static_cast(getDependence() & ExprDependence::Instantiation); + } + + /// Whether this expression contains an unexpanded parameter +@@ -221,13 +232,7 @@ class Expr : public ValueStmt { + /// The expressions \c args and \c static_cast(args) both + /// contain parameter packs. + bool containsUnexpandedParameterPack() const { +- return ExprBits.ContainsUnexpandedParameterPack; +- } +- +- /// Set the bit that describes whether this expression +- /// contains an unexpanded parameter pack. +- void setContainsUnexpandedParameterPack(bool PP = true) { +- ExprBits.ContainsUnexpandedParameterPack = PP; ++ return static_cast(getDependence() & ExprDependence::UnexpandedPack); + } + + /// getExprLoc - Return the preferred location for the arrow when diagnosing +@@ -1215,10 +1220,6 @@ class DeclRefExpr final + /// Construct an empty declaration reference expression. + explicit DeclRefExpr(EmptyShell Empty) : Expr(DeclRefExprClass, Empty) {} + +- /// Computes the type- and value-dependence flags for this +- /// declaration reference expression. +- void computeDependence(const ASTContext &Ctx); +- + public: + DeclRefExpr(const ASTContext &Ctx, ValueDecl *D, + bool RefersToEnclosingVariableOrCapture, QualType T, +@@ -2558,8 +2559,6 @@ class CallExpr : public Expr { + /// the derived classes of CallExpr. + SourceLocation RParenLoc; + +- void updateDependenciesFromArg(Expr *Arg); +- + // CallExpr store some data in trailing objects. However since CallExpr + // is used a base of other expression classes we cannot use + // llvm::TrailingObjects. Instead we manually perform the pointer arithmetic +@@ -4467,13 +4466,8 @@ class InitListExpr : public Expr { + assert(Init < getNumInits() && "Initializer access out of range!"); + InitExprs[Init] = expr; + +- if (expr) { +- ExprBits.TypeDependent |= expr->isTypeDependent(); +- ExprBits.ValueDependent |= expr->isValueDependent(); +- ExprBits.InstantiationDependent |= expr->isInstantiationDependent(); +- ExprBits.ContainsUnexpandedParameterPack |= +- expr->containsUnexpandedParameterPack(); +- } ++ if (expr) ++ addDependence(expr->getDependence()); + } + + /// Reserve space for some number of initializers. +diff --git a/../clang-10.0.1.src/include/clang/AST/ExprConcepts.h b/../clang-10.0.1.src/include/clang/AST/ExprConcepts.h +index 6137e0e4082bd..2a88ed5175d24 100644 +--- a/../clang-10.0.1.src/include/clang/AST/ExprConcepts.h ++++ b/../clang-10.0.1.src/include/clang/AST/ExprConcepts.h +@@ -149,6 +149,7 @@ class Requirement { + enum RequirementKind { RK_Type, RK_Simple, RK_Compound, RK_Nested }; + private: + const RequirementKind Kind; ++ // FIXME: use RequirementDependence to model dependence? + bool Dependent : 1; + bool ContainsUnexpandedParameterPack : 1; + bool Satisfied : 1; +diff --git a/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h b/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h +index c6fae6f465ff6..e465c33e2cc5f 100644 +--- a/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h ++++ b/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H + #define LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H + ++#include "clang/AST/DependencyFlags.h" + #include "clang/Basic/Diagnostic.h" + #include "clang/Basic/SourceLocation.h" + #include "llvm/ADT/FoldingSet.h" +@@ -199,6 +200,8 @@ class NestedNameSpecifier : public llvm::FoldingSetNode { + return nullptr; + } + ++ NestedNameSpecifierDependence getDependence() const; ++ + /// Whether this nested name specifier refers to a dependent + /// type or not. + bool isDependent() const; +diff --git a/../clang-10.0.1.src/include/clang/AST/Stmt.h b/../clang-10.0.1.src/include/clang/AST/Stmt.h +index 5cc4eb8a46dfc..5191a8261f869 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Stmt.h ++++ b/../clang-10.0.1.src/include/clang/AST/Stmt.h +@@ -14,6 +14,7 @@ + #define LLVM_CLANG_AST_STMT_H + + #include "clang/AST/DeclGroup.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/StmtIterator.h" + #include "clang/Basic/CapturedStmt.h" + #include "clang/Basic/IdentifierTable.h" +@@ -315,12 +316,9 @@ class alignas(void *) Stmt { + + unsigned ValueKind : 2; + unsigned ObjectKind : 3; +- unsigned TypeDependent : 1; +- unsigned ValueDependent : 1; +- unsigned InstantiationDependent : 1; +- unsigned ContainsUnexpandedParameterPack : 1; ++ unsigned /*ExprDependence*/ Dependent : ExprDependenceBits; + }; +- enum { NumExprBits = NumStmtBits + 9 }; ++ enum { NumExprBits = NumStmtBits + 5 + ExprDependenceBits }; + + class ConstantExprBitfields { + friend class ASTStmtReader; +diff --git a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +index 93f7b62b8aea2..e5fd1ca9dd461 100644 +--- a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h ++++ b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_CLANG_AST_TEMPLATEBASE_H + #define LLVM_CLANG_AST_TEMPLATEBASE_H + ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateName.h" + #include "clang/AST/Type.h" +@@ -236,6 +237,8 @@ class TemplateArgument { + /// Determine whether this template argument has no value. + bool isNull() const { return getKind() == Null; } + ++ TemplateArgumentDependence getDependence() const; ++ + /// Whether this template argument is dependent on a template + /// parameter such that its result can change from one instantiation to + /// another. +@@ -668,9 +671,8 @@ struct alignas(void *) ASTTemplateKWAndArgsInfo { + TemplateArgumentLoc *OutArgArray); + void initializeFrom(SourceLocation TemplateKWLoc, + const TemplateArgumentListInfo &List, +- TemplateArgumentLoc *OutArgArray, bool &Dependent, +- bool &InstantiationDependent, +- bool &ContainsUnexpandedParameterPack); ++ TemplateArgumentLoc *OutArgArray, ++ TemplateArgumentDependence &Deps); + void initializeFrom(SourceLocation TemplateKWLoc); + + void copyInto(const TemplateArgumentLoc *ArgArray, +diff --git a/../clang-10.0.1.src/include/clang/AST/TemplateName.h b/../clang-10.0.1.src/include/clang/AST/TemplateName.h +index e1315facc9664..bf917788477f7 100644 +--- a/../clang-10.0.1.src/include/clang/AST/TemplateName.h ++++ b/../clang-10.0.1.src/include/clang/AST/TemplateName.h +@@ -13,6 +13,7 @@ + #ifndef LLVM_CLANG_AST_TEMPLATENAME_H + #define LLVM_CLANG_AST_TEMPLATENAME_H + ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/Basic/LLVM.h" + #include "llvm/ADT/FoldingSet.h" +@@ -295,6 +296,8 @@ class TemplateName { + /// the template, including any default template arguments. + TemplateName getNameToSubstitute() const; + ++ TemplateNameDependence getDependence() const; ++ + /// Determines whether this is a dependent template name. + bool isDependent() const; + +diff --git a/../clang-10.0.1.src/include/clang/AST/Type.h b/../clang-10.0.1.src/include/clang/AST/Type.h +index e8248147f9ad4..e589d3fa4e643 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Type.h ++++ b/../clang-10.0.1.src/include/clang/AST/Type.h +@@ -17,6 +17,7 @@ + #ifndef LLVM_CLANG_AST_TYPE_H + #define LLVM_CLANG_AST_TYPE_H + ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateName.h" + #include "clang/Basic/AddressSpaces.h" +@@ -44,8 +45,8 @@ + #include "llvm/Support/Compiler.h" + #include "llvm/Support/ErrorHandling.h" + #include "llvm/Support/PointerLikeTypeTraits.h" +-#include "llvm/Support/type_traits.h" + #include "llvm/Support/TrailingObjects.h" ++#include "llvm/Support/type_traits.h" + #include + #include + #include +@@ -1465,19 +1466,8 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + /// TypeClass bitfield - Enum that specifies what subclass this belongs to. + unsigned TC : 8; + +- /// Whether this type is a dependent type (C++ [temp.dep.type]). +- unsigned Dependent : 1; +- +- /// Whether this type somehow involves a template parameter, even +- /// if the resolution of the type does not depend on a template parameter. +- unsigned InstantiationDependent : 1; +- +- /// Whether this type is a variably-modified type (C99 6.7.5). +- unsigned VariablyModified : 1; +- +- /// Whether this type contains an unexpanded parameter pack +- /// (for C++11 variadic templates). +- unsigned ContainsUnexpandedParameterPack : 1; ++ /// Store information on the type dependency. ++ /*TypeDependence*/ unsigned Dependence : TypeDependenceBits; + + /// True if the cache (i.e. the bitfields here starting with + /// 'Cache') is valid. +@@ -1833,11 +1823,18 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + bool ContainsUnexpandedParameterPack) + : ExtQualsTypeCommonBase(this, + canon.isNull() ? QualType(this_(), 0) : canon) { ++ auto Deps = TypeDependence::None; ++ if (Dependent) ++ Deps |= TypeDependence::Dependent | TypeDependence::Instantiation; ++ if (InstantiationDependent) ++ Deps |= TypeDependence::Instantiation; ++ if (ContainsUnexpandedParameterPack) ++ Deps |= TypeDependence::UnexpandedPack; ++ if (VariablyModified) ++ Deps |= TypeDependence::VariablyModified; ++ + TypeBits.TC = tc; +- TypeBits.Dependent = Dependent; +- TypeBits.InstantiationDependent = Dependent || InstantiationDependent; +- TypeBits.VariablyModified = VariablyModified; +- TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack; ++ TypeBits.Dependence = static_cast(Deps); + TypeBits.CacheValid = false; + TypeBits.CachedLocalOrUnnamed = false; + TypeBits.CachedLinkage = NoLinkage; +@@ -1848,18 +1845,39 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + Type *this_() { return this; } + + void setDependent(bool D = true) { +- TypeBits.Dependent = D; +- if (D) +- TypeBits.InstantiationDependent = true; ++ if (!D) { ++ TypeBits.Dependence &= ~static_cast(TypeDependence::Dependent); ++ return; ++ } ++ TypeBits.Dependence |= static_cast(TypeDependence::Dependent | ++ TypeDependence::Instantiation); + } + + void setInstantiationDependent(bool D = true) { +- TypeBits.InstantiationDependent = D; } ++ if (D) ++ TypeBits.Dependence |= ++ static_cast(TypeDependence::Instantiation); ++ else ++ TypeBits.Dependence &= ++ ~static_cast(TypeDependence::Instantiation); ++ } + +- void setVariablyModified(bool VM = true) { TypeBits.VariablyModified = VM; } ++ void setVariablyModified(bool VM = true) { ++ if (VM) ++ TypeBits.Dependence |= ++ static_cast(TypeDependence::VariablyModified); ++ else ++ TypeBits.Dependence &= ++ ~static_cast(TypeDependence::VariablyModified); ++ } + + void setContainsUnexpandedParameterPack(bool PP = true) { +- TypeBits.ContainsUnexpandedParameterPack = PP; ++ if (PP) ++ TypeBits.Dependence |= ++ static_cast(TypeDependence::UnexpandedPack); ++ else ++ TypeBits.Dependence &= ++ ~static_cast(TypeDependence::UnexpandedPack); + } + + public: +@@ -1894,7 +1912,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + /// + /// Note that this routine does not specify which + bool containsUnexpandedParameterPack() const { +- return TypeBits.ContainsUnexpandedParameterPack; ++ return getDependence() & TypeDependence::UnexpandedPack; + } + + /// Determines if this type would be canonical if it had no further +@@ -2145,16 +2163,22 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + /// Given that this is a scalar type, classify it. + ScalarTypeKind getScalarTypeKind() const; + ++ TypeDependence getDependence() const { ++ return static_cast(TypeBits.Dependence); ++ } ++ + /// Whether this type is a dependent type, meaning that its definition + /// somehow depends on a template parameter (C++ [temp.dep.type]). +- bool isDependentType() const { return TypeBits.Dependent; } ++ bool isDependentType() const { ++ return getDependence() & TypeDependence::Dependent; ++ } + + /// Determine whether this type is an instantiation-dependent type, + /// meaning that the type involves a template parameter (even if the + /// definition does not actually depend on the type substituted for that + /// template parameter). + bool isInstantiationDependentType() const { +- return TypeBits.InstantiationDependent; ++ return getDependence() & TypeDependence::Instantiation; + } + + /// Determine whether this type is an undeduced type, meaning that +@@ -2163,7 +2187,9 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { + bool isUndeducedType() const; + + /// Whether this type is a variably-modified type (C99 6.7.5). +- bool isVariablyModifiedType() const { return TypeBits.VariablyModified; } ++ bool isVariablyModifiedType() const { ++ return getDependence() & TypeDependence::VariablyModified; ++ } + + /// Whether this type involves a variable-length array type + /// with a definite size. +diff --git a/../clang-10.0.1.src/lib/AST/ASTImporter.cpp b/../clang-10.0.1.src/lib/AST/ASTImporter.cpp +index 0cf00f6ca15bc..ddbd3699bdc2f 100644 +--- a/../clang-10.0.1.src/lib/AST/ASTImporter.cpp ++++ b/../clang-10.0.1.src/lib/AST/ASTImporter.cpp +@@ -8221,11 +8221,7 @@ Expected ASTImporter::Import(Stmt *FromS) { + // constructors. + ToE->setValueKind(FromE->getValueKind()); + ToE->setObjectKind(FromE->getObjectKind()); +- ToE->setTypeDependent(FromE->isTypeDependent()); +- ToE->setValueDependent(FromE->isValueDependent()); +- ToE->setInstantiationDependent(FromE->isInstantiationDependent()); +- ToE->setContainsUnexpandedParameterPack( +- FromE->containsUnexpandedParameterPack()); ++ ToE->setDependence(FromE->getDependence()); + } + + // Record the imported statement object. +diff --git a/../clang-10.0.1.src/lib/AST/Expr.cpp b/../clang-10.0.1.src/lib/AST/Expr.cpp +index 7e8808f84ead0..79f9f42224d08 100644 +--- a/../clang-10.0.1.src/lib/AST/Expr.cpp ++++ b/../clang-10.0.1.src/lib/AST/Expr.cpp +@@ -17,6 +17,7 @@ + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclObjC.h" + #include "clang/AST/DeclTemplate.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/EvaluatedExprVisitor.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/Mangle.h" +@@ -371,13 +372,11 @@ APValue ConstantExpr::getAPValueResult() const { + /// Compute the type-, value-, and instantiation-dependence of a + /// declaration reference + /// based on the declaration being referenced. +-static void computeDeclRefDependence(const ASTContext &Ctx, NamedDecl *D, +- QualType T, bool &TypeDependent, +- bool &ValueDependent, +- bool &InstantiationDependent) { +- TypeDependent = false; +- ValueDependent = false; +- InstantiationDependent = false; ++static ExprDependence computeDeclRefDependence(const ASTContext &Ctx, ++ NamedDecl *D, QualType T) { ++ auto R = ExprDependence::None; ++ if (D->isParameterPack()) ++ R |= ExprDependence::UnexpandedPack; + + // (TD) C++ [temp.dep.expr]p3: + // An id-expression is type-dependent if it contains: +@@ -389,36 +388,25 @@ static void computeDeclRefDependence(const ASTContext &Ctx, NamedDecl *D, + + // (TD) - an identifier that was declared with dependent type + // (VD) - a name declared with a dependent type, +- if (T->isDependentType()) { +- TypeDependent = true; +- ValueDependent = true; +- InstantiationDependent = true; +- return; +- } else if (T->isInstantiationDependentType()) { +- InstantiationDependent = true; +- } ++ if (T->isDependentType()) ++ return R | ExprDependence::TypeValueInstantiation; ++ else if (T->isInstantiationDependentType()) ++ R |= ExprDependence::Instantiation; + + // (TD) - a conversion-function-id that specifies a dependent type + if (D->getDeclName().getNameKind() + == DeclarationName::CXXConversionFunctionName) { + QualType T = D->getDeclName().getCXXNameType(); +- if (T->isDependentType()) { +- TypeDependent = true; +- ValueDependent = true; +- InstantiationDependent = true; +- return; +- } ++ if (T->isDependentType()) ++ return R | ExprDependence::TypeValueInstantiation; + + if (T->isInstantiationDependentType()) +- InstantiationDependent = true; ++ R |= ExprDependence::Instantiation; + } + + // (VD) - the name of a non-type template parameter, +- if (isa(D)) { +- ValueDependent = true; +- InstantiationDependent = true; +- return; +- } ++ if (isa(D)) ++ return R | ExprDependence::ValueInstantiation; + + // (VD) - a constant with integral or enumeration type and is + // initialized with an expression that is value-dependent. +@@ -435,8 +423,7 @@ static void computeDeclRefDependence(const ASTContext &Ctx, NamedDecl *D, + Var->getType()->isReferenceType())) { + if (const Expr *Init = Var->getAnyInitializer()) + if (Init->isValueDependent()) { +- ValueDependent = true; +- InstantiationDependent = true; ++ R |= ExprDependence::ValueInstantiation; + } + } + +@@ -445,39 +432,21 @@ static void computeDeclRefDependence(const ASTContext &Ctx, NamedDecl *D, + // instantiation + if (Var->isStaticDataMember() && + Var->getDeclContext()->isDependentContext()) { +- ValueDependent = true; +- InstantiationDependent = true; ++ R |= ExprDependence::ValueInstantiation; + TypeSourceInfo *TInfo = Var->getFirstDecl()->getTypeSourceInfo(); + if (TInfo->getType()->isIncompleteArrayType()) +- TypeDependent = true; ++ R |= ExprDependence::Type; + } + +- return; ++ return R; + } + + // (VD) - FIXME: Missing from the standard: + // - a member function or a static data member of the current + // instantiation +- if (isa(D) && D->getDeclContext()->isDependentContext()) { +- ValueDependent = true; +- InstantiationDependent = true; +- } +-} +- +-void DeclRefExpr::computeDependence(const ASTContext &Ctx) { +- bool TypeDependent = false; +- bool ValueDependent = false; +- bool InstantiationDependent = false; +- computeDeclRefDependence(Ctx, getDecl(), getType(), TypeDependent, +- ValueDependent, InstantiationDependent); +- +- ExprBits.TypeDependent |= TypeDependent; +- ExprBits.ValueDependent |= ValueDependent; +- ExprBits.InstantiationDependent |= InstantiationDependent; +- +- // Is the declaration a parameter pack? +- if (getDecl()->isParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ if (isa(D) && D->getDeclContext()->isDependentContext()) ++ R |= ExprDependence::ValueInstantiation; ++ return R; + } + + DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, ValueDecl *D, +@@ -495,7 +464,7 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, ValueDecl *D, + RefersToEnclosingVariableOrCapture; + DeclRefExprBits.NonOdrUseReason = NOUR; + DeclRefExprBits.Loc = L; +- computeDependence(Ctx); ++ addDependence(computeDeclRefDependence(Ctx, getDecl(), getType())); + } + + DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, +@@ -514,9 +483,9 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, + NestedNameSpecifierLoc(QualifierLoc); + auto *NNS = QualifierLoc.getNestedNameSpecifier(); + if (NNS->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; ++ addDependence(ExprDependence::Instantiation); + if (NNS->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(ExprDependence::UnexpandedPack); + } + DeclRefExprBits.HasFoundDecl = FoundD ? 1 : 0; + if (FoundD) +@@ -527,22 +496,19 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, + RefersToEnclosingVariableOrCapture; + DeclRefExprBits.NonOdrUseReason = NOUR; + if (TemplateArgs) { +- bool Dependent = false; +- bool InstantiationDependent = false; +- bool ContainsUnexpandedParameterPack = false; ++ auto Deps = TemplateArgumentDependence::None; + getTrailingObjects()->initializeFrom( + TemplateKWLoc, *TemplateArgs, getTrailingObjects(), +- Dependent, InstantiationDependent, ContainsUnexpandedParameterPack); +- assert(!Dependent && "built a DeclRefExpr with dependent template args"); +- ExprBits.InstantiationDependent |= InstantiationDependent; +- ExprBits.ContainsUnexpandedParameterPack |= ContainsUnexpandedParameterPack; ++ Deps); ++ assert(!(Deps & TemplateArgumentDependence::Dependent) && ++ "built a DeclRefExpr with dependent template args"); ++ addDependence(toExprDependence(Deps)); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); + } + DeclRefExprBits.HadMultipleCandidates = 0; +- +- computeDependence(Ctx); ++ addDependence(computeDeclRefDependence(Ctx, getDecl(), getType())); + } + + DeclRefExpr *DeclRefExpr::Create(const ASTContext &Context, +@@ -1360,11 +1326,11 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef PreArgs, + + setCallee(Fn); + for (unsigned I = 0; I != NumPreArgs; ++I) { +- updateDependenciesFromArg(PreArgs[I]); ++ addDependence(PreArgs[I]->getDependence()); + setPreArg(I, PreArgs[I]); + } + for (unsigned I = 0; I != Args.size(); ++I) { +- updateDependenciesFromArg(Args[I]); ++ addDependence(Args[I]->getDependence()); + setArg(I, Args[I]); + } + for (unsigned I = Args.size(); I != NumArgs; ++I) { +@@ -1432,17 +1398,6 @@ unsigned CallExpr::offsetToTrailingObjects(StmtClass SC) { + } + } + +-void CallExpr::updateDependenciesFromArg(Expr *Arg) { +- if (Arg->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (Arg->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Arg->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Arg->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +-} +- + Decl *Expr::getReferencedDeclOfCallee() { + Expr *CEE = IgnoreParenImpCasts(); + +@@ -1580,9 +1535,9 @@ OffsetOfExpr::OffsetOfExpr(const ASTContext &C, QualType type, + + for (unsigned i = 0; i != exprs.size(); ++i) { + if (exprs[i]->isTypeDependent() || exprs[i]->isValueDependent()) +- ExprBits.ValueDependent = true; ++ addDependence(ExprDependence::Value); + if (exprs[i]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(ExprDependence ::UnexpandedPack); + + setIndexExpr(i, exprs[i]); + } +@@ -1624,8 +1579,7 @@ UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr( + if (D) { + for (const auto *I : D->specific_attrs()) { + if (I->isAlignmentDependent()) { +- setValueDependent(true); +- setInstantiationDependent(true); ++ addDependence(ExprDependence::ValueInstantiation); + break; + } + } +@@ -1678,25 +1632,23 @@ MemberExpr *MemberExpr::Create( + // dyn_cast_or_null is used to handle objC variables which do not + // have a declaration context. + CXXRecordDecl *RD = dyn_cast_or_null(DC); +- if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC)) +- E->setTypeDependent(T->isDependentType()); +- ++ if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC)) { ++ if (E->isTypeDependent() && !T->isDependentType()) ++ E->removeDependence(ExprDependence::Type); ++ } + // Bitfield with value-dependent width is type-dependent. + FieldDecl *FD = dyn_cast(MemberDecl); + if (FD && FD->isBitField() && FD->getBitWidth()->isValueDependent()) +- E->setTypeDependent(true); ++ E->addDependence(ExprDependence::Type); + } + + if (HasQualOrFound) { + // FIXME: Wrong. We should be looking at the member declaration we found. +- if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent()) { +- E->setValueDependent(true); +- E->setTypeDependent(true); +- E->setInstantiationDependent(true); +- } ++ if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent()) ++ E->addDependence(ExprDependence::TypeValueInstantiation); + else if (QualifierLoc && + QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent()) +- E->setInstantiationDependent(true); ++ E->addDependence(ExprDependence::Instantiation); + + E->MemberExprBits.HasQualifierOrFoundDecl = true; + +@@ -1710,15 +1662,12 @@ MemberExpr *MemberExpr::Create( + TemplateArgs || TemplateKWLoc.isValid(); + + if (TemplateArgs) { +- bool Dependent = false; +- bool InstantiationDependent = false; +- bool ContainsUnexpandedParameterPack = false; ++ auto Deps = TemplateArgumentDependence::None; + E->getTrailingObjects()->initializeFrom( + TemplateKWLoc, *TemplateArgs, +- E->getTrailingObjects(), Dependent, +- InstantiationDependent, ContainsUnexpandedParameterPack); +- if (InstantiationDependent) +- E->setInstantiationDependent(true); ++ E->getTrailingObjects(), Deps); ++ if (Deps & TemplateArgumentDependence::Instantiation) ++ E->addDependence(ExprDependence::Instantiation); + } else if (TemplateKWLoc.isValid()) { + E->getTrailingObjects()->initializeFrom( + TemplateKWLoc); +@@ -2236,16 +2185,8 @@ InitListExpr::InitListExpr(const ASTContext &C, SourceLocation lbraceloc, + LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), AltForm(nullptr, true) + { + sawArrayRangeDesignator(false); +- for (unsigned I = 0; I != initExprs.size(); ++I) { +- if (initExprs[I]->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (initExprs[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (initExprs[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (initExprs[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- } ++ for (unsigned I = 0; I != initExprs.size(); ++I) ++ addDependence(initExprs[I]->getDependence()); + + InitExprs.insert(C, InitExprs.end(), initExprs.begin(), initExprs.end()); + } +@@ -4167,15 +4108,7 @@ ShuffleVectorExpr::ShuffleVectorExpr(const ASTContext &C, ArrayRef args, + { + SubExprs = new (C) Stmt*[args.size()]; + for (unsigned i = 0; i != args.size(); i++) { +- if (args[i]->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (args[i]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (args[i]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (args[i]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- ++ addDependence(args[i]->getDependence()); + SubExprs[i] = args[i]; + } + } +@@ -4319,13 +4252,12 @@ DesignatedInitExpr::DesignatedInitExpr(const ASTContext &C, QualType Ty, + if (this->Designators[I].isArrayDesignator()) { + // Compute type- and value-dependence. + Expr *Index = IndexExprs[IndexIdx]; +- if (Index->isTypeDependent() || Index->isValueDependent()) +- ExprBits.TypeDependent = ExprBits.ValueDependent = true; +- if (Index->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- // Propagate unexpanded parameter packs. +- if (Index->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ ++ // Propagate dependence flags. ++ auto Deps = Index->getDependence(); ++ if (Deps & (ExprDependence::Type | ExprDependence::Value)) ++ Deps |= ExprDependence::Type | ExprDependence::Value; ++ addDependence(Deps); + + // Copy the index expressions into permanent storage. + *Child++ = IndexExprs[IndexIdx++]; +@@ -4333,19 +4265,11 @@ DesignatedInitExpr::DesignatedInitExpr(const ASTContext &C, QualType Ty, + // Compute type- and value-dependence. + Expr *Start = IndexExprs[IndexIdx]; + Expr *End = IndexExprs[IndexIdx + 1]; +- if (Start->isTypeDependent() || Start->isValueDependent() || +- End->isTypeDependent() || End->isValueDependent()) { +- ExprBits.TypeDependent = ExprBits.ValueDependent = true; +- ExprBits.InstantiationDependent = true; +- } else if (Start->isInstantiationDependent() || +- End->isInstantiationDependent()) { +- ExprBits.InstantiationDependent = true; +- } + +- // Propagate unexpanded parameter packs. +- if (Start->containsUnexpandedParameterPack() || +- End->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ auto Deps = Start->getDependence() | End->getDependence(); ++ if (Deps & (ExprDependence::Type | ExprDependence::Value)) ++ Deps |= ExprDependence::TypeValueInstantiation; ++ addDependence(Deps); + + // Copy the start/end expressions into permanent storage. + *Child++ = IndexExprs[IndexIdx++]; +@@ -4483,15 +4407,7 @@ ParenListExpr::ParenListExpr(SourceLocation LParenLoc, ArrayRef Exprs, + ParenListExprBits.NumExprs = Exprs.size(); + + for (unsigned I = 0, N = Exprs.size(); I != N; ++I) { +- if (Exprs[I]->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (Exprs[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Exprs[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Exprs[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- ++ addDependence(Exprs[I]->getDependence()); + getTrailingObjects()[I] = Exprs[I]; + } + } +@@ -4578,14 +4494,7 @@ PseudoObjectExpr::PseudoObjectExpr(QualType type, ExprValueKind VK, + Expr *E = (i == 0 ? syntax : semantics[i-1]); + getSubExprsBuffer()[i] = E; + +- if (E->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (E->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (E->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (E->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(E->getDependence()); + + if (isa(E)) + assert(cast(E)->getSourceExpr() != nullptr && +@@ -4626,15 +4535,7 @@ AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef args, + { + assert(args.size() == getNumSubExprs(op) && "wrong number of subexpressions"); + for (unsigned i = 0; i != args.size(); i++) { +- if (args[i]->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (args[i]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (args[i]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (args[i]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- ++ addDependence(args[i]->getDependence()); + SubExprs[i] = args[i]; + } + } +diff --git a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +index e4bd218ae2d36..38cdfcf752df5 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +@@ -19,6 +19,7 @@ + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/LambdaCapture.h" + #include "clang/AST/NestedNameSpecifier.h" +@@ -194,36 +195,20 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, + CXXNewExprBits.NumPlacementArgs = PlacementArgs.size(); + + if (ArraySize) { +- if (Expr *SizeExpr = *ArraySize) { +- if (SizeExpr->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (SizeExpr->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (SizeExpr->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- } ++ if (Expr *SizeExpr = *ArraySize) ++ addDependence(SizeExpr->getDependence() & ~ExprDependence::Type); + + getTrailingObjects()[arraySizeOffset()] = *ArraySize; + } + + if (Initializer) { +- if (Initializer->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Initializer->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Initializer->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(Initializer->getDependence() & ~ExprDependence::Type); + + getTrailingObjects()[initExprOffset()] = Initializer; + } + + for (unsigned I = 0; I != PlacementArgs.size(); ++I) { +- if (PlacementArgs[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (PlacementArgs[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (PlacementArgs[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(PlacementArgs[I]->getDependence() & ~ExprDependence::Type); + + getTrailingObjects()[placementNewArgsOffset() + I] = + PlacementArgs[I]; +@@ -474,11 +459,8 @@ OverloadExpr::OverloadExpr(StmtClass SC, const ASTContext &Context, + // Determine whether this expression is type-dependent. + for (UnresolvedSetImpl::const_iterator I = Begin; I != End; ++I) { + if ((*I)->getDeclContext()->isDependentContext() || +- isa(*I)) { +- ExprBits.TypeDependent = true; +- ExprBits.ValueDependent = true; +- ExprBits.InstantiationDependent = true; +- } ++ isa(*I)) ++ addDependence(ExprDependence::TypeValueInstantiation); + } + + // Copy the results to the trailing array past UnresolvedLookupExpr +@@ -491,21 +473,11 @@ OverloadExpr::OverloadExpr(StmtClass SC, const ASTContext &Context, + // template arguments and whether they contain any unexpanded pack + // expansions. + if (TemplateArgs) { +- bool Dependent = false; +- bool InstantiationDependent = false; +- bool ContainsUnexpandedParameterPack = false; ++ auto Deps = TemplateArgumentDependence::None; + getTrailingASTTemplateKWAndArgsInfo()->initializeFrom( +- TemplateKWLoc, *TemplateArgs, getTrailingTemplateArgumentLoc(), +- Dependent, InstantiationDependent, ContainsUnexpandedParameterPack); ++ TemplateKWLoc, *TemplateArgs, getTrailingTemplateArgumentLoc(), Deps); ++ addDependence(toExprDependence(Deps)); + +- if (Dependent) { +- ExprBits.TypeDependent = true; +- ExprBits.ValueDependent = true; +- } +- if (InstantiationDependent) +- ExprBits.InstantiationDependent = true; +- if (ContainsUnexpandedParameterPack) +- ExprBits.ContainsUnexpandedParameterPack = true; + } else if (TemplateKWLoc.isValid()) { + getTrailingASTTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc); + } +@@ -539,14 +511,11 @@ DependentScopeDeclRefExpr::DependentScopeDeclRefExpr( + DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo = + (Args != nullptr) || TemplateKWLoc.isValid(); + if (Args) { +- bool Dependent = true; +- bool InstantiationDependent = true; +- bool ContainsUnexpandedParameterPack +- = ExprBits.ContainsUnexpandedParameterPack; ++ auto Deps = TemplateArgumentDependence::None; + getTrailingObjects()->initializeFrom( +- TemplateKWLoc, *Args, getTrailingObjects(), +- Dependent, InstantiationDependent, ContainsUnexpandedParameterPack); +- ExprBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack; ++ TemplateKWLoc, *Args, getTrailingObjects(), Deps); ++ if (Deps & TemplateArgumentDependence::UnexpandedPack) ++ addDependence(ExprDependence::UnexpandedPack); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); +@@ -1114,13 +1083,7 @@ CXXConstructExpr::CXXConstructExpr( + Stmt **TrailingArgs = getTrailingArgs(); + for (unsigned I = 0, N = Args.size(); I != N; ++I) { + assert(Args[I] && "NULL argument in CXXConstructExpr!"); +- +- if (Args[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Args[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Args[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(Args[I]->getDependence() & ~ExprDependence::Type); + + TrailingArgs[I] = Args[I]; + } +@@ -1370,7 +1333,7 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(TypeSourceInfo *TSI, + auto **StoredArgs = getTrailingObjects(); + for (unsigned I = 0; I != Args.size(); ++I) { + if (Args[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ addDependence(ExprDependence::UnexpandedPack); + + StoredArgs[I] = Args[I]; + } +@@ -1416,14 +1379,12 @@ CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( + CXXDependentScopeMemberExprBits.OperatorLoc = OperatorLoc; + + if (TemplateArgs) { +- bool Dependent = true; +- bool InstantiationDependent = true; +- bool ContainsUnexpandedParameterPack = false; ++ auto Deps = TemplateArgumentDependence::None; + getTrailingObjects()->initializeFrom( + TemplateKWLoc, *TemplateArgs, getTrailingObjects(), +- Dependent, InstantiationDependent, ContainsUnexpandedParameterPack); +- if (ContainsUnexpandedParameterPack) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ Deps); ++ if (Deps & TemplateArgumentDependence::UnexpandedPack) ++ addDependence(ExprDependence::UnexpandedPack); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); +@@ -1704,13 +1665,8 @@ TypeTraitExpr::TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind, + auto **ToArgs = getTrailingObjects(); + + for (unsigned I = 0, N = Args.size(); I != N; ++I) { +- if (Args[I]->getType()->isDependentType()) +- setValueDependent(true); +- if (Args[I]->getType()->isInstantiationDependentType()) +- setInstantiationDependent(true); +- if (Args[I]->getType()->containsUnexpandedParameterPack()) +- setContainsUnexpandedParameterPack(true); +- ++ addDependence(toExprDependence(Args[I]->getType()->getDependence()) & ++ ~ExprDependence::Type); + ToArgs[I] = Args[I]; + } + } +diff --git a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +index b5a3686dc99a5..42cc4576562e4 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +@@ -11,11 +11,12 @@ + //===----------------------------------------------------------------------===// + + #include "clang/AST/ExprConcepts.h" +-#include "clang/AST/ASTContext.h" + #include "clang/AST/ASTConcept.h" ++#include "clang/AST/ASTContext.h" + #include "clang/AST/Decl.h" +-#include "clang/AST/DeclarationName.h" + #include "clang/AST/DeclTemplate.h" ++#include "clang/AST/DeclarationName.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateBase.h" +@@ -23,8 +24,8 @@ + #include "clang/Basic/SourceLocation.h" + #include "llvm/Support/TrailingObjects.h" + #include +-#include + #include ++#include + + using namespace clang; + +@@ -46,14 +47,12 @@ ConceptSpecializationExpr::ConceptSpecializationExpr(const ASTContext &C, + ASTConstraintSatisfaction::Create(C, *Satisfaction) : + nullptr) { + setTemplateArguments(ConvertedArgs); +- bool IsInstantiationDependent = false; +- bool ContainsUnexpandedParameterPack = false; ++ auto Deps = TemplateArgumentDependence::None; ++ const auto InterestingDeps = TemplateArgumentDependence::Instantiation | ++ TemplateArgumentDependence::UnexpandedPack; + for (const TemplateArgumentLoc& ArgLoc : ArgsAsWritten->arguments()) { +- if (ArgLoc.getArgument().isInstantiationDependent()) +- IsInstantiationDependent = true; +- if (ArgLoc.getArgument().containsUnexpandedParameterPack()) +- ContainsUnexpandedParameterPack = true; +- if (ContainsUnexpandedParameterPack && IsInstantiationDependent) ++ Deps |= ArgLoc.getArgument().getDependence() & InterestingDeps; ++ if (Deps == InterestingDeps) + break; + } + +@@ -62,8 +61,7 @@ ConceptSpecializationExpr::ConceptSpecializationExpr(const ASTContext &C, + (!NestedNameSpec.getNestedNameSpecifier()->isInstantiationDependent() && + !NestedNameSpec.getNestedNameSpecifier() + ->containsUnexpandedParameterPack())); +- setInstantiationDependent(IsInstantiationDependent); +- setContainsUnexpandedParameterPack(ContainsUnexpandedParameterPack); ++ addDependence(toExprDependence(Deps)); + assert((!isValueDependent() || isInstantiationDependent()) && + "should not be value-dependent"); + } +@@ -182,9 +180,14 @@ RequiresExpr::RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc, + std::copy(Requirements.begin(), Requirements.end(), + getTrailingObjects()); + RequiresExprBits.IsSatisfied |= Dependent; +- setValueDependent(Dependent); +- setInstantiationDependent(Dependent); +- setContainsUnexpandedParameterPack(ContainsUnexpandedParameterPack); ++ if (ContainsUnexpandedParameterPack) ++ addDependence(ExprDependence::UnexpandedPack); ++ // FIXME: this is incorrect for cases where we have a non-dependent ++ // requirement, but its parameters are instantiation-dependent. RequiresExpr ++ // should be instantiation-dependent if it has instantiation-dependent ++ // parameters. ++ if (Dependent) ++ addDependence(ExprDependence::ValueInstantiation); + } + + RequiresExpr::RequiresExpr(ASTContext &C, EmptyShell Empty, +diff --git a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +index 53d0e873f8c9e..6d98429bc89dc 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +@@ -12,6 +12,7 @@ + + #include "clang/AST/ExprObjC.h" + #include "clang/AST/ASTContext.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/SelectorLocationsKind.h" + #include "clang/AST/Type.h" + #include "clang/AST/TypeLoc.h" +@@ -30,13 +31,7 @@ ObjCArrayLiteral::ObjCArrayLiteral(ArrayRef Elements, QualType T, + NumElements(Elements.size()), Range(SR), ArrayWithObjectsMethod(Method) { + Expr **SaveElements = getElements(); + for (unsigned I = 0, N = Elements.size(); I != N; ++I) { +- if (Elements[I]->isTypeDependent() || Elements[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Elements[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Elements[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- ++ addDependence(turnTypeToValueDependence(Elements[I]->getDependence())); + SaveElements[I] = Elements[I]; + } + } +@@ -67,16 +62,11 @@ ObjCDictionaryLiteral::ObjCDictionaryLiteral(ArrayRef VK, + ExpansionData *Expansions = + HasPackExpansions ? getTrailingObjects() : nullptr; + for (unsigned I = 0; I < NumElements; I++) { +- if (VK[I].Key->isTypeDependent() || VK[I].Key->isValueDependent() || +- VK[I].Value->isTypeDependent() || VK[I].Value->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (VK[I].Key->isInstantiationDependent() || +- VK[I].Value->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (VK[I].EllipsisLoc.isInvalid() && +- (VK[I].Key->containsUnexpandedParameterPack() || +- VK[I].Value->containsUnexpandedParameterPack())) +- ExprBits.ContainsUnexpandedParameterPack = true; ++ auto Deps = turnTypeToValueDependence(VK[I].Key->getDependence() | ++ VK[I].Value->getDependence()); ++ if (VK[I].EllipsisLoc.isValid()) ++ Deps &= ~ExprDependence::UnexpandedPack; ++ addDependence(Deps); + + KeyValues[I].Key = VK[I].Key; + KeyValues[I].Value = VK[I].Value; +@@ -183,15 +173,7 @@ void ObjCMessageExpr::initArgsAndSelLocs(ArrayRef Args, + setNumArgs(Args.size()); + Expr **MyArgs = getArgs(); + for (unsigned I = 0; I != Args.size(); ++I) { +- if (Args[I]->isTypeDependent()) +- ExprBits.TypeDependent = true; +- if (Args[I]->isValueDependent()) +- ExprBits.ValueDependent = true; +- if (Args[I]->isInstantiationDependent()) +- ExprBits.InstantiationDependent = true; +- if (Args[I]->containsUnexpandedParameterPack()) +- ExprBits.ContainsUnexpandedParameterPack = true; +- ++ addDependence(Args[I]->getDependence()); + MyArgs[I] = Args[I]; + } + +diff --git a/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp b/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp +index 06008b2f32ac2..8cd65a857beb4 100644 +--- a/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp ++++ b/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp +@@ -16,6 +16,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/PrettyPrinter.h" + #include "clang/AST/TemplateName.h" + #include "clang/AST/Type.h" +@@ -197,75 +198,49 @@ CXXRecordDecl *NestedNameSpecifier::getAsRecordDecl() const { + llvm_unreachable("Invalid NNS Kind!"); + } + +-/// Whether this nested name specifier refers to a dependent +-/// type or not. +-bool NestedNameSpecifier::isDependent() const { ++NestedNameSpecifierDependence NestedNameSpecifier::getDependence() const { + switch (getKind()) { +- case Identifier: ++ case Identifier: { + // Identifier specifiers always represent dependent types +- return true; ++ auto F = NestedNameSpecifierDependence::Dependent | ++ NestedNameSpecifierDependence::Instantiation; ++ // Prefix can contain unexpanded template parameters. ++ if (getPrefix()) ++ return F | getPrefix()->getDependence(); ++ return F; ++ } + + case Namespace: + case NamespaceAlias: + case Global: +- return false; ++ return NestedNameSpecifierDependence::None; + + case Super: { + CXXRecordDecl *RD = static_cast(Specifier); + for (const auto &Base : RD->bases()) + if (Base.getType()->isDependentType()) +- return true; +- +- return false; ++ // FIXME: must also be instantiation-dependent. ++ return NestedNameSpecifierDependence::Dependent; ++ return NestedNameSpecifierDependence::None; + } + + case TypeSpec: + case TypeSpecWithTemplate: +- return getAsType()->isDependentType(); ++ return toNestedNameSpecifierDependendence(getAsType()->getDependence()); + } +- + llvm_unreachable("Invalid NNS Kind!"); + } + +-/// Whether this nested name specifier refers to a dependent +-/// type or not. +-bool NestedNameSpecifier::isInstantiationDependent() const { +- switch (getKind()) { +- case Identifier: +- // Identifier specifiers always represent dependent types +- return true; +- +- case Namespace: +- case NamespaceAlias: +- case Global: +- case Super: +- return false; +- +- case TypeSpec: +- case TypeSpecWithTemplate: +- return getAsType()->isInstantiationDependentType(); +- } ++bool NestedNameSpecifier::isDependent() const { ++ return getDependence() & NestedNameSpecifierDependence::Dependent; ++} + +- llvm_unreachable("Invalid NNS Kind!"); ++bool NestedNameSpecifier::isInstantiationDependent() const { ++ return getDependence() & NestedNameSpecifierDependence::Instantiation; + } + + bool NestedNameSpecifier::containsUnexpandedParameterPack() const { +- switch (getKind()) { +- case Identifier: +- return getPrefix() && getPrefix()->containsUnexpandedParameterPack(); +- +- case Namespace: +- case NamespaceAlias: +- case Global: +- case Super: +- return false; +- +- case TypeSpec: +- case TypeSpecWithTemplate: +- return getAsType()->containsUnexpandedParameterPack(); +- } +- +- llvm_unreachable("Invalid NNS Kind!"); ++ return getDependence() & NestedNameSpecifierDependence::UnexpandedPack; + } + + /// Print this nested name specifier to the given output +diff --git a/../clang-10.0.1.src/lib/AST/TemplateBase.cpp b/../clang-10.0.1.src/lib/AST/TemplateBase.cpp +index 6f0ebf232e77c..3c550bddaff8c 100644 +--- a/../clang-10.0.1.src/lib/AST/TemplateBase.cpp ++++ b/../clang-10.0.1.src/lib/AST/TemplateBase.cpp +@@ -16,6 +16,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclBase.h" + #include "clang/AST/DeclTemplate.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/PrettyPrinter.h" +@@ -111,84 +112,60 @@ TemplateArgument::CreatePackCopy(ASTContext &Context, + return TemplateArgument(Args.copy(Context)); + } + +-bool TemplateArgument::isDependent() const { ++TemplateArgumentDependence TemplateArgument::getDependence() const { ++ auto Deps = TemplateArgumentDependence::None; + switch (getKind()) { + case Null: + llvm_unreachable("Should not have a NULL template argument"); + + case Type: +- return getAsType()->isDependentType() || +- isa(getAsType()); ++ Deps = toTemplateArgumentDependence(getAsType()->getDependence()); ++ if (isa(getAsType())) ++ Deps |= TemplateArgumentDependence::Dependent; ++ return Deps; + + case Template: +- return getAsTemplate().isDependent(); ++ return toTemplateArgumentDependence(getAsTemplate().getDependence()); + + case TemplateExpansion: +- return true; ++ return TemplateArgumentDependence::Dependent | ++ TemplateArgumentDependence::Instantiation; + +- case Declaration: +- if (DeclContext *DC = dyn_cast(getAsDecl())) +- return DC->isDependentContext(); +- return getAsDecl()->getDeclContext()->isDependentContext(); ++ case Declaration: { ++ auto *DC = dyn_cast(getAsDecl()); ++ if (!DC) ++ DC = getAsDecl()->getDeclContext(); ++ if (DC->isDependentContext()) ++ Deps = TemplateArgumentDependence::Dependent | ++ TemplateArgumentDependence::Instantiation; ++ return Deps; ++ } + + case NullPtr: +- return false; +- + case Integral: +- // Never dependent +- return false; ++ return TemplateArgumentDependence::None; + + case Expression: +- return (getAsExpr()->isTypeDependent() || getAsExpr()->isValueDependent() || +- isa(getAsExpr())); ++ Deps = toTemplateArgumentDependence(getAsExpr()->getDependence()); ++ if (isa(getAsExpr())) ++ Deps |= TemplateArgumentDependence::Dependent | ++ TemplateArgumentDependence::Instantiation; ++ return Deps; + + case Pack: + for (const auto &P : pack_elements()) +- if (P.isDependent()) +- return true; +- return false; ++ Deps |= P.getDependence(); ++ return Deps; + } ++ llvm_unreachable("unhandled ArgKind"); ++} + +- llvm_unreachable("Invalid TemplateArgument Kind!"); ++bool TemplateArgument::isDependent() const { ++ return getDependence() & TemplateArgumentDependence::Dependent; + } + + bool TemplateArgument::isInstantiationDependent() const { +- switch (getKind()) { +- case Null: +- llvm_unreachable("Should not have a NULL template argument"); +- +- case Type: +- return getAsType()->isInstantiationDependentType(); +- +- case Template: +- return getAsTemplate().isInstantiationDependent(); +- +- case TemplateExpansion: +- return true; +- +- case Declaration: +- if (DeclContext *DC = dyn_cast(getAsDecl())) +- return DC->isDependentContext(); +- return getAsDecl()->getDeclContext()->isDependentContext(); +- +- case NullPtr: +- return false; +- +- case Integral: +- // Never dependent +- return false; +- +- case Expression: +- return getAsExpr()->isInstantiationDependent(); +- +- case Pack: +- for (const auto &P : pack_elements()) +- if (P.isInstantiationDependent()) +- return true; +- return false; +- } +- +- llvm_unreachable("Invalid TemplateArgument Kind!"); ++ return getDependence() & TemplateArgumentDependence::Instantiation; + } + + bool TemplateArgument::isPackExpansion() const { +@@ -215,38 +192,7 @@ bool TemplateArgument::isPackExpansion() const { + } + + bool TemplateArgument::containsUnexpandedParameterPack() const { +- switch (getKind()) { +- case Null: +- case Declaration: +- case Integral: +- case TemplateExpansion: +- case NullPtr: +- break; +- +- case Type: +- if (getAsType()->containsUnexpandedParameterPack()) +- return true; +- break; +- +- case Template: +- if (getAsTemplate().containsUnexpandedParameterPack()) +- return true; +- break; +- +- case Expression: +- if (getAsExpr()->containsUnexpandedParameterPack()) +- return true; +- break; +- +- case Pack: +- for (const auto &P : pack_elements()) +- if (P.containsUnexpandedParameterPack()) +- return true; +- +- break; +- } +- +- return false; ++ return getDependence() & TemplateArgumentDependence::UnexpandedPack; + } + + Optional TemplateArgument::getNumTemplateExpansions() const { +@@ -601,20 +547,14 @@ void ASTTemplateKWAndArgsInfo::initializeFrom(SourceLocation TemplateKWLoc) { + + void ASTTemplateKWAndArgsInfo::initializeFrom( + SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info, +- TemplateArgumentLoc *OutArgArray, bool &Dependent, +- bool &InstantiationDependent, bool &ContainsUnexpandedParameterPack) { ++ TemplateArgumentLoc *OutArgArray, TemplateArgumentDependence &Deps) { + this->TemplateKWLoc = TemplateKWLoc; + LAngleLoc = Info.getLAngleLoc(); + RAngleLoc = Info.getRAngleLoc(); + NumTemplateArgs = Info.size(); + + for (unsigned i = 0; i != NumTemplateArgs; ++i) { +- Dependent = Dependent || Info[i].getArgument().isDependent(); +- InstantiationDependent = InstantiationDependent || +- Info[i].getArgument().isInstantiationDependent(); +- ContainsUnexpandedParameterPack = +- ContainsUnexpandedParameterPack || +- Info[i].getArgument().containsUnexpandedParameterPack(); ++ Deps |= Info[i].getArgument().getDependence(); + + new (&OutArgArray[i]) TemplateArgumentLoc(Info[i]); + } +diff --git a/../clang-10.0.1.src/lib/AST/TemplateName.cpp b/../clang-10.0.1.src/lib/AST/TemplateName.cpp +index 06e1dcec74492..afabc575b1647 100644 +--- a/../clang-10.0.1.src/lib/AST/TemplateName.cpp ++++ b/../clang-10.0.1.src/lib/AST/TemplateName.cpp +@@ -11,8 +11,10 @@ + //===----------------------------------------------------------------------===// + + #include "clang/AST/TemplateName.h" ++#include "clang/AST/Decl.h" + #include "clang/AST/DeclBase.h" + #include "clang/AST/DeclTemplate.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/PrettyPrinter.h" + #include "clang/AST/TemplateBase.h" +@@ -168,52 +170,54 @@ TemplateName TemplateName::getNameToSubstitute() const { + return TemplateName(Decl); + } + +-bool TemplateName::isDependent() const { ++TemplateNameDependence TemplateName::getDependence() const { ++ auto D = TemplateNameDependence::None; ++ switch (getKind()) { ++ case TemplateName::NameKind::QualifiedTemplate: ++ D |= toTemplateNameDependence( ++ getAsQualifiedTemplateName()->getQualifier()->getDependence()); ++ break; ++ case TemplateName::NameKind::DependentTemplate: ++ D |= toTemplateNameDependence( ++ getAsDependentTemplateName()->getQualifier()->getDependence()); ++ break; ++ case TemplateName::NameKind::SubstTemplateTemplateParmPack: ++ D |= TemplateNameDependence::UnexpandedPack; ++ break; ++ case TemplateName::NameKind::OverloadedTemplate: ++ assert(false && "overloaded templates shouldn't survive to here."); ++ default: ++ break; ++ } + if (TemplateDecl *Template = getAsTemplateDecl()) { +- if (isa(Template)) +- return true; ++ if (auto *TTP = dyn_cast(Template)) { ++ D |= TemplateNameDependence::DependentInstantiation; ++ if (TTP->isParameterPack()) ++ D |= TemplateNameDependence::UnexpandedPack; ++ } + // FIXME: Hack, getDeclContext() can be null if Template is still + // initializing due to PCH reading, so we check it before using it. + // Should probably modify TemplateSpecializationType to allow constructing + // it without the isDependent() checking. +- return Template->getDeclContext() && +- Template->getDeclContext()->isDependentContext(); ++ if (Template->getDeclContext() && ++ Template->getDeclContext()->isDependentContext()) ++ D |= TemplateNameDependence::DependentInstantiation; ++ } else { ++ D |= TemplateNameDependence::DependentInstantiation; + } ++ return D; ++} + +- assert(!getAsOverloadedTemplate() && +- "overloaded templates shouldn't survive to here"); +- +- return true; ++bool TemplateName::isDependent() const { ++ return getDependence() & TemplateNameDependence::Dependent; + } + + bool TemplateName::isInstantiationDependent() const { +- if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) { +- if (QTN->getQualifier()->isInstantiationDependent()) +- return true; +- } +- +- return isDependent(); ++ return getDependence() & TemplateNameDependence::Instantiation; + } + + bool TemplateName::containsUnexpandedParameterPack() const { +- if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) { +- if (QTN->getQualifier()->containsUnexpandedParameterPack()) +- return true; +- } +- +- if (TemplateDecl *Template = getAsTemplateDecl()) { +- if (TemplateTemplateParmDecl *TTP +- = dyn_cast(Template)) +- return TTP->isParameterPack(); +- +- return false; +- } +- +- if (DependentTemplateName *DTN = getAsDependentTemplateName()) +- return DTN->getQualifier() && +- DTN->getQualifier()->containsUnexpandedParameterPack(); +- +- return getAsSubstTemplateTemplateParmPack() != nullptr; ++ return getDependence() & TemplateNameDependence::UnexpandedPack; + } + + void +diff --git a/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp b/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp +index b4be10deda322..9ecf5867e9661 100644 +--- a/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp ++++ b/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp +@@ -10,10 +10,10 @@ + // + //===----------------------------------------------------------------------===// + +-#include "clang/Sema/Overload.h" + #include "clang/AST/ASTContext.h" + #include "clang/AST/CXXInheritance.h" + #include "clang/AST/DeclObjC.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/ExprObjC.h" +@@ -25,6 +25,7 @@ + #include "clang/Basic/TargetInfo.h" + #include "clang/Sema/Initialization.h" + #include "clang/Sema/Lookup.h" ++#include "clang/Sema/Overload.h" + #include "clang/Sema/SemaInternal.h" + #include "clang/Sema/Template.h" + #include "clang/Sema/TemplateDeduction.h" +@@ -12719,9 +12720,7 @@ bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn, + // base classes. + CallExpr *CE = CallExpr::Create(Context, Fn, Args, Context.DependentTy, + VK_RValue, RParenLoc); +- CE->setTypeDependent(true); +- CE->setValueDependent(true); +- CE->setInstantiationDependent(true); ++ CE->addDependence(ExprDependence::TypeValueInstantiation); + *Result = CE; + return true; + } +diff --git a/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp b/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp +index fc83dc42d4d15..42803b1a39181 100644 +--- a/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp ++++ b/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp +@@ -11,7 +11,6 @@ + // + //===----------------------------------------------------------------------===// + +-#include "clang/Serialization/ASTRecordReader.h" + #include "clang/AST/ASTConcept.h" + #include "clang/AST/ASTContext.h" + #include "clang/AST/AttrIterator.h" +@@ -22,6 +21,7 @@ + #include "clang/AST/DeclObjC.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" ++#include "clang/AST/DependencyFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/ExprObjC.h" +@@ -49,6 +49,7 @@ + #include "clang/Basic/TypeTraits.h" + #include "clang/Lex/Token.h" + #include "clang/Serialization/ASTBitCodes.h" ++#include "clang/Serialization/ASTRecordReader.h" + #include "llvm/ADT/DenseMap.h" + #include "llvm/ADT/SmallString.h" + #include "llvm/ADT/SmallVector.h" +@@ -511,10 +512,23 @@ void ASTStmtReader::VisitCapturedStmt(CapturedStmt *S) { + void ASTStmtReader::VisitExpr(Expr *E) { + VisitStmt(E); + E->setType(Record.readType()); +- E->setTypeDependent(Record.readInt()); +- E->setValueDependent(Record.readInt()); +- E->setInstantiationDependent(Record.readInt()); +- E->ExprBits.ContainsUnexpandedParameterPack = Record.readInt(); ++ ++ // FIXME: write and read all DependentFlags with a single call. ++ bool TypeDependent = Record.readInt(); ++ bool ValueDependent = Record.readInt(); ++ bool InstantiationDependent = Record.readInt(); ++ bool ContainsUnexpandedTemplateParameters = Record.readInt(); ++ auto Deps = ExprDependence::None; ++ if (TypeDependent) ++ Deps |= ExprDependence::Type; ++ if (ValueDependent) ++ Deps |= ExprDependence::Value; ++ if (InstantiationDependent) ++ Deps |= ExprDependence::Instantiation; ++ if (ContainsUnexpandedTemplateParameters) ++ Deps |= ExprDependence::UnexpandedPack; ++ E->setDependence(Deps); ++ + E->setValueKind(static_cast(Record.readInt())); + E->setObjectKind(static_cast(Record.readInt())); + assert(Record.getIdx() == NumExprFields && diff --git a/LLVM/patches/windows/002-move_dependence_computations.patch.txt b/LLVM/patches/windows/002-move_dependence_computations.patch.txt new file mode 100644 index 0000000000..00037760bb --- /dev/null +++ b/LLVM/patches/windows/002-move_dependence_computations.patch.txt @@ -0,0 +1,3802 @@ +From 876bb86e26c18fa6e1bbd100e693c4e62cacacc2 Mon Sep 17 00:00:00 2001 +From: Haojian Wu +Date: Tue, 17 Mar 2020 08:33:37 +0100 +Subject: [PATCH] [AST] Move dependence computations into a separate file + +To group the code in one place, simplify it and make it easier to add +the containsErrors bit and find existing bugs. + +Reviewers: sammccall + +Reviewed By: sammccall + +Tags: #clang + +Differential Revision: https://reviews.llvm.org/D73638 +--- + clang/include/clang/AST/ComputeDependence.h | 182 +++++ + clang/include/clang/AST/DependenceFlags.h | 7 + + clang/include/clang/AST/Expr.h | 347 ++++------ + clang/include/clang/AST/ExprCXX.h | 222 +++---- + clang/include/clang/AST/ExprObjC.h | 168 +++-- + clang/include/clang/AST/ExprOpenMP.h | 19 +- + clang/include/clang/AST/TemplateBase.h | 3 + + clang/lib/AST/ASTImporter.cpp | 5 +- + clang/lib/AST/CMakeLists.txt | 1 + + clang/lib/AST/ComputeDependence.cpp | 701 ++++++++++++++++++++ + clang/lib/AST/Expr.cpp | 335 +++------- + clang/lib/AST/ExprCXX.cpp | 217 ++---- + clang/lib/AST/ExprConcepts.cpp | 64 +- + clang/lib/AST/ExprObjC.cpp | 41 +- + clang/lib/Sema/SemaExpr.cpp | 8 +- + clang/lib/Sema/SemaPseudoObject.cpp | 15 +- + 16 files changed, 1391 insertions(+), 944 deletions(-) + create mode 100644 clang/include/clang/AST/ComputeDependence.h + create mode 100644 clang/lib/AST/ComputeDependence.cpp + +diff --git a/../clang-10.0.1.src/include/clang/AST/ComputeDependence.h b/../clang-10.0.1.src/include/clang/AST/ComputeDependence.h +new file mode 100644 +index 0000000000000..593ff3a6eb163 +--- /dev/null ++++ b/../clang-10.0.1.src/include/clang/AST/ComputeDependence.h +@@ -0,0 +1,182 @@ ++//===--- ComputeDependence.h -------------------------------------- C++ -*-===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++// ++// Calculate various template dependency flags for the AST. ++// ++//===----------------------------------------------------------------------===// ++ ++#ifndef LLVM_CLANG_AST_COMPUTE_DEPENDENCE_H ++#define LLVM_CLANG_AST_COMPUTE_DEPENDENCE_H ++ ++#include "clang/AST/DependenceFlags.h" ++#include "clang/Basic/ExceptionSpecificationType.h" ++#include "llvm/ADT/ArrayRef.h" ++ ++namespace clang { ++ ++class ASTContext; ++ ++class Expr; ++class FullExpr; ++class OpaqueValueExpr; ++class ParenExpr; ++class UnaryOperator; ++class UnaryExprOrTypeTraitExpr; ++class ArraySubscriptExpr; ++class CompoundLiteralExpr; ++class CastExpr; ++class BinaryOperator; ++class ConditionalOperator; ++class BinaryConditionalOperator; ++class StmtExpr; ++class ConvertVectorExpr; ++class VAArgExpr; ++class ChooseExpr; ++class NoInitExpr; ++class ArrayInitLoopExpr; ++class ImplicitValueInitExpr; ++class InitListExpr; ++class ExtVectorElementExpr; ++class BlockExpr; ++class AsTypeExpr; ++class DeclRefExpr; ++class CXXRewrittenBinaryOperator; ++class CXXStdInitializerListExpr; ++class CXXTypeidExpr; ++class MSPropertyRefExpr; ++class MSPropertySubscriptExpr; ++class CXXUuidofExpr; ++class CXXThisExpr; ++class CXXThrowExpr; ++class CXXBindTemporaryExpr; ++class CXXScalarValueInitExpr; ++class CXXDeleteExpr; ++class ArrayTypeTraitExpr; ++class ExpressionTraitExpr; ++class CXXNoexceptExpr; ++class SubstNonTypeTemplateParmExpr; ++class CoroutineSuspendExpr; ++class DependentCoawaitExpr; ++class CXXNewExpr; ++class CXXPseudoDestructorExpr; ++class OverloadExpr; ++class DependentScopeDeclRefExpr; ++class CXXConstructExpr; ++class LambdaExpr; ++class CXXUnresolvedConstructExpr; ++class CXXDependentScopeMemberExpr; ++class MaterializeTemporaryExpr; ++class TypeTraitExpr; ++class ConceptSpecializationExpr; ++class PredefinedExpr; ++class CallExpr; ++class OffsetOfExpr; ++class MemberExpr; ++class ShuffleVectorExpr; ++class GenericSelectionExpr; ++class DesignatedInitExpr; ++class ParenListExpr; ++class PseudoObjectExpr; ++class AtomicExpr; ++class OMPArraySectionExpr; ++class ObjCArrayLiteral; ++class ObjCDictionaryLiteral; ++class ObjCBoxedExpr; ++class ObjCEncodeExpr; ++class ObjCIvarRefExpr; ++class ObjCPropertyRefExpr; ++class ObjCSubscriptRefExpr; ++class ObjCIsaExpr; ++class ObjCIndirectCopyRestoreExpr; ++class ObjCMessageExpr; ++ ++// The following functions are called from constructors of `Expr`, so they ++// should not access anything beyond basic ++ExprDependence computeDependence(FullExpr *E); ++ExprDependence computeDependence(OpaqueValueExpr *E); ++ExprDependence computeDependence(ParenExpr *E); ++ExprDependence computeDependence(UnaryOperator *E); ++ExprDependence computeDependence(UnaryExprOrTypeTraitExpr *E); ++ExprDependence computeDependence(ArraySubscriptExpr *E); ++ExprDependence computeDependence(CompoundLiteralExpr *E); ++ExprDependence computeDependence(CastExpr *E); ++ExprDependence computeDependence(BinaryOperator *E); ++ExprDependence computeDependence(ConditionalOperator *E); ++ExprDependence computeDependence(BinaryConditionalOperator *E); ++ExprDependence computeDependence(StmtExpr *E, unsigned TemplateDepth); ++ExprDependence computeDependence(ConvertVectorExpr *E); ++ExprDependence computeDependence(VAArgExpr *E); ++ExprDependence computeDependence(ChooseExpr *E); ++ExprDependence computeDependence(NoInitExpr *E); ++ExprDependence computeDependence(ArrayInitLoopExpr *E); ++ExprDependence computeDependence(ImplicitValueInitExpr *E); ++ExprDependence computeDependence(InitListExpr *E); ++ExprDependence computeDependence(ExtVectorElementExpr *E); ++ExprDependence computeDependence(BlockExpr *E); ++ExprDependence computeDependence(AsTypeExpr *E); ++ExprDependence computeDependence(DeclRefExpr *E, const ASTContext &Ctx); ++ExprDependence computeDependence(CXXRewrittenBinaryOperator *E); ++ExprDependence computeDependence(CXXStdInitializerListExpr *E); ++ExprDependence computeDependence(CXXTypeidExpr *E); ++ExprDependence computeDependence(MSPropertyRefExpr *E); ++ExprDependence computeDependence(MSPropertySubscriptExpr *E); ++ExprDependence computeDependence(CXXUuidofExpr *E); ++ExprDependence computeDependence(CXXThisExpr *E); ++ExprDependence computeDependence(CXXThrowExpr *E); ++ExprDependence computeDependence(CXXBindTemporaryExpr *E); ++ExprDependence computeDependence(CXXScalarValueInitExpr *E); ++ExprDependence computeDependence(CXXDeleteExpr *E); ++ExprDependence computeDependence(ArrayTypeTraitExpr *E); ++ExprDependence computeDependence(ExpressionTraitExpr *E); ++ExprDependence computeDependence(CXXNoexceptExpr *E, CanThrowResult CT); ++ExprDependence computeDependence(SubstNonTypeTemplateParmExpr *E); ++ExprDependence computeDependence(CoroutineSuspendExpr *E); ++ExprDependence computeDependence(DependentCoawaitExpr *E); ++ExprDependence computeDependence(CXXNewExpr *E); ++ExprDependence computeDependence(CXXPseudoDestructorExpr *E); ++ExprDependence computeDependence(OverloadExpr *E, bool KnownDependent, ++ bool KnownInstantiationDependent, ++ bool KnownContainsUnexpandedParameterPack); ++ExprDependence computeDependence(DependentScopeDeclRefExpr *E); ++ExprDependence computeDependence(CXXConstructExpr *E); ++ExprDependence computeDependence(LambdaExpr *E, ++ bool ContainsUnexpandedParameterPack); ++ExprDependence computeDependence(CXXUnresolvedConstructExpr *E); ++ExprDependence computeDependence(CXXDependentScopeMemberExpr *E); ++ExprDependence computeDependence(MaterializeTemporaryExpr *E); ++ExprDependence computeDependence(TypeTraitExpr *E); ++ExprDependence computeDependence(ConceptSpecializationExpr *E, ++ bool ValueDependent); ++ ++ExprDependence computeDependence(PredefinedExpr *E); ++ExprDependence computeDependence(CallExpr *E, llvm::ArrayRef PreArgs); ++ExprDependence computeDependence(OffsetOfExpr *E); ++ExprDependence computeDependence(MemberExpr *E); ++ExprDependence computeDependence(ShuffleVectorExpr *E); ++ExprDependence computeDependence(GenericSelectionExpr *E, ++ bool ContainsUnexpandedPack); ++ExprDependence computeDependence(DesignatedInitExpr *E); ++ExprDependence computeDependence(ParenListExpr *E); ++ExprDependence computeDependence(PseudoObjectExpr *E); ++ExprDependence computeDependence(AtomicExpr *E); ++ ++ExprDependence computeDependence(OMPArraySectionExpr *E); ++ ++ExprDependence computeDependence(ObjCArrayLiteral *E); ++ExprDependence computeDependence(ObjCDictionaryLiteral *E); ++ExprDependence computeDependence(ObjCBoxedExpr *E); ++ExprDependence computeDependence(ObjCEncodeExpr *E); ++ExprDependence computeDependence(ObjCIvarRefExpr *E); ++ExprDependence computeDependence(ObjCPropertyRefExpr *E); ++ExprDependence computeDependence(ObjCSubscriptRefExpr *E); ++ExprDependence computeDependence(ObjCIsaExpr *E); ++ExprDependence computeDependence(ObjCIndirectCopyRestoreExpr *E); ++ExprDependence computeDependence(ObjCMessageExpr *E); ++ ++} // namespace clang ++#endif +diff --git a/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h b/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h +index 8aeb828b8e8c1..21daf0a203ac8 100644 +--- a/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h ++++ b/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h +@@ -23,6 +23,7 @@ struct ExprDependenceScope { + None = 0, + All = 15, + ++ TypeValue = Type | Value, + TypeInstantiation = Type | Instantiation, + ValueInstantiation = Value | Instantiation, + TypeValueInstantiation = Type | Value | Instantiation, +@@ -94,6 +95,12 @@ inline ExprDependence toExprDependence(TypeDependence TD) { + return toExprDependence(static_cast( + TD & ~TypeDependence::VariablyModified)); + } ++inline ExprDependence toExprDependence(NestedNameSpecifierDependence NSD) { ++ // This hack works because TypeDependence and TemplateArgumentDependence ++ // share the same bit representation. ++ return toExprDependence(static_cast(NSD)) & ++ ~ExprDependence::TypeValue; ++} + inline ExprDependence turnTypeToValueDependence(ExprDependence D) { + // Type-dependent expressions are always be value-dependent, so we simply drop + // type dependency. +diff --git a/../clang-10.0.1.src/include/clang/AST/Expr.h b/../clang-10.0.1.src/include/clang/AST/Expr.h +index 372d64763c4bc..7448281c92890 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Expr.h ++++ b/../clang-10.0.1.src/include/clang/AST/Expr.h +@@ -15,6 +15,7 @@ + + #include "clang/AST/APValue.h" + #include "clang/AST/ASTVector.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclAccessPair.h" + #include "clang/AST/DependenceFlags.h" +@@ -117,21 +118,9 @@ class Expr : public ValueStmt { + Expr &operator=(Expr&&) = delete; + + protected: +- Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, +- bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack) +- : ValueStmt(SC) +- { +- auto D = ExprDependence::None; +- if (TD) +- D |= ExprDependence::Type; +- if (VD) +- D |= ExprDependence::Value; +- if (ID) +- D |= ExprDependence::Instantiation; +- if (ContainsUnexpandedParameterPack) +- D |= ExprDependence::UnexpandedPack; +- +- ExprBits.Dependent = static_cast(D); ++ Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK) ++ : ValueStmt(SC) { ++ ExprBits.Dependent = 0; + ExprBits.ValueKind = VK; + ExprBits.ObjectKind = OK; + assert(ExprBits.ObjectKind == OK && "truncated kind"); +@@ -160,6 +149,8 @@ class Expr : public ValueStmt { + return static_cast(ExprBits.Dependent); + } + ++ /// Each concrete expr subclass is expected to compute its dependence and call ++ /// this in the constructor. + void setDependence(ExprDependence Deps) { + ExprBits.Dependent = static_cast(Deps); + } +@@ -958,11 +949,11 @@ class FullExpr : public Expr { + Stmt *SubExpr; + + FullExpr(StmtClass SC, Expr *subexpr) +- : Expr(SC, subexpr->getType(), +- subexpr->getValueKind(), subexpr->getObjectKind(), +- subexpr->isTypeDependent(), subexpr->isValueDependent(), +- subexpr->isInstantiationDependent(), +- subexpr->containsUnexpandedParameterPack()), SubExpr(subexpr) {} ++ : Expr(SC, subexpr->getType(), subexpr->getValueKind(), ++ subexpr->getObjectKind()), ++ SubExpr(subexpr) { ++ setDependence(computeDependence(this)); ++ } + FullExpr(StmtClass SC, EmptyShell Empty) + : Expr(SC, Empty) {} + public: +@@ -1088,19 +1079,11 @@ class OpaqueValueExpr : public Expr { + + public: + OpaqueValueExpr(SourceLocation Loc, QualType T, ExprValueKind VK, +- ExprObjectKind OK = OK_Ordinary, +- Expr *SourceExpr = nullptr) +- : Expr(OpaqueValueExprClass, T, VK, OK, +- T->isDependentType() || +- (SourceExpr && SourceExpr->isTypeDependent()), +- T->isDependentType() || +- (SourceExpr && SourceExpr->isValueDependent()), +- T->isInstantiationDependentType() || +- (SourceExpr && SourceExpr->isInstantiationDependent()), +- false), +- SourceExpr(SourceExpr) { ++ ExprObjectKind OK = OK_Ordinary, Expr *SourceExpr = nullptr) ++ : Expr(OpaqueValueExprClass, T, VK, OK), SourceExpr(SourceExpr) { + setIsUnique(false); + OpaqueValueExprBits.Loc = Loc; ++ setDependence(computeDependence(this)); + } + + /// Given an expression which invokes a copy constructor --- i.e. a +@@ -1550,10 +1533,10 @@ class CharacterLiteral : public Expr { + // type should be IntTy + CharacterLiteral(unsigned value, CharacterKind kind, QualType type, + SourceLocation l) +- : Expr(CharacterLiteralClass, type, VK_RValue, OK_Ordinary, false, false, +- false, false), +- Value(value), Loc(l) { ++ : Expr(CharacterLiteralClass, type, VK_RValue, OK_Ordinary), Value(value), ++ Loc(l) { + CharacterLiteralBits.Kind = kind; ++ setDependence(ExprDependence::None); + } + + /// Construct an empty character literal. +@@ -1669,9 +1652,9 @@ class ImaginaryLiteral : public Expr { + Stmt *Val; + public: + ImaginaryLiteral(Expr *val, QualType Ty) +- : Expr(ImaginaryLiteralClass, Ty, VK_RValue, OK_Ordinary, false, false, +- false, false), +- Val(val) {} ++ : Expr(ImaginaryLiteralClass, Ty, VK_RValue, OK_Ordinary), Val(val) { ++ setDependence(ExprDependence::None); ++ } + + /// Build an empty imaginary literal. + explicit ImaginaryLiteral(EmptyShell Empty) +@@ -2002,12 +1985,11 @@ class ParenExpr : public Expr { + Stmt *Val; + public: + ParenExpr(SourceLocation l, SourceLocation r, Expr *val) +- : Expr(ParenExprClass, val->getType(), +- val->getValueKind(), val->getObjectKind(), +- val->isTypeDependent(), val->isValueDependent(), +- val->isInstantiationDependent(), +- val->containsUnexpandedParameterPack()), +- L(l), R(r), Val(val) {} ++ : Expr(ParenExprClass, val->getType(), val->getValueKind(), ++ val->getObjectKind()), ++ L(l), R(r), Val(val) { ++ setDependence(computeDependence(this)); ++ } + + /// Construct an empty parenthesized expression. + explicit ParenExpr(EmptyShell Empty) +@@ -2057,16 +2039,11 @@ class UnaryOperator : public Expr { + + UnaryOperator(Expr *input, Opcode opc, QualType type, ExprValueKind VK, + ExprObjectKind OK, SourceLocation l, bool CanOverflow) +- : Expr(UnaryOperatorClass, type, VK, OK, +- input->isTypeDependent() || type->isDependentType(), +- input->isValueDependent(), +- (input->isInstantiationDependent() || +- type->isInstantiationDependentType()), +- input->containsUnexpandedParameterPack()), +- Val(input) { ++ : Expr(UnaryOperatorClass, type, VK, OK), Val(input) { + UnaryOperatorBits.Opc = opc; + UnaryOperatorBits.CanOverflow = CanOverflow; + UnaryOperatorBits.Loc = l; ++ setDependence(computeDependence(this)); + } + + /// Build an empty unary operator. +@@ -2385,17 +2362,13 @@ class UnaryExprOrTypeTraitExpr : public Expr { + public: + UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, TypeSourceInfo *TInfo, + QualType resultType, SourceLocation op, +- SourceLocation rp) : +- Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary, +- false, // Never type-dependent (C++ [temp.dep.expr]p3). +- // Value-dependent if the argument is type-dependent. +- TInfo->getType()->isDependentType(), +- TInfo->getType()->isInstantiationDependentType(), +- TInfo->getType()->containsUnexpandedParameterPack()), +- OpLoc(op), RParenLoc(rp) { ++ SourceLocation rp) ++ : Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary), ++ OpLoc(op), RParenLoc(rp) { + UnaryExprOrTypeTraitExprBits.Kind = ExprKind; + UnaryExprOrTypeTraitExprBits.IsType = true; + Argument.Ty = TInfo; ++ setDependence(computeDependence(this)); + } + + UnaryExprOrTypeTraitExpr(UnaryExprOrTypeTrait ExprKind, Expr *E, +@@ -2472,19 +2445,13 @@ class ArraySubscriptExpr : public Expr { + bool lhsIsBase() const { return getRHS()->getType()->isIntegerType(); } + + public: +- ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation rbracketloc) +- : Expr(ArraySubscriptExprClass, t, VK, OK, +- lhs->isTypeDependent() || rhs->isTypeDependent(), +- lhs->isValueDependent() || rhs->isValueDependent(), +- (lhs->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (lhs->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack())) { ++ ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t, ExprValueKind VK, ++ ExprObjectKind OK, SourceLocation rbracketloc) ++ : Expr(ArraySubscriptExprClass, t, VK, OK) { + SubExprs[LHS] = lhs; + SubExprs[RHS] = rhs; + ArraySubscriptExprBits.RBracketLoc = rbracketloc; ++ setDependence(computeDependence(this)); + } + + /// Create an empty array subscript expression. +@@ -3092,13 +3059,10 @@ class CompoundLiteralExpr : public Expr { + public: + CompoundLiteralExpr(SourceLocation lparenloc, TypeSourceInfo *tinfo, + QualType T, ExprValueKind VK, Expr *init, bool fileScope) +- : Expr(CompoundLiteralExprClass, T, VK, OK_Ordinary, +- tinfo->getType()->isDependentType(), +- init->isValueDependent(), +- (init->isInstantiationDependent() || +- tinfo->getType()->isInstantiationDependentType()), +- init->containsUnexpandedParameterPack()), +- LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) {} ++ : Expr(CompoundLiteralExprClass, T, VK, OK_Ordinary), ++ LParenLoc(lparenloc), TInfoAndScope(tinfo, fileScope), Init(init) { ++ setDependence(computeDependence(this)); ++ } + + /// Construct an empty compound literal. + explicit CompoundLiteralExpr(EmptyShell Empty) +@@ -3164,26 +3128,13 @@ class CastExpr : public Expr { + protected: + CastExpr(StmtClass SC, QualType ty, ExprValueKind VK, const CastKind kind, + Expr *op, unsigned BasePathSize) +- : Expr(SC, ty, VK, OK_Ordinary, +- // Cast expressions are type-dependent if the type is +- // dependent (C++ [temp.dep.expr]p3). +- ty->isDependentType(), +- // Cast expressions are value-dependent if the type is +- // dependent or if the subexpression is value-dependent. +- ty->isDependentType() || (op && op->isValueDependent()), +- (ty->isInstantiationDependentType() || +- (op && op->isInstantiationDependent())), +- // An implicit cast expression doesn't (lexically) contain an +- // unexpanded pack, even if its target type does. +- ((SC != ImplicitCastExprClass && +- ty->containsUnexpandedParameterPack()) || +- (op && op->containsUnexpandedParameterPack()))), +- Op(op) { ++ : Expr(SC, ty, VK, OK_Ordinary), Op(op) { + CastExprBits.Kind = kind; + CastExprBits.PartOfExplicitCast = false; + CastExprBits.BasePathSize = BasePathSize; + assert((CastExprBits.BasePathSize == BasePathSize) && + "BasePathSize overflow!"); ++ setDependence(computeDependence(this)); + assert(CastConsistency()); + } + +@@ -3443,15 +3394,9 @@ class BinaryOperator : public Expr { + typedef BinaryOperatorKind Opcode; + + BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation opLoc, FPOptions FPFeatures) +- : Expr(BinaryOperatorClass, ResTy, VK, OK, +- lhs->isTypeDependent() || rhs->isTypeDependent(), +- lhs->isValueDependent() || rhs->isValueDependent(), +- (lhs->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (lhs->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack())) { ++ ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, ++ FPOptions FPFeatures) ++ : Expr(BinaryOperatorClass, ResTy, VK, OK) { + BinaryOperatorBits.Opc = opc; + BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); + BinaryOperatorBits.OpLoc = opLoc; +@@ -3459,6 +3404,7 @@ class BinaryOperator : public Expr { + SubExprs[RHS] = rhs; + assert(!isCompoundAssignmentOp() && + "Use CompoundAssignOperator for compound assignments"); ++ setDependence(computeDependence(this)); + } + + /// Construct an empty binary operator. +@@ -3628,20 +3574,15 @@ class BinaryOperator : public Expr { + + protected: + BinaryOperator(Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation opLoc, FPOptions FPFeatures, bool dead2) +- : Expr(CompoundAssignOperatorClass, ResTy, VK, OK, +- lhs->isTypeDependent() || rhs->isTypeDependent(), +- lhs->isValueDependent() || rhs->isValueDependent(), +- (lhs->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (lhs->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack())) { ++ ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, ++ FPOptions FPFeatures, bool dead2) ++ : Expr(CompoundAssignOperatorClass, ResTy, VK, OK) { + BinaryOperatorBits.Opc = opc; + BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); + BinaryOperatorBits.OpLoc = opLoc; + SubExprs[LHS] = lhs; + SubExprs[RHS] = rhs; ++ setDependence(computeDependence(this)); + } + + BinaryOperator(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) { +@@ -3696,14 +3637,10 @@ class AbstractConditionalOperator : public Expr { + friend class ASTStmtReader; + + protected: +- AbstractConditionalOperator(StmtClass SC, QualType T, +- ExprValueKind VK, ExprObjectKind OK, +- bool TD, bool VD, bool ID, +- bool ContainsUnexpandedParameterPack, +- SourceLocation qloc, ++ AbstractConditionalOperator(StmtClass SC, QualType T, ExprValueKind VK, ++ ExprObjectKind OK, SourceLocation qloc, + SourceLocation cloc) +- : Expr(SC, T, VK, OK, TD, VD, ID, ContainsUnexpandedParameterPack), +- QuestionLoc(qloc), ColonLoc(cloc) {} ++ : Expr(SC, T, VK, OK), QuestionLoc(qloc), ColonLoc(cloc) {} + + AbstractConditionalOperator(StmtClass SC, EmptyShell Empty) + : Expr(SC, Empty) { } +@@ -3742,26 +3679,12 @@ class ConditionalOperator : public AbstractConditionalOperator { + ConditionalOperator(Expr *cond, SourceLocation QLoc, Expr *lhs, + SourceLocation CLoc, Expr *rhs, QualType t, + ExprValueKind VK, ExprObjectKind OK) +- : AbstractConditionalOperator( +- ConditionalOperatorClass, t, VK, OK, +- // The type of the conditional operator depends on the type +- // of the conditional to support the GCC vector conditional +- // extension. Additionally, [temp.dep.expr] does specify state that +- // this should be dependent on ALL sub expressions. +- (cond->isTypeDependent() || lhs->isTypeDependent() || +- rhs->isTypeDependent()), +- (cond->isValueDependent() || lhs->isValueDependent() || +- rhs->isValueDependent()), +- (cond->isInstantiationDependent() || +- lhs->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (cond->containsUnexpandedParameterPack() || +- lhs->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack()), +- QLoc, CLoc) { ++ : AbstractConditionalOperator(ConditionalOperatorClass, t, VK, OK, QLoc, ++ CLoc) { + SubExprs[COND] = cond; + SubExprs[LHS] = lhs; + SubExprs[RHS] = rhs; ++ setDependence(computeDependence(this)); + } + + /// Build an empty conditional operator. +@@ -3826,20 +3749,15 @@ class BinaryConditionalOperator : public AbstractConditionalOperator { + Expr *cond, Expr *lhs, Expr *rhs, + SourceLocation qloc, SourceLocation cloc, + QualType t, ExprValueKind VK, ExprObjectKind OK) +- : AbstractConditionalOperator(BinaryConditionalOperatorClass, t, VK, OK, +- (common->isTypeDependent() || rhs->isTypeDependent()), +- (common->isValueDependent() || rhs->isValueDependent()), +- (common->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (common->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack()), +- qloc, cloc), +- OpaqueValue(opaqueValue) { ++ : AbstractConditionalOperator(BinaryConditionalOperatorClass, t, VK, OK, ++ qloc, cloc), ++ OpaqueValue(opaqueValue) { + SubExprs[COMMON] = common; + SubExprs[COND] = cond; + SubExprs[LHS] = lhs; + SubExprs[RHS] = rhs; + assert(OpaqueValue->getSourceExpr() == common && "Wrong opaque value"); ++ setDependence(computeDependence(this)); + } + + /// Build an empty conditional operator. +@@ -3917,9 +3835,10 @@ class AddrLabelExpr : public Expr { + public: + AddrLabelExpr(SourceLocation AALoc, SourceLocation LLoc, LabelDecl *L, + QualType t) +- : Expr(AddrLabelExprClass, t, VK_RValue, OK_Ordinary, false, false, false, +- false), +- AmpAmpLoc(AALoc), LabelLoc(LLoc), Label(L) {} ++ : Expr(AddrLabelExprClass, t, VK_RValue, OK_Ordinary), AmpAmpLoc(AALoc), ++ LabelLoc(LLoc), Label(L) { ++ setDependence(ExprDependence::None); ++ } + + /// Build an empty address of a label expression. + explicit AddrLabelExpr(EmptyShell Empty) +@@ -3961,12 +3880,9 @@ class StmtExpr : public Expr { + public: + StmtExpr(CompoundStmt *SubStmt, QualType T, SourceLocation LParenLoc, + SourceLocation RParenLoc, unsigned TemplateDepth) +- : // We treat a statement-expression in a dependent context as +- // always being value- and instantiation-dependent. This matches the +- // behavior of lambda-expressions and GCC. +- Expr(StmtExprClass, T, VK_RValue, OK_Ordinary, T->isDependentType(), +- TemplateDepth != 0, TemplateDepth != 0, false), +- SubStmt(SubStmt), LParenLoc(LParenLoc), RParenLoc(RParenLoc) { ++ : Expr(StmtExprClass, T, VK_RValue, OK_Ordinary), SubStmt(SubStmt), ++ LParenLoc(LParenLoc), RParenLoc(RParenLoc) { ++ setDependence(computeDependence(this, TemplateDepth)); + // FIXME: A templated statement expression should have an associated + // DeclContext so that nested declarations always have a dependent context. + StmtExprBits.TemplateDepth = TemplateDepth; +@@ -4085,17 +4001,13 @@ class ConvertVectorExpr : public Expr { + explicit ConvertVectorExpr(EmptyShell Empty) : Expr(ConvertVectorExprClass, Empty) {} + + public: +- ConvertVectorExpr(Expr* SrcExpr, TypeSourceInfo *TI, QualType DstType, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation BuiltinLoc, SourceLocation RParenLoc) +- : Expr(ConvertVectorExprClass, DstType, VK, OK, +- DstType->isDependentType(), +- DstType->isDependentType() || SrcExpr->isValueDependent(), +- (DstType->isInstantiationDependentType() || +- SrcExpr->isInstantiationDependent()), +- (DstType->containsUnexpandedParameterPack() || +- SrcExpr->containsUnexpandedParameterPack())), +- SrcExpr(SrcExpr), TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {} ++ ConvertVectorExpr(Expr *SrcExpr, TypeSourceInfo *TI, QualType DstType, ++ ExprValueKind VK, ExprObjectKind OK, ++ SourceLocation BuiltinLoc, SourceLocation RParenLoc) ++ : Expr(ConvertVectorExprClass, DstType, VK, OK), SrcExpr(SrcExpr), ++ TInfo(TI), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) { ++ setDependence(computeDependence(this)); ++ } + + /// getSrcExpr - Return the Expr to be converted. + Expr *getSrcExpr() const { return cast(SrcExpr); } +@@ -4143,22 +4055,17 @@ class ChooseExpr : public Expr { + SourceLocation BuiltinLoc, RParenLoc; + bool CondIsTrue; + public: +- ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, +- QualType t, ExprValueKind VK, ExprObjectKind OK, +- SourceLocation RP, bool condIsTrue, +- bool TypeDependent, bool ValueDependent) +- : Expr(ChooseExprClass, t, VK, OK, TypeDependent, ValueDependent, +- (cond->isInstantiationDependent() || +- lhs->isInstantiationDependent() || +- rhs->isInstantiationDependent()), +- (cond->containsUnexpandedParameterPack() || +- lhs->containsUnexpandedParameterPack() || +- rhs->containsUnexpandedParameterPack())), +- BuiltinLoc(BLoc), RParenLoc(RP), CondIsTrue(condIsTrue) { +- SubExprs[COND] = cond; +- SubExprs[LHS] = lhs; +- SubExprs[RHS] = rhs; +- } ++ ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t, ++ ExprValueKind VK, ExprObjectKind OK, SourceLocation RP, ++ bool condIsTrue) ++ : Expr(ChooseExprClass, t, VK, OK), BuiltinLoc(BLoc), RParenLoc(RP), ++ CondIsTrue(condIsTrue) { ++ SubExprs[COND] = cond; ++ SubExprs[LHS] = lhs; ++ SubExprs[RHS] = rhs; ++ ++ setDependence(computeDependence(this)); ++ } + + /// Build an empty __builtin_choose_expr. + explicit ChooseExpr(EmptyShell Empty) : Expr(ChooseExprClass, Empty) { } +@@ -4223,9 +4130,9 @@ class GNUNullExpr : public Expr { + + public: + GNUNullExpr(QualType Ty, SourceLocation Loc) +- : Expr(GNUNullExprClass, Ty, VK_RValue, OK_Ordinary, false, false, false, +- false), +- TokenLoc(Loc) { } ++ : Expr(GNUNullExprClass, Ty, VK_RValue, OK_Ordinary), TokenLoc(Loc) { ++ setDependence(ExprDependence::None); ++ } + + /// Build an empty GNU __null expression. + explicit GNUNullExpr(EmptyShell Empty) : Expr(GNUNullExprClass, Empty) { } +@@ -4258,12 +4165,10 @@ class VAArgExpr : public Expr { + public: + VAArgExpr(SourceLocation BLoc, Expr *e, TypeSourceInfo *TInfo, + SourceLocation RPLoc, QualType t, bool IsMS) +- : Expr(VAArgExprClass, t, VK_RValue, OK_Ordinary, t->isDependentType(), +- false, (TInfo->getType()->isInstantiationDependentType() || +- e->isInstantiationDependent()), +- (TInfo->getType()->containsUnexpandedParameterPack() || +- e->containsUnexpandedParameterPack())), +- Val(e), TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) {} ++ : Expr(VAArgExprClass, t, VK_RValue, OK_Ordinary), Val(e), ++ TInfo(TInfo, IsMS), BuiltinLoc(BLoc), RParenLoc(RPLoc) { ++ setDependence(computeDependence(this)); ++ } + + /// Create an empty __builtin_va_arg expression. + explicit VAArgExpr(EmptyShell Empty) +@@ -4942,8 +4847,9 @@ class DesignatedInitExpr final + class NoInitExpr : public Expr { + public: + explicit NoInitExpr(QualType ty) +- : Expr(NoInitExprClass, ty, VK_RValue, OK_Ordinary, +- false, false, ty->isInstantiationDependentType(), false) { } ++ : Expr(NoInitExprClass, ty, VK_RValue, OK_Ordinary) { ++ setDependence(computeDependence(this)); ++ } + + explicit NoInitExpr(EmptyShell Empty) + : Expr(NoInitExprClass, Empty) { } +@@ -5037,12 +4943,10 @@ class ArrayInitLoopExpr : public Expr { + + public: + explicit ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit) +- : Expr(ArrayInitLoopExprClass, T, VK_RValue, OK_Ordinary, false, +- CommonInit->isValueDependent() || ElementInit->isValueDependent(), +- T->isInstantiationDependentType(), +- CommonInit->containsUnexpandedParameterPack() || +- ElementInit->containsUnexpandedParameterPack()), +- SubExprs{CommonInit, ElementInit} {} ++ : Expr(ArrayInitLoopExprClass, T, VK_RValue, OK_Ordinary), ++ SubExprs{CommonInit, ElementInit} { ++ setDependence(computeDependence(this)); ++ } + + /// Get the common subexpression shared by all initializations (the source + /// array). +@@ -5090,8 +4994,9 @@ class ArrayInitIndexExpr : public Expr { + + public: + explicit ArrayInitIndexExpr(QualType T) +- : Expr(ArrayInitIndexExprClass, T, VK_RValue, OK_Ordinary, +- false, false, false, false) {} ++ : Expr(ArrayInitIndexExprClass, T, VK_RValue, OK_Ordinary) { ++ setDependence(ExprDependence::None); ++ } + + static bool classof(const Stmt *S) { + return S->getStmtClass() == ArrayInitIndexExprClass; +@@ -5122,8 +5027,9 @@ class ArrayInitIndexExpr : public Expr { + class ImplicitValueInitExpr : public Expr { + public: + explicit ImplicitValueInitExpr(QualType ty) +- : Expr(ImplicitValueInitExprClass, ty, VK_RValue, OK_Ordinary, +- false, false, ty->isInstantiationDependentType(), false) { } ++ : Expr(ImplicitValueInitExprClass, ty, VK_RValue, OK_Ordinary) { ++ setDependence(computeDependence(this)); ++ } + + /// Construct an empty implicit value initialization. + explicit ImplicitValueInitExpr(EmptyShell Empty) +@@ -5525,12 +5431,11 @@ class ExtVectorElementExpr : public Expr { + public: + ExtVectorElementExpr(QualType ty, ExprValueKind VK, Expr *base, + IdentifierInfo &accessor, SourceLocation loc) +- : Expr(ExtVectorElementExprClass, ty, VK, +- (VK == VK_RValue ? OK_Ordinary : OK_VectorComponent), +- base->isTypeDependent(), base->isValueDependent(), +- base->isInstantiationDependent(), +- base->containsUnexpandedParameterPack()), +- Base(base), Accessor(&accessor), AccessorLoc(loc) {} ++ : Expr(ExtVectorElementExprClass, ty, VK, ++ (VK == VK_RValue ? OK_Ordinary : OK_VectorComponent)), ++ Base(base), Accessor(&accessor), AccessorLoc(loc) { ++ setDependence(computeDependence(this)); ++ } + + /// Build an empty vector element expression. + explicit ExtVectorElementExpr(EmptyShell Empty) +@@ -5584,11 +5489,9 @@ class BlockExpr : public Expr { + BlockDecl *TheBlock; + public: + BlockExpr(BlockDecl *BD, QualType ty) +- : Expr(BlockExprClass, ty, VK_RValue, OK_Ordinary, +- ty->isDependentType(), ty->isDependentType(), +- ty->isInstantiationDependentType() || BD->isDependentContext(), +- false), +- TheBlock(BD) {} ++ : Expr(BlockExprClass, ty, VK_RValue, OK_Ordinary), TheBlock(BD) { ++ setDependence(computeDependence(this)); ++ } + + /// Build an empty block expression. + explicit BlockExpr(EmptyShell Empty) : Expr(BlockExprClass, Empty) { } +@@ -5652,17 +5555,13 @@ class AsTypeExpr : public Expr { + explicit AsTypeExpr(EmptyShell Empty) : Expr(AsTypeExprClass, Empty) {} + + public: +- AsTypeExpr(Expr* SrcExpr, QualType DstType, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation BuiltinLoc, SourceLocation RParenLoc) +- : Expr(AsTypeExprClass, DstType, VK, OK, +- DstType->isDependentType(), +- DstType->isDependentType() || SrcExpr->isValueDependent(), +- (DstType->isInstantiationDependentType() || +- SrcExpr->isInstantiationDependent()), +- (DstType->containsUnexpandedParameterPack() || +- SrcExpr->containsUnexpandedParameterPack())), +- SrcExpr(SrcExpr), BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) {} ++ AsTypeExpr(Expr *SrcExpr, QualType DstType, ExprValueKind VK, ++ ExprObjectKind OK, SourceLocation BuiltinLoc, ++ SourceLocation RParenLoc) ++ : Expr(AsTypeExprClass, DstType, VK, OK), SrcExpr(SrcExpr), ++ BuiltinLoc(BuiltinLoc), RParenLoc(RParenLoc) { ++ setDependence(computeDependence(this)); ++ } + + /// getSrcExpr - Return the Expr to be converted. + Expr *getSrcExpr() const { return cast(SrcExpr); } +@@ -5980,13 +5879,9 @@ class AtomicExpr : public Expr { + /// still needs to be performed and/or an error diagnostic emitted. + class TypoExpr : public Expr { + public: +- TypoExpr(QualType T) +- : Expr(TypoExprClass, T, VK_LValue, OK_Ordinary, +- /*isTypeDependent*/ true, +- /*isValueDependent*/ true, +- /*isInstantiationDependent*/ true, +- /*containsUnexpandedParameterPack*/ false) { ++ TypoExpr(QualType T) : Expr(TypoExprClass, T, VK_LValue, OK_Ordinary) { + assert(T->isDependentType() && "TypoExpr given a non-dependent type"); ++ setDependence(ExprDependence::TypeValueInstantiation); + } + + child_range children() { +diff --git a/../clang-10.0.1.src/include/clang/AST/ExprCXX.h b/../clang-10.0.1.src/include/clang/AST/ExprCXX.h +index 694575790f48b..33ea3f6346b22 100644 +--- a/../clang-10.0.1.src/include/clang/AST/ExprCXX.h ++++ b/../clang-10.0.1.src/include/clang/AST/ExprCXX.h +@@ -14,11 +14,14 @@ + #ifndef LLVM_CLANG_AST_EXPRCXX_H + #define LLVM_CLANG_AST_EXPRCXX_H + ++#include "clang/AST/ASTConcept.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclBase.h" + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/OperationKinds.h" +@@ -295,12 +298,10 @@ class CXXRewrittenBinaryOperator : public Expr { + public: + CXXRewrittenBinaryOperator(Expr *SemanticForm, bool IsReversed) + : Expr(CXXRewrittenBinaryOperatorClass, SemanticForm->getType(), +- SemanticForm->getValueKind(), SemanticForm->getObjectKind(), +- SemanticForm->isTypeDependent(), SemanticForm->isValueDependent(), +- SemanticForm->isInstantiationDependent(), +- SemanticForm->containsUnexpandedParameterPack()), ++ SemanticForm->getValueKind(), SemanticForm->getObjectKind()), + SemanticForm(SemanticForm) { + CXXRewrittenBinaryOperatorBits.IsReversed = IsReversed; ++ setDependence(computeDependence(this)); + } + CXXRewrittenBinaryOperator(EmptyShell Empty) + : Expr(CXXRewrittenBinaryOperatorClass, Empty), SemanticForm() {} +@@ -661,10 +662,10 @@ class UserDefinedLiteral final : public CallExpr { + class CXXBoolLiteralExpr : public Expr { + public: + CXXBoolLiteralExpr(bool Val, QualType Ty, SourceLocation Loc) +- : Expr(CXXBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false, +- false, false) { ++ : Expr(CXXBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary) { + CXXBoolLiteralExprBits.Value = Val; + CXXBoolLiteralExprBits.Loc = Loc; ++ setDependence(ExprDependence::None); + } + + explicit CXXBoolLiteralExpr(EmptyShell Empty) +@@ -699,9 +700,9 @@ class CXXBoolLiteralExpr : public Expr { + class CXXNullPtrLiteralExpr : public Expr { + public: + CXXNullPtrLiteralExpr(QualType Ty, SourceLocation Loc) +- : Expr(CXXNullPtrLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, +- false, false, false) { ++ : Expr(CXXNullPtrLiteralExprClass, Ty, VK_RValue, OK_Ordinary) { + CXXNullPtrLiteralExprBits.Loc = Loc; ++ setDependence(ExprDependence::None); + } + + explicit CXXNullPtrLiteralExpr(EmptyShell Empty) +@@ -739,11 +740,10 @@ class CXXStdInitializerListExpr : public Expr { + friend class ASTStmtReader; + + CXXStdInitializerListExpr(QualType Ty, Expr *SubExpr) +- : Expr(CXXStdInitializerListExprClass, Ty, VK_RValue, OK_Ordinary, +- Ty->isDependentType(), SubExpr->isValueDependent(), +- SubExpr->isInstantiationDependent(), +- SubExpr->containsUnexpandedParameterPack()), +- SubExpr(SubExpr) {} ++ : Expr(CXXStdInitializerListExprClass, Ty, VK_RValue, OK_Ordinary), ++ SubExpr(SubExpr) { ++ setDependence(computeDependence(this)); ++ } + + Expr *getSubExpr() { return static_cast(SubExpr); } + const Expr *getSubExpr() const { return static_cast(SubExpr); } +@@ -784,26 +784,16 @@ class CXXTypeidExpr : public Expr { + + public: + CXXTypeidExpr(QualType Ty, TypeSourceInfo *Operand, SourceRange R) +- : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary, +- // typeid is never type-dependent (C++ [temp.dep.expr]p4) +- false, +- // typeid is value-dependent if the type or expression are +- // dependent +- Operand->getType()->isDependentType(), +- Operand->getType()->isInstantiationDependentType(), +- Operand->getType()->containsUnexpandedParameterPack()), +- Operand(Operand), Range(R) {} ++ : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand), ++ Range(R) { ++ setDependence(computeDependence(this)); ++ } + + CXXTypeidExpr(QualType Ty, Expr *Operand, SourceRange R) +- : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary, +- // typeid is never type-dependent (C++ [temp.dep.expr]p4) +- false, +- // typeid is value-dependent if the type or expression are +- // dependent +- Operand->isTypeDependent() || Operand->isValueDependent(), +- Operand->isInstantiationDependent(), +- Operand->containsUnexpandedParameterPack()), +- Operand(Operand), Range(R) {} ++ : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand), ++ Range(R) { ++ setDependence(computeDependence(this)); ++ } + + CXXTypeidExpr(EmptyShell Empty, bool isExpr) + : Expr(CXXTypeidExprClass, Empty) { +@@ -888,15 +878,12 @@ class MSPropertyRefExpr : public Expr { + + MSPropertyRefExpr(Expr *baseExpr, MSPropertyDecl *decl, bool isArrow, + QualType ty, ExprValueKind VK, +- NestedNameSpecifierLoc qualifierLoc, +- SourceLocation nameLoc) +- : Expr(MSPropertyRefExprClass, ty, VK, OK_Ordinary, +- /*type-dependent*/ false, baseExpr->isValueDependent(), +- baseExpr->isInstantiationDependent(), +- baseExpr->containsUnexpandedParameterPack()), +- BaseExpr(baseExpr), TheDecl(decl), +- MemberLoc(nameLoc), IsArrow(isArrow), +- QualifierLoc(qualifierLoc) {} ++ NestedNameSpecifierLoc qualifierLoc, SourceLocation nameLoc) ++ : Expr(MSPropertyRefExprClass, ty, VK, OK_Ordinary), BaseExpr(baseExpr), ++ TheDecl(decl), MemberLoc(nameLoc), IsArrow(isArrow), ++ QualifierLoc(qualifierLoc) { ++ setDependence(computeDependence(this)); ++ } + + MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {} + +@@ -964,12 +951,11 @@ class MSPropertySubscriptExpr : public Expr { + public: + MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK, + ExprObjectKind OK, SourceLocation RBracketLoc) +- : Expr(MSPropertySubscriptExprClass, Ty, VK, OK, Idx->isTypeDependent(), +- Idx->isValueDependent(), Idx->isInstantiationDependent(), +- Idx->containsUnexpandedParameterPack()), ++ : Expr(MSPropertySubscriptExprClass, Ty, VK, OK), + RBracketLoc(RBracketLoc) { + SubExprs[BASE_EXPR] = Base; + SubExprs[IDX_EXPR] = Idx; ++ setDependence(computeDependence(this)); + } + + /// Create an empty array subscript expression. +@@ -1022,17 +1008,16 @@ class CXXUuidofExpr : public Expr { + public: + CXXUuidofExpr(QualType Ty, TypeSourceInfo *Operand, StringRef UuidStr, + SourceRange R) +- : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary, false, +- Operand->getType()->isDependentType(), +- Operand->getType()->isInstantiationDependentType(), +- Operand->getType()->containsUnexpandedParameterPack()), +- Operand(Operand), UuidStr(UuidStr), Range(R) {} ++ : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand), ++ UuidStr(UuidStr), Range(R) { ++ setDependence(computeDependence(this)); ++ } + + CXXUuidofExpr(QualType Ty, Expr *Operand, StringRef UuidStr, SourceRange R) +- : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary, false, +- Operand->isTypeDependent(), Operand->isInstantiationDependent(), +- Operand->containsUnexpandedParameterPack()), +- Operand(Operand), UuidStr(UuidStr), Range(R) {} ++ : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary), Operand(Operand), ++ UuidStr(UuidStr), Range(R) { ++ setDependence(computeDependence(this)); ++ } + + CXXUuidofExpr(EmptyShell Empty, bool isExpr) + : Expr(CXXUuidofExprClass, Empty) { +@@ -1113,14 +1098,10 @@ class CXXUuidofExpr : public Expr { + class CXXThisExpr : public Expr { + public: + CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit) +- : Expr(CXXThisExprClass, Ty, VK_RValue, OK_Ordinary, +- // 'this' is type-dependent if the class type of the enclosing +- // member function is dependent (C++ [temp.dep.expr]p2) +- Ty->isDependentType(), Ty->isDependentType(), +- Ty->isInstantiationDependentType(), +- /*ContainsUnexpandedParameterPack=*/false) { ++ : Expr(CXXThisExprClass, Ty, VK_RValue, OK_Ordinary) { + CXXThisExprBits.IsImplicit = IsImplicit; + CXXThisExprBits.Loc = L; ++ setDependence(computeDependence(this)); + } + + CXXThisExpr(EmptyShell Empty) : Expr(CXXThisExprClass, Empty) {} +@@ -1166,12 +1147,10 @@ class CXXThrowExpr : public Expr { + // null if not present. + CXXThrowExpr(Expr *Operand, QualType Ty, SourceLocation Loc, + bool IsThrownVariableInScope) +- : Expr(CXXThrowExprClass, Ty, VK_RValue, OK_Ordinary, false, false, +- Operand && Operand->isInstantiationDependent(), +- Operand && Operand->containsUnexpandedParameterPack()), +- Operand(Operand) { ++ : Expr(CXXThrowExprClass, Ty, VK_RValue, OK_Ordinary), Operand(Operand) { + CXXThrowExprBits.ThrowLoc = Loc; + CXXThrowExprBits.IsThrownVariableInScope = IsThrownVariableInScope; ++ setDependence(computeDependence(this)); + } + CXXThrowExpr(EmptyShell Empty) : Expr(CXXThrowExprClass, Empty) {} + +@@ -1225,16 +1204,16 @@ class CXXDefaultArgExpr final : public Expr { + DeclContext *UsedContext; + + CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *Param, +- DeclContext *UsedContext) ++ DeclContext *UsedContext) + : Expr(SC, + Param->hasUnparsedDefaultArg() + ? Param->getType().getNonReferenceType() + : Param->getDefaultArg()->getType(), + Param->getDefaultArg()->getValueKind(), +- Param->getDefaultArg()->getObjectKind(), false, false, false, +- false), ++ Param->getDefaultArg()->getObjectKind()), + Param(Param), UsedContext(UsedContext) { + CXXDefaultArgExprBits.Loc = Loc; ++ setDependence(ExprDependence::None); + } + + public: +@@ -1390,13 +1369,12 @@ class CXXBindTemporaryExpr : public Expr { + CXXTemporary *Temp = nullptr; + Stmt *SubExpr = nullptr; + +- CXXBindTemporaryExpr(CXXTemporary *temp, Expr* SubExpr) +- : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), +- VK_RValue, OK_Ordinary, SubExpr->isTypeDependent(), +- SubExpr->isValueDependent(), +- SubExpr->isInstantiationDependent(), +- SubExpr->containsUnexpandedParameterPack()), +- Temp(temp), SubExpr(SubExpr) {} ++ CXXBindTemporaryExpr(CXXTemporary *temp, Expr *SubExpr) ++ : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), VK_RValue, ++ OK_Ordinary), ++ Temp(temp), SubExpr(SubExpr) { ++ setDependence(computeDependence(this)); ++ } + + public: + CXXBindTemporaryExpr(EmptyShell Empty) +@@ -1647,12 +1625,12 @@ class CXXInheritedCtorInitExpr : public Expr { + CXXInheritedCtorInitExpr(SourceLocation Loc, QualType T, + CXXConstructorDecl *Ctor, bool ConstructsVirtualBase, + bool InheritedFromVirtualBase) +- : Expr(CXXInheritedCtorInitExprClass, T, VK_RValue, OK_Ordinary, false, +- false, false, false), ++ : Expr(CXXInheritedCtorInitExprClass, T, VK_RValue, OK_Ordinary), + Constructor(Ctor), Loc(Loc), + ConstructsVirtualBase(ConstructsVirtualBase), + InheritedFromVirtualBase(InheritedFromVirtualBase) { + assert(!T->isDependentType()); ++ setDependence(ExprDependence::None); + } + + /// Construct an empty C++ inheriting construction expression. +@@ -2076,11 +2054,10 @@ class CXXScalarValueInitExpr : public Expr { + /// expression. + CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo, + SourceLocation RParenLoc) +- : Expr(CXXScalarValueInitExprClass, Type, VK_RValue, OK_Ordinary, false, +- false, Type->isInstantiationDependentType(), +- Type->containsUnexpandedParameterPack()), ++ : Expr(CXXScalarValueInitExprClass, Type, VK_RValue, OK_Ordinary), + TypeInfo(TypeInfo) { + CXXScalarValueInitExprBits.RParenLoc = RParenLoc; ++ setDependence(computeDependence(this)); + } + + explicit CXXScalarValueInitExpr(EmptyShell Shell) +@@ -2385,15 +2362,14 @@ class CXXDeleteExpr : public Expr { + CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm, + bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize, + FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc) +- : Expr(CXXDeleteExprClass, Ty, VK_RValue, OK_Ordinary, false, +- Arg->isValueDependent(), Arg->isInstantiationDependent(), +- Arg->containsUnexpandedParameterPack()), ++ : Expr(CXXDeleteExprClass, Ty, VK_RValue, OK_Ordinary), + OperatorDelete(OperatorDelete), Argument(Arg) { + CXXDeleteExprBits.GlobalDelete = GlobalDelete; + CXXDeleteExprBits.ArrayForm = ArrayForm; + CXXDeleteExprBits.ArrayFormAsWritten = ArrayFormAsWritten; + CXXDeleteExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize; + CXXDeleteExprBits.Loc = Loc; ++ setDependence(computeDependence(this)); + } + + explicit CXXDeleteExpr(EmptyShell Shell) : Expr(CXXDeleteExprClass, Shell) {} +@@ -2751,15 +2727,13 @@ class ArrayTypeTraitExpr : public Expr { + friend class ASTStmtReader; + + ArrayTypeTraitExpr(SourceLocation loc, ArrayTypeTrait att, +- TypeSourceInfo *queried, uint64_t value, +- Expr *dimension, SourceLocation rparen, QualType ty) +- : Expr(ArrayTypeTraitExprClass, ty, VK_RValue, OK_Ordinary, +- false, queried->getType()->isDependentType(), +- (queried->getType()->isInstantiationDependentType() || +- (dimension && dimension->isInstantiationDependent())), +- queried->getType()->containsUnexpandedParameterPack()), +- ATT(att), Value(value), Dimension(dimension), +- Loc(loc), RParen(rparen), QueriedType(queried) {} ++ TypeSourceInfo *queried, uint64_t value, Expr *dimension, ++ SourceLocation rparen, QualType ty) ++ : Expr(ArrayTypeTraitExprClass, ty, VK_RValue, OK_Ordinary), ATT(att), ++ Value(value), Dimension(dimension), Loc(loc), RParen(rparen), ++ QueriedType(queried) { ++ setDependence(computeDependence(this)); ++ } + + explicit ArrayTypeTraitExpr(EmptyShell Empty) + : Expr(ArrayTypeTraitExprClass, Empty), ATT(0) {} +@@ -2817,17 +2791,13 @@ class ExpressionTraitExpr : public Expr { + public: + friend class ASTStmtReader; + +- ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, +- Expr *queried, bool value, +- SourceLocation rparen, QualType resultType) +- : Expr(ExpressionTraitExprClass, resultType, VK_RValue, OK_Ordinary, +- false, // Not type-dependent +- // Value-dependent if the argument is type-dependent. +- queried->isTypeDependent(), +- queried->isInstantiationDependent(), +- queried->containsUnexpandedParameterPack()), ++ ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, Expr *queried, ++ bool value, SourceLocation rparen, QualType resultType) ++ : Expr(ExpressionTraitExprClass, resultType, VK_RValue, OK_Ordinary), + ET(et), Value(value), Loc(loc), RParen(rparen), +- QueriedExpression(queried) {} ++ QueriedExpression(queried) { ++ setDependence(computeDependence(this)); ++ } + + explicit ExpressionTraitExpr(EmptyShell Empty) + : Expr(ExpressionTraitExprClass, Empty), ET(0), Value(false) {} +@@ -3982,13 +3952,10 @@ class CXXNoexceptExpr : public Expr { + public: + CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, + SourceLocation Keyword, SourceLocation RParen) +- : Expr(CXXNoexceptExprClass, Ty, VK_RValue, OK_Ordinary, +- /*TypeDependent*/ false, +- /*ValueDependent*/ Val == CT_Dependent, +- Val == CT_Dependent || Operand->isInstantiationDependent(), +- Operand->containsUnexpandedParameterPack()), ++ : Expr(CXXNoexceptExprClass, Ty, VK_RValue, OK_Ordinary), + Operand(Operand), Range(Keyword, RParen) { + CXXNoexceptExprBits.Value = Val == CT_Cannot; ++ setDependence(computeDependence(this, Val)); + } + + CXXNoexceptExpr(EmptyShell Empty) : Expr(CXXNoexceptExprClass, Empty) {} +@@ -4049,12 +4016,12 @@ class PackExpansionExpr : public Expr { + PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc, + Optional NumExpansions) + : Expr(PackExpansionExprClass, T, Pattern->getValueKind(), +- Pattern->getObjectKind(), /*TypeDependent=*/true, +- /*ValueDependent=*/true, /*InstantiationDependent=*/true, +- /*ContainsUnexpandedParameterPack=*/false), ++ Pattern->getObjectKind()), + EllipsisLoc(EllipsisLoc), + NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), +- Pattern(Pattern) {} ++ Pattern(Pattern) { ++ setDependence(ExprDependence::TypeValueInstantiation); ++ } + + PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) {} + +@@ -4141,17 +4108,17 @@ class SizeOfPackExpr final + /// the given parameter pack. + SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, + SourceLocation PackLoc, SourceLocation RParenLoc, +- Optional Length, ArrayRef PartialArgs) +- : Expr(SizeOfPackExprClass, SizeType, VK_RValue, OK_Ordinary, +- /*TypeDependent=*/false, /*ValueDependent=*/!Length, +- /*InstantiationDependent=*/!Length, +- /*ContainsUnexpandedParameterPack=*/false), ++ Optional Length, ++ ArrayRef PartialArgs) ++ : Expr(SizeOfPackExprClass, SizeType, VK_RValue, OK_Ordinary), + OperatorLoc(OperatorLoc), PackLoc(PackLoc), RParenLoc(RParenLoc), + Length(Length ? *Length : PartialArgs.size()), Pack(Pack) { + assert((!Length || PartialArgs.empty()) && + "have partial args for non-dependent sizeof... expression"); + auto *Args = getTrailingObjects(); + std::uninitialized_copy(PartialArgs.begin(), PartialArgs.end(), Args); ++ setDependence(Length ? ExprDependence::None ++ : ExprDependence::ValueInstantiation); + } + + /// Create an empty expression. +@@ -4242,12 +4209,10 @@ class SubstNonTypeTemplateParmExpr : public Expr { + SourceLocation Loc, + NonTypeTemplateParmDecl *Param, + Expr *Replacement) +- : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary, +- Replacement->isTypeDependent(), Replacement->isValueDependent(), +- Replacement->isInstantiationDependent(), +- Replacement->containsUnexpandedParameterPack()), ++ : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary), + Param(Param), Replacement(Replacement) { + SubstNonTypeTemplateParmExprBits.NameLoc = Loc; ++ setDependence(computeDependence(this)); + } + + SourceLocation getNameLoc() const { +@@ -4561,13 +4526,12 @@ class CXXFoldExpr : public Expr { + CXXFoldExpr(QualType T, SourceLocation LParenLoc, Expr *LHS, + BinaryOperatorKind Opcode, SourceLocation EllipsisLoc, Expr *RHS, + SourceLocation RParenLoc, Optional NumExpansions) +- : Expr(CXXFoldExprClass, T, VK_RValue, OK_Ordinary, +- /*Dependent*/ true, true, true, +- /*ContainsUnexpandedParameterPack*/ false), +- LParenLoc(LParenLoc), EllipsisLoc(EllipsisLoc), RParenLoc(RParenLoc), ++ : Expr(CXXFoldExprClass, T, VK_RValue, OK_Ordinary), LParenLoc(LParenLoc), ++ EllipsisLoc(EllipsisLoc), RParenLoc(RParenLoc), + NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), Opcode(Opcode) { + SubExprs[0] = LHS; + SubExprs[1] = RHS; ++ setDependence(ExprDependence::TypeValueInstantiation); + } + + CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {} +@@ -4642,27 +4606,25 @@ class CoroutineSuspendExpr : public Expr { + Expr *Ready, Expr *Suspend, Expr *Resume, + OpaqueValueExpr *OpaqueValue) + : Expr(SC, Resume->getType(), Resume->getValueKind(), +- Resume->getObjectKind(), Resume->isTypeDependent(), +- Resume->isValueDependent(), Common->isInstantiationDependent(), +- Common->containsUnexpandedParameterPack()), ++ Resume->getObjectKind()), + KeywordLoc(KeywordLoc), OpaqueValue(OpaqueValue) { + SubExprs[SubExpr::Common] = Common; + SubExprs[SubExpr::Ready] = Ready; + SubExprs[SubExpr::Suspend] = Suspend; + SubExprs[SubExpr::Resume] = Resume; ++ setDependence(computeDependence(this)); + } + + CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, QualType Ty, + Expr *Common) +- : Expr(SC, Ty, VK_RValue, OK_Ordinary, true, true, true, +- Common->containsUnexpandedParameterPack()), +- KeywordLoc(KeywordLoc) { ++ : Expr(SC, Ty, VK_RValue, OK_Ordinary), KeywordLoc(KeywordLoc) { + assert(Common->isTypeDependent() && Ty->isDependentType() && + "wrong constructor for non-dependent co_await/co_yield expression"); + SubExprs[SubExpr::Common] = Common; + SubExprs[SubExpr::Ready] = nullptr; + SubExprs[SubExpr::Suspend] = nullptr; + SubExprs[SubExpr::Resume] = nullptr; ++ setDependence(computeDependence(this)); + } + + CoroutineSuspendExpr(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) { +@@ -4759,10 +4721,7 @@ class DependentCoawaitExpr : public Expr { + public: + DependentCoawaitExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op, + UnresolvedLookupExpr *OpCoawait) +- : Expr(DependentCoawaitExprClass, Ty, VK_RValue, OK_Ordinary, +- /*TypeDependent*/ true, /*ValueDependent*/ true, +- /*InstantiationDependent*/ true, +- Op->containsUnexpandedParameterPack()), ++ : Expr(DependentCoawaitExprClass, Ty, VK_RValue, OK_Ordinary), + KeywordLoc(KeywordLoc) { + // NOTE: A co_await expression is dependent on the coroutines promise + // type and may be dependent even when the `Op` expression is not. +@@ -4770,6 +4729,7 @@ class DependentCoawaitExpr : public Expr { + "wrong constructor for non-dependent co_await/co_yield expression"); + SubExprs[0] = Op; + SubExprs[1] = OpCoawait; ++ setDependence(computeDependence(this)); + } + + DependentCoawaitExpr(EmptyShell Empty) +diff --git a/../clang-10.0.1.src/include/clang/AST/ExprObjC.h b/../clang-10.0.1.src/include/clang/AST/ExprObjC.h +index d76b3a26b1f94..4b39d9ab96a6a 100644 +--- a/../clang-10.0.1.src/include/clang/AST/ExprObjC.h ++++ b/../clang-10.0.1.src/include/clang/AST/ExprObjC.h +@@ -13,8 +13,10 @@ + #ifndef LLVM_CLANG_AST_EXPROBJC_H + #define LLVM_CLANG_AST_EXPROBJC_H + ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclObjC.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/OperationKinds.h" + #include "clang/AST/SelectorLocationsKind.h" +@@ -53,9 +55,10 @@ class ObjCStringLiteral : public Expr { + + public: + ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L) +- : Expr(ObjCStringLiteralClass, T, VK_RValue, OK_Ordinary, false, false, +- false, false), +- String(SL), AtLoc(L) {} ++ : Expr(ObjCStringLiteralClass, T, VK_RValue, OK_Ordinary), String(SL), ++ AtLoc(L) { ++ setDependence(ExprDependence::None); ++ } + explicit ObjCStringLiteral(EmptyShell Empty) + : Expr(ObjCStringLiteralClass, Empty) {} + +@@ -88,9 +91,10 @@ class ObjCBoolLiteralExpr : public Expr { + + public: + ObjCBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) +- : Expr(ObjCBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false, +- false, false), +- Value(val), Loc(l) {} ++ : Expr(ObjCBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary), Value(val), ++ Loc(l) { ++ setDependence(ExprDependence::None); ++ } + explicit ObjCBoolLiteralExpr(EmptyShell Empty) + : Expr(ObjCBoolLiteralExprClass, Empty) {} + +@@ -129,13 +133,11 @@ class ObjCBoxedExpr : public Expr { + public: + friend class ASTStmtReader; + +- ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method, +- SourceRange R) +- : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary, +- E->isTypeDependent(), E->isValueDependent(), +- E->isInstantiationDependent(), +- E->containsUnexpandedParameterPack()), +- SubExpr(E), BoxingMethod(method), Range(R) {} ++ ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method, SourceRange R) ++ : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary), SubExpr(E), ++ BoxingMethod(method), Range(R) { ++ setDependence(computeDependence(this)); ++ } + explicit ObjCBoxedExpr(EmptyShell Empty) + : Expr(ObjCBoxedExprClass, Empty) {} + +@@ -409,14 +411,12 @@ class ObjCEncodeExpr : public Expr { + SourceLocation AtLoc, RParenLoc; + + public: +- ObjCEncodeExpr(QualType T, TypeSourceInfo *EncodedType, +- SourceLocation at, SourceLocation rp) +- : Expr(ObjCEncodeExprClass, T, VK_LValue, OK_Ordinary, +- EncodedType->getType()->isDependentType(), +- EncodedType->getType()->isDependentType(), +- EncodedType->getType()->isInstantiationDependentType(), +- EncodedType->getType()->containsUnexpandedParameterPack()), +- EncodedType(EncodedType), AtLoc(at), RParenLoc(rp) {} ++ ObjCEncodeExpr(QualType T, TypeSourceInfo *EncodedType, SourceLocation at, ++ SourceLocation rp) ++ : Expr(ObjCEncodeExprClass, T, VK_LValue, OK_Ordinary), ++ EncodedType(EncodedType), AtLoc(at), RParenLoc(rp) { ++ setDependence(computeDependence(this)); ++ } + + explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){} + +@@ -456,11 +456,12 @@ class ObjCSelectorExpr : public Expr { + SourceLocation AtLoc, RParenLoc; + + public: +- ObjCSelectorExpr(QualType T, Selector selInfo, +- SourceLocation at, SourceLocation rp) +- : Expr(ObjCSelectorExprClass, T, VK_RValue, OK_Ordinary, false, false, +- false, false), +- SelName(selInfo), AtLoc(at), RParenLoc(rp) {} ++ ObjCSelectorExpr(QualType T, Selector selInfo, SourceLocation at, ++ SourceLocation rp) ++ : Expr(ObjCSelectorExprClass, T, VK_RValue, OK_Ordinary), ++ SelName(selInfo), AtLoc(at), RParenLoc(rp) { ++ setDependence(ExprDependence::None); ++ } + explicit ObjCSelectorExpr(EmptyShell Empty) + : Expr(ObjCSelectorExprClass, Empty) {} + +@@ -508,11 +509,12 @@ class ObjCProtocolExpr : public Expr { + friend class ASTStmtReader; + friend class ASTStmtWriter; + +- ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, +- SourceLocation at, SourceLocation protoLoc, SourceLocation rp) +- : Expr(ObjCProtocolExprClass, T, VK_RValue, OK_Ordinary, false, false, +- false, false), +- TheProtocol(protocol), AtLoc(at), ProtoLoc(protoLoc), RParenLoc(rp) {} ++ ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, SourceLocation at, ++ SourceLocation protoLoc, SourceLocation rp) ++ : Expr(ObjCProtocolExprClass, T, VK_RValue, OK_Ordinary), ++ TheProtocol(protocol), AtLoc(at), ProtoLoc(protoLoc), RParenLoc(rp) { ++ setDependence(ExprDependence::None); ++ } + explicit ObjCProtocolExpr(EmptyShell Empty) + : Expr(ObjCProtocolExprClass, Empty) {} + +@@ -558,17 +560,15 @@ class ObjCIvarRefExpr : public Expr { + bool IsFreeIvar : 1; + + public: +- ObjCIvarRefExpr(ObjCIvarDecl *d, QualType t, +- SourceLocation l, SourceLocation oploc, +- Expr *base, +- bool arrow = false, bool freeIvar = false) ++ ObjCIvarRefExpr(ObjCIvarDecl *d, QualType t, SourceLocation l, ++ SourceLocation oploc, Expr *base, bool arrow = false, ++ bool freeIvar = false) + : Expr(ObjCIvarRefExprClass, t, VK_LValue, +- d->isBitField() ? OK_BitField : OK_Ordinary, +- /*TypeDependent=*/false, base->isValueDependent(), +- base->isInstantiationDependent(), +- base->containsUnexpandedParameterPack()), ++ d->isBitField() ? OK_BitField : OK_Ordinary), + D(d), Base(base), Loc(l), OpLoc(oploc), IsArrow(arrow), +- IsFreeIvar(freeIvar) {} ++ IsFreeIvar(freeIvar) { ++ setDependence(computeDependence(this)); ++ } + + explicit ObjCIvarRefExpr(EmptyShell Empty) + : Expr(ObjCIvarRefExprClass, Empty) {} +@@ -645,57 +645,53 @@ class ObjCPropertyRefExpr : public Expr { + llvm::PointerUnion Receiver; + + public: +- ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation l, Expr *base) +- : Expr(ObjCPropertyRefExprClass, t, VK, OK, +- /*TypeDependent=*/false, base->isValueDependent(), +- base->isInstantiationDependent(), +- base->containsUnexpandedParameterPack()), +- PropertyOrGetter(PD, false), IdLoc(l), Receiver(base) { ++ ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, ExprValueKind VK, ++ ExprObjectKind OK, SourceLocation l, Expr *base) ++ : Expr(ObjCPropertyRefExprClass, t, VK, OK), PropertyOrGetter(PD, false), ++ IdLoc(l), Receiver(base) { + assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject)); ++ setDependence(computeDependence(this)); + } + +- ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, +- ExprValueKind VK, ExprObjectKind OK, +- SourceLocation l, SourceLocation sl, QualType st) +- : Expr(ObjCPropertyRefExprClass, t, VK, OK, +- /*TypeDependent=*/false, false, st->isInstantiationDependentType(), +- st->containsUnexpandedParameterPack()), +- PropertyOrGetter(PD, false), IdLoc(l), ReceiverLoc(sl), +- Receiver(st.getTypePtr()) { ++ ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, ExprValueKind VK, ++ ExprObjectKind OK, SourceLocation l, SourceLocation sl, ++ QualType st) ++ : Expr(ObjCPropertyRefExprClass, t, VK, OK), PropertyOrGetter(PD, false), ++ IdLoc(l), ReceiverLoc(sl), Receiver(st.getTypePtr()) { + assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject)); ++ setDependence(computeDependence(this)); + } + + ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, + QualType T, ExprValueKind VK, ExprObjectKind OK, + SourceLocation IdLoc, Expr *Base) +- : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, +- Base->isValueDependent(), Base->isInstantiationDependent(), +- Base->containsUnexpandedParameterPack()), ++ : Expr(ObjCPropertyRefExprClass, T, VK, OK), + PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), + IdLoc(IdLoc), Receiver(Base) { + assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); ++ setDependence(computeDependence(this)); + } + + ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, + QualType T, ExprValueKind VK, ExprObjectKind OK, +- SourceLocation IdLoc, +- SourceLocation SuperLoc, QualType SuperTy) +- : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false), ++ SourceLocation IdLoc, SourceLocation SuperLoc, ++ QualType SuperTy) ++ : Expr(ObjCPropertyRefExprClass, T, VK, OK), + PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), + IdLoc(IdLoc), ReceiverLoc(SuperLoc), Receiver(SuperTy.getTypePtr()) { + assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); ++ setDependence(computeDependence(this)); + } + + ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, + QualType T, ExprValueKind VK, ExprObjectKind OK, +- SourceLocation IdLoc, +- SourceLocation ReceiverLoc, ObjCInterfaceDecl *Receiver) +- : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false), ++ SourceLocation IdLoc, SourceLocation ReceiverLoc, ++ ObjCInterfaceDecl *Receiver) ++ : Expr(ObjCPropertyRefExprClass, T, VK, OK), + PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), + IdLoc(IdLoc), ReceiverLoc(ReceiverLoc), Receiver(Receiver) { + assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); ++ setDependence(computeDependence(this)); + } + + explicit ObjCPropertyRefExpr(EmptyShell Empty) +@@ -859,20 +855,14 @@ class ObjCSubscriptRefExpr : public Expr { + ObjCMethodDecl *SetAtIndexMethodDecl; + + public: +- ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T, +- ExprValueKind VK, ExprObjectKind OK, +- ObjCMethodDecl *getMethod, ++ ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T, ExprValueKind VK, ++ ExprObjectKind OK, ObjCMethodDecl *getMethod, + ObjCMethodDecl *setMethod, SourceLocation RB) +- : Expr(ObjCSubscriptRefExprClass, T, VK, OK, +- base->isTypeDependent() || key->isTypeDependent(), +- base->isValueDependent() || key->isValueDependent(), +- (base->isInstantiationDependent() || +- key->isInstantiationDependent()), +- (base->containsUnexpandedParameterPack() || +- key->containsUnexpandedParameterPack())), +- RBracket(RB), GetAtIndexMethodDecl(getMethod), +- SetAtIndexMethodDecl(setMethod) { +- SubExprs[BASE] = base; SubExprs[KEY] = key; ++ : Expr(ObjCSubscriptRefExprClass, T, VK, OK), RBracket(RB), ++ GetAtIndexMethodDecl(getMethod), SetAtIndexMethodDecl(setMethod) { ++ SubExprs[BASE] = base; ++ SubExprs[KEY] = key; ++ setDependence(computeDependence(this)); + } + + explicit ObjCSubscriptRefExpr(EmptyShell Empty) +@@ -1505,11 +1495,10 @@ class ObjCIsaExpr : public Expr { + public: + ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, SourceLocation oploc, + QualType ty) +- : Expr(ObjCIsaExprClass, ty, VK_LValue, OK_Ordinary, +- /*TypeDependent=*/false, base->isValueDependent(), +- base->isInstantiationDependent(), +- /*ContainsUnexpandedParameterPack=*/false), +- Base(base), IsaMemberLoc(l), OpLoc(oploc), IsArrow(isarrow) {} ++ : Expr(ObjCIsaExprClass, ty, VK_LValue, OK_Ordinary), Base(base), ++ IsaMemberLoc(l), OpLoc(oploc), IsArrow(isarrow) { ++ setDependence(computeDependence(this)); ++ } + + /// Build an empty expression. + explicit ObjCIsaExpr(EmptyShell Empty) : Expr(ObjCIsaExprClass, Empty) {} +@@ -1591,12 +1580,10 @@ class ObjCIndirectCopyRestoreExpr : public Expr { + + public: + ObjCIndirectCopyRestoreExpr(Expr *operand, QualType type, bool shouldCopy) +- : Expr(ObjCIndirectCopyRestoreExprClass, type, VK_LValue, OK_Ordinary, +- operand->isTypeDependent(), operand->isValueDependent(), +- operand->isInstantiationDependent(), +- operand->containsUnexpandedParameterPack()), ++ : Expr(ObjCIndirectCopyRestoreExprClass, type, VK_LValue, OK_Ordinary), + Operand(operand) { + setShouldCopy(shouldCopy); ++ setDependence(computeDependence(this)); + } + + Expr *getSubExpr() { return cast(Operand); } +@@ -1705,9 +1692,10 @@ class ObjCAvailabilityCheckExpr : public Expr { + public: + ObjCAvailabilityCheckExpr(VersionTuple VersionToCheck, SourceLocation AtLoc, + SourceLocation RParen, QualType Ty) +- : Expr(ObjCAvailabilityCheckExprClass, Ty, VK_RValue, OK_Ordinary, false, +- false, false, false), +- VersionToCheck(VersionToCheck), AtLoc(AtLoc), RParen(RParen) {} ++ : Expr(ObjCAvailabilityCheckExprClass, Ty, VK_RValue, OK_Ordinary), ++ VersionToCheck(VersionToCheck), AtLoc(AtLoc), RParen(RParen) { ++ setDependence(ExprDependence::None); ++ } + + explicit ObjCAvailabilityCheckExpr(EmptyShell Shell) + : Expr(ObjCAvailabilityCheckExprClass, Shell) {} +diff --git a/../clang-10.0.1.src/include/clang/AST/ExprOpenMP.h b/../clang-10.0.1.src/include/clang/AST/ExprOpenMP.h +index 5607d2d1dc588..f971ed8457bcd 100644 +--- a/../clang-10.0.1.src/include/clang/AST/ExprOpenMP.h ++++ b/../clang-10.0.1.src/include/clang/AST/ExprOpenMP.h +@@ -13,6 +13,7 @@ + #ifndef LLVM_CLANG_AST_EXPROPENMP_H + #define LLVM_CLANG_AST_EXPROPENMP_H + ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Expr.h" + + namespace clang { +@@ -51,24 +52,12 @@ class OMPArraySectionExpr : public Expr { + OMPArraySectionExpr(Expr *Base, Expr *LowerBound, Expr *Length, QualType Type, + ExprValueKind VK, ExprObjectKind OK, + SourceLocation ColonLoc, SourceLocation RBracketLoc) +- : Expr( +- OMPArraySectionExprClass, Type, VK, OK, +- Base->isTypeDependent() || +- (LowerBound && LowerBound->isTypeDependent()) || +- (Length && Length->isTypeDependent()), +- Base->isValueDependent() || +- (LowerBound && LowerBound->isValueDependent()) || +- (Length && Length->isValueDependent()), +- Base->isInstantiationDependent() || +- (LowerBound && LowerBound->isInstantiationDependent()) || +- (Length && Length->isInstantiationDependent()), +- Base->containsUnexpandedParameterPack() || +- (LowerBound && LowerBound->containsUnexpandedParameterPack()) || +- (Length && Length->containsUnexpandedParameterPack())), +- ColonLoc(ColonLoc), RBracketLoc(RBracketLoc) { ++ : Expr(OMPArraySectionExprClass, Type, VK, OK), ColonLoc(ColonLoc), ++ RBracketLoc(RBracketLoc) { + SubExprs[BASE] = Base; + SubExprs[LOWER_BOUND] = LowerBound; + SubExprs[LENGTH] = Length; ++ setDependence(computeDependence(this)); + } + + /// Create an empty array section expression. +diff --git a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +index 1875e3eda0395..a8529dc2cf54c 100644 +--- a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h ++++ b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +@@ -669,6 +669,9 @@ struct alignas(void *) ASTTemplateKWAndArgsInfo { + void initializeFrom(SourceLocation TemplateKWLoc, + const TemplateArgumentListInfo &List, + TemplateArgumentLoc *OutArgArray); ++ // FIXME: The parameter Deps is the result populated by this method, the ++ // caller doesn't need it since it is populated by computeDependence. remove ++ // it. + void initializeFrom(SourceLocation TemplateKWLoc, + const TemplateArgumentListInfo &List, + TemplateArgumentLoc *OutArgArray, +diff --git a/../clang-10.0.1.src/lib/AST/ASTImporter.cpp b/../clang-10.0.1.src/lib/AST/ASTImporter.cpp +index c135e95a3dd59..73622f22bcec5 100644 +--- a/../clang-10.0.1.src/lib/AST/ASTImporter.cpp ++++ b/../clang-10.0.1.src/lib/AST/ASTImporter.cpp +@@ -6340,16 +6340,13 @@ ExpectedStmt ASTNodeImporter::VisitChooseExpr(ChooseExpr *E) { + ExprValueKind VK = E->getValueKind(); + ExprObjectKind OK = E->getObjectKind(); + +- bool TypeDependent = ToCond->isTypeDependent(); +- bool ValueDependent = ToCond->isValueDependent(); +- + // The value of CondIsTrue only matters if the value is not + // condition-dependent. + bool CondIsTrue = !E->isConditionDependent() && E->isConditionTrue(); + + return new (Importer.getToContext()) + ChooseExpr(ToBuiltinLoc, ToCond, ToLHS, ToRHS, ToType, VK, OK, +- ToRParenLoc, CondIsTrue, TypeDependent, ValueDependent); ++ ToRParenLoc, CondIsTrue); + } + + ExpectedStmt ASTNodeImporter::VisitGNUNullExpr(GNUNullExpr *E) { +diff --git a/../clang-10.0.1.src/lib/AST/CMakeLists.txt b/../clang-10.0.1.src/lib/AST/CMakeLists.txt +index da7b808e4f519..6018d32af8f8f 100644 +--- a/../clang-10.0.1.src/lib/AST/CMakeLists.txt ++++ b/../clang-10.0.1.src/lib/AST/CMakeLists.txt +@@ -32,6 +32,7 @@ add_clang_library(clangAST + CommentParser.cpp + CommentSema.cpp + ComparisonCategories.cpp ++ ComputeDependence.cpp + CXXInheritance.cpp + DataCollection.cpp + Decl.cpp +diff --git a/../clang-10.0.1.src/lib/AST/ComputeDependence.cpp b/../clang-10.0.1.src/lib/AST/ComputeDependence.cpp +new file mode 100644 +index 0000000000000..673e651173a32 +--- /dev/null ++++ b/../clang-10.0.1.src/lib/AST/ComputeDependence.cpp +@@ -0,0 +1,701 @@ ++//===- ComputeDependence.cpp ----------------------------------------------===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++#include "clang/AST/ComputeDependence.h" ++#include "clang/AST/Attr.h" ++#include "clang/AST/DeclCXX.h" ++#include "clang/AST/DeclarationName.h" ++#include "clang/AST/DependenceFlags.h" ++#include "clang/AST/Expr.h" ++#include "clang/AST/ExprCXX.h" ++#include "clang/AST/ExprConcepts.h" ++#include "clang/AST/ExprObjC.h" ++#include "clang/AST/ExprOpenMP.h" ++#include "clang/Basic/ExceptionSpecificationType.h" ++#include "llvm/ADT/ArrayRef.h" ++ ++using namespace clang; ++ ++ExprDependence clang::computeDependence(FullExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(OpaqueValueExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ if (auto *S = E->getSourceExpr()) ++ D |= S->getDependence(); ++ assert(!(D & ExprDependence::UnexpandedPack)); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ParenExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(UnaryOperator *E) { ++ return toExprDependence(E->getType()->getDependence()) | ++ E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(UnaryExprOrTypeTraitExpr *E) { ++ // Never type-dependent (C++ [temp.dep.expr]p3). ++ // Value-dependent if the argument is type-dependent. ++ if (E->isArgumentType()) ++ return turnTypeToValueDependence( ++ toExprDependence(E->getArgumentType()->getDependence())); ++ ++ auto ArgDeps = E->getArgumentExpr()->getDependence(); ++ auto Deps = ArgDeps & ~ExprDependence::TypeValue; ++ // Value-dependent if the argument is type-dependent. ++ if (ArgDeps & ExprDependence::Type) ++ Deps |= ExprDependence::Value; ++ // Check to see if we are in the situation where alignof(decl) should be ++ // dependent because decl's alignment is dependent. ++ auto ExprKind = E->getKind(); ++ if (ExprKind != UETT_AlignOf && ExprKind != UETT_PreferredAlignOf) ++ return Deps; ++ if ((Deps & ExprDependence::Value) && (Deps & ExprDependence::Instantiation)) ++ return Deps; ++ ++ auto *NoParens = E->getArgumentExpr()->IgnoreParens(); ++ const ValueDecl *D = nullptr; ++ if (const auto *DRE = dyn_cast(NoParens)) ++ D = DRE->getDecl(); ++ else if (const auto *ME = dyn_cast(NoParens)) ++ D = ME->getMemberDecl(); ++ if (!D) ++ return Deps; ++ for (const auto *I : D->specific_attrs()) { ++ if (I->isAlignmentDependent()) ++ return Deps | ExprDependence::ValueInstantiation; ++ } ++ return Deps; ++} ++ ++ExprDependence clang::computeDependence(ArraySubscriptExpr *E) { ++ return E->getLHS()->getDependence() | E->getRHS()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(CompoundLiteralExpr *E) { ++ return toExprDependence(E->getTypeSourceInfo()->getType()->getDependence()) | ++ turnTypeToValueDependence(E->getInitializer()->getDependence()); ++} ++ ++ExprDependence clang::computeDependence(CastExpr *E) { ++ // Cast expressions are type-dependent if the type is ++ // dependent (C++ [temp.dep.expr]p3). ++ // Cast expressions are value-dependent if the type is ++ // dependent or if the subexpression is value-dependent. ++ auto D = toExprDependence(E->getType()->getDependence()); ++ if (E->getStmtClass() == Stmt::ImplicitCastExprClass) { ++ // An implicit cast expression doesn't (lexically) contain an ++ // unexpanded pack, even if its target type does. ++ D &= ~ExprDependence::UnexpandedPack; ++ } ++ if (auto *S = E->getSubExpr()) ++ D |= S->getDependence() & ~ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(BinaryOperator *E) { ++ return E->getLHS()->getDependence() | E->getRHS()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(ConditionalOperator *E) { ++ // The type of the conditional operator depends on the type of the conditional ++ // to support the GCC vector conditional extension. Additionally, ++ // [temp.dep.expr] does specify state that this should be dependent on ALL sub ++ // expressions. ++ return E->getCond()->getDependence() | E->getLHS()->getDependence() | ++ E->getRHS()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(BinaryConditionalOperator *E) { ++ return E->getCommon()->getDependence() | E->getFalseExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(StmtExpr *E, unsigned TemplateDepth) { ++ auto D = ExprDependence::None; ++ if (E->getType()->isDependentType()) ++ D |= ExprDependence::Type; ++ // Note: we treat a statement-expression in a dependent context as always ++ // being value- and instantiation-dependent. This matches the behavior of ++ // lambda-expressions and GCC. ++ if (TemplateDepth) ++ D |= ExprDependence::ValueInstantiation; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ConvertVectorExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()) | ++ E->getSrcExpr()->getDependence(); ++ if (!E->getType()->isDependentType()) ++ D &= ~ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ChooseExpr *E) { ++ if (E->isConditionDependent()) ++ return ExprDependence::TypeValueInstantiation | ++ E->getCond()->getDependence() | E->getLHS()->getDependence() | ++ E->getRHS()->getDependence(); ++ ++ auto Cond = E->getCond()->getDependence(); ++ auto Active = E->getLHS()->getDependence(); ++ auto Inactive = E->getRHS()->getDependence(); ++ if (!E->isConditionTrue()) ++ std::swap(Active, Inactive); ++ // Take type- and value- dependency from the active branch. Propagate all ++ // other flags from all branches. ++ return (Active & ExprDependence::TypeValue) | ++ ((Cond | Active | Inactive) & ~ExprDependence::TypeValue); ++} ++ ++ExprDependence clang::computeDependence(ParenListExpr *P) { ++ auto D = ExprDependence::None; ++ for (auto *E : P->exprs()) ++ D |= E->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(VAArgExpr *E) { ++ auto D = ++ toExprDependence(E->getWrittenTypeInfo()->getType()->getDependence()) | ++ (E->getSubExpr()->getDependence() & ~ExprDependence::Type); ++ return D & ~ExprDependence::Value; ++} ++ ++ExprDependence clang::computeDependence(NoInitExpr *E) { ++ return toExprDependence(E->getType()->getDependence()) & ++ ExprDependence::Instantiation; ++} ++ ++ExprDependence clang::computeDependence(ArrayInitLoopExpr *E) { ++ auto D = E->getCommonExpr()->getDependence() | ++ E->getSubExpr()->getDependence() | ExprDependence::Instantiation; ++ if (!E->getType()->isInstantiationDependentType()) ++ D &= ~ExprDependence::Instantiation; ++ return turnTypeToValueDependence(D); ++} ++ ++ExprDependence clang::computeDependence(ImplicitValueInitExpr *E) { ++ return toExprDependence(E->getType()->getDependence()) & ++ ExprDependence::Instantiation; ++} ++ ++ExprDependence clang::computeDependence(ExtVectorElementExpr *E) { ++ return E->getBase()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(BlockExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ if (E->getBlockDecl()->isDependentContext()) ++ D |= ExprDependence::Instantiation; ++ return D & ~ExprDependence::UnexpandedPack; ++} ++ ++ExprDependence clang::computeDependence(AsTypeExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()) | ++ E->getSrcExpr()->getDependence(); ++ if (!E->getType()->isDependentType()) ++ D &= ~ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXRewrittenBinaryOperator *E) { ++ return E->getSemanticForm()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(CXXStdInitializerListExpr *E) { ++ auto D = turnTypeToValueDependence(E->getSubExpr()->getDependence()); ++ if (E->getType()->isDependentType()) ++ D |= ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXTypeidExpr *E) { ++ auto D = ExprDependence::None; ++ if (E->isTypeOperand()) ++ D = toExprDependence( ++ E->getTypeOperandSourceInfo()->getType()->getDependence()); ++ else ++ D = turnTypeToValueDependence(E->getExprOperand()->getDependence()); ++ // typeid is never type-dependent (C++ [temp.dep.expr]p4) ++ return D & ~ExprDependence::Type; ++} ++ ++ExprDependence clang::computeDependence(MSPropertyRefExpr *E) { ++ return E->getBaseExpr()->getDependence() & ~ExprDependence::Type; ++} ++ ++ExprDependence clang::computeDependence(MSPropertySubscriptExpr *E) { ++ return E->getIdx()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(CXXUuidofExpr *E) { ++ if (E->isTypeOperand()) ++ return turnTypeToValueDependence(toExprDependence( ++ E->getTypeOperandSourceInfo()->getType()->getDependence())); ++ ++ return turnTypeToValueDependence(E->getExprOperand()->getDependence()); ++} ++ ++ExprDependence clang::computeDependence(CXXThisExpr *E) { ++ // 'this' is type-dependent if the class type of the enclosing ++ // member function is dependent (C++ [temp.dep.expr]p2) ++ auto D = toExprDependence(E->getType()->getDependence()); ++ assert(!(D & ExprDependence::UnexpandedPack)); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXThrowExpr *E) { ++ auto *Op = E->getSubExpr(); ++ if (!Op) ++ return ExprDependence::None; ++ return Op->getDependence() & ~ExprDependence::TypeValue; ++} ++ ++ExprDependence clang::computeDependence(CXXBindTemporaryExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(CXXScalarValueInitExpr *E) { ++ return toExprDependence(E->getType()->getDependence()) & ++ ~ExprDependence::TypeValue; ++} ++ ++ExprDependence clang::computeDependence(CXXDeleteExpr *E) { ++ return turnTypeToValueDependence(E->getArgument()->getDependence()); ++} ++ ++ExprDependence clang::computeDependence(ArrayTypeTraitExpr *E) { ++ auto D = toExprDependence(E->getQueriedType()->getDependence()); ++ if (auto *Dim = E->getDimensionExpression()) ++ D |= Dim->getDependence(); ++ return turnTypeToValueDependence(D); ++} ++ ++ExprDependence clang::computeDependence(ExpressionTraitExpr *E) { ++ // Never type-dependent. ++ auto D = E->getQueriedExpression()->getDependence() & ~ExprDependence::Type; ++ // Value-dependent if the argument is type-dependent. ++ if (E->getQueriedExpression()->isTypeDependent()) ++ D |= ExprDependence::Value; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXNoexceptExpr *E, CanThrowResult CT) { ++ auto D = E->getOperand()->getDependence() & ~ExprDependence::TypeValue; ++ if (CT == CT_Dependent) ++ D |= ExprDependence::ValueInstantiation; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(SubstNonTypeTemplateParmExpr *E) { ++ return E->getReplacement()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(CoroutineSuspendExpr *E) { ++ if (auto *Resume = E->getResumeExpr()) ++ return (Resume->getDependence() & ExprDependence::TypeValue) | ++ (E->getCommonExpr()->getDependence() & ~ExprDependence::TypeValue); ++ return E->getCommonExpr()->getDependence() | ++ ExprDependence::TypeValueInstantiation; ++} ++ ++ExprDependence clang::computeDependence(DependentCoawaitExpr *E) { ++ return E->getOperand()->getDependence() | ++ ExprDependence::TypeValueInstantiation; ++} ++ ++ExprDependence clang::computeDependence(ObjCBoxedExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(ObjCEncodeExpr *E) { ++ return toExprDependence(E->getEncodedType()->getDependence()); ++} ++ ++ExprDependence clang::computeDependence(ObjCIvarRefExpr *E) { ++ return turnTypeToValueDependence(E->getBase()->getDependence()); ++} ++ ++ExprDependence clang::computeDependence(ObjCPropertyRefExpr *E) { ++ if (E->isObjectReceiver()) ++ return E->getBase()->getDependence() & ~ExprDependence::Type; ++ if (E->isSuperReceiver()) ++ return toExprDependence(E->getSuperReceiverType()->getDependence()) & ++ ~ExprDependence::TypeValue; ++ assert(E->isClassReceiver()); ++ return ExprDependence::None; ++} ++ ++ExprDependence clang::computeDependence(ObjCSubscriptRefExpr *E) { ++ return E->getBaseExpr()->getDependence() | E->getKeyExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(ObjCIsaExpr *E) { ++ return E->getBase()->getDependence() & ~ExprDependence::Type & ++ ~ExprDependence::UnexpandedPack; ++} ++ ++ExprDependence clang::computeDependence(ObjCIndirectCopyRestoreExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(OMPArraySectionExpr *E) { ++ auto D = E->getBase()->getDependence(); ++ if (auto *LB = E->getLowerBound()) ++ D |= LB->getDependence(); ++ if (auto *Len = E->getLength()) ++ D |= Len->getDependence(); ++ return D; ++} ++ ++/// Compute the type-, value-, and instantiation-dependence of a ++/// declaration reference ++/// based on the declaration being referenced. ++ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) { ++ auto Deps = ExprDependence::None; ++ ++ if (auto *NNS = E->getQualifier()) ++ Deps |= toExprDependence(NNS->getDependence()); ++ ++ if (auto *FirstArg = E->getTemplateArgs()) { ++ unsigned NumArgs = E->getNumTemplateArgs(); ++ for (auto *Arg = FirstArg, *End = FirstArg + NumArgs; Arg < End; ++Arg) ++ Deps |= toExprDependence(Arg->getArgument().getDependence()); ++ } ++ ++ auto *Decl = E->getDecl(); ++ auto Type = E->getType(); ++ ++ if (Decl->isParameterPack()) ++ Deps |= ExprDependence::UnexpandedPack; ++ ++ // (TD) C++ [temp.dep.expr]p3: ++ // An id-expression is type-dependent if it contains: ++ // ++ // and ++ // ++ // (VD) C++ [temp.dep.constexpr]p2: ++ // An identifier is value-dependent if it is: ++ ++ // (TD) - an identifier that was declared with dependent type ++ // (VD) - a name declared with a dependent type, ++ if (Type->isDependentType()) ++ return Deps | ExprDependence::TypeValueInstantiation; ++ else if (Type->isInstantiationDependentType()) ++ Deps |= ExprDependence::Instantiation; ++ ++ // (TD) - a conversion-function-id that specifies a dependent type ++ if (Decl->getDeclName().getNameKind() == ++ DeclarationName::CXXConversionFunctionName) { ++ QualType T = Decl->getDeclName().getCXXNameType(); ++ if (T->isDependentType()) ++ return Deps | ExprDependence::TypeValueInstantiation; ++ ++ if (T->isInstantiationDependentType()) ++ Deps |= ExprDependence::Instantiation; ++ } ++ ++ // (VD) - the name of a non-type template parameter, ++ if (isa(Decl)) ++ return Deps | ExprDependence::ValueInstantiation; ++ ++ // (VD) - a constant with integral or enumeration type and is ++ // initialized with an expression that is value-dependent. ++ // (VD) - a constant with literal type and is initialized with an ++ // expression that is value-dependent [C++11]. ++ // (VD) - FIXME: Missing from the standard: ++ // - an entity with reference type and is initialized with an ++ // expression that is value-dependent [C++11] ++ if (VarDecl *Var = dyn_cast(Decl)) { ++ if ((Ctx.getLangOpts().CPlusPlus11 ++ ? Var->getType()->isLiteralType(Ctx) ++ : Var->getType()->isIntegralOrEnumerationType()) && ++ (Var->getType().isConstQualified() || ++ Var->getType()->isReferenceType())) { ++ if (const Expr *Init = Var->getAnyInitializer()) ++ if (Init->isValueDependent()) { ++ Deps |= ExprDependence::ValueInstantiation; ++ } ++ } ++ ++ // (VD) - FIXME: Missing from the standard: ++ // - a member function or a static data member of the current ++ // instantiation ++ if (Var->isStaticDataMember() && ++ Var->getDeclContext()->isDependentContext()) { ++ Deps |= ExprDependence::ValueInstantiation; ++ TypeSourceInfo *TInfo = Var->getFirstDecl()->getTypeSourceInfo(); ++ if (TInfo->getType()->isIncompleteArrayType()) ++ Deps |= ExprDependence::Type; ++ } ++ ++ return Deps; ++ } ++ ++ // (VD) - FIXME: Missing from the standard: ++ // - a member function or a static data member of the current ++ // instantiation ++ if (isa(Decl) && Decl->getDeclContext()->isDependentContext()) ++ Deps |= ExprDependence::ValueInstantiation; ++ return Deps; ++} ++ ++ExprDependence clang::computeDependence(PredefinedExpr *E) { ++ return toExprDependence(E->getType()->getDependence()) & ++ ~ExprDependence::UnexpandedPack; ++} ++ ++ExprDependence clang::computeDependence(CallExpr *E, ++ llvm::ArrayRef PreArgs) { ++ auto D = E->getCallee()->getDependence(); ++ for (auto *A : llvm::makeArrayRef(E->getArgs(), E->getNumArgs())) { ++ if (A) ++ D |= A->getDependence(); ++ } ++ for (auto *A : PreArgs) ++ D |= A->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(OffsetOfExpr *E) { ++ auto D = turnTypeToValueDependence( ++ toExprDependence(E->getTypeSourceInfo()->getType()->getDependence())); ++ for (unsigned I = 0, N = E->getNumExpressions(); I < N; ++I) ++ D |= turnTypeToValueDependence(E->getIndexExpr(I)->getDependence()); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(MemberExpr *E) { ++ return E->getBase()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(InitListExpr *E) { ++ auto D = ExprDependence::None; ++ for (auto *A : E->inits()) ++ D |= A->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ShuffleVectorExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ for (auto *C : llvm::makeArrayRef(E->getSubExprs(), E->getNumSubExprs())) ++ D |= C->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(GenericSelectionExpr *E, ++ bool ContainsUnexpandedPack) { ++ auto D = ContainsUnexpandedPack ? ExprDependence::UnexpandedPack ++ : ExprDependence::None; ++ if (E->isResultDependent()) ++ return D | ExprDependence::TypeValueInstantiation; ++ return D | (E->getResultExpr()->getDependence() & ++ ~ExprDependence::UnexpandedPack); ++} ++ ++ExprDependence clang::computeDependence(DesignatedInitExpr *E) { ++ auto Deps = E->getInit()->getDependence(); ++ for (auto D : E->designators()) { ++ auto DesignatorDeps = ExprDependence::None; ++ if (D.isArrayDesignator()) ++ DesignatorDeps |= E->getArrayIndex(D)->getDependence(); ++ else if (D.isArrayRangeDesignator()) ++ DesignatorDeps |= E->getArrayRangeStart(D)->getDependence() | ++ E->getArrayRangeEnd(D)->getDependence(); ++ Deps |= DesignatorDeps; ++ if (DesignatorDeps & ExprDependence::TypeValue) ++ Deps |= ExprDependence::TypeValueInstantiation; ++ } ++ return Deps; ++} ++ ++ExprDependence clang::computeDependence(PseudoObjectExpr *O) { ++ auto D = O->getSyntacticForm()->getDependence(); ++ for (auto *E : O->semantics()) ++ D |= E->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(AtomicExpr *A) { ++ auto D = ExprDependence::None; ++ for (auto *E : llvm::makeArrayRef(A->getSubExprs(), A->getNumSubExprs())) ++ D |= E->getDependence(); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXNewExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ auto Size = E->getArraySize(); ++ if (Size.hasValue() && *Size) ++ D |= turnTypeToValueDependence((*Size)->getDependence()); ++ if (auto *I = E->getInitializer()) ++ D |= turnTypeToValueDependence(I->getDependence()); ++ for (auto *A : E->placement_arguments()) ++ D |= turnTypeToValueDependence(A->getDependence()); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXPseudoDestructorExpr *E) { ++ auto D = E->getBase()->getDependence(); ++ if (!E->getDestroyedType().isNull()) ++ D |= toExprDependence(E->getDestroyedType()->getDependence()); ++ if (auto *ST = E->getScopeTypeInfo()) ++ D |= turnTypeToValueDependence( ++ toExprDependence(ST->getType()->getDependence())); ++ if (auto *Q = E->getQualifier()) ++ D |= toExprDependence(Q->getDependence()); ++ return D; ++} ++ ++static inline ExprDependence getDependenceInExpr(DeclarationNameInfo Name) { ++ auto D = ExprDependence::None; ++ if (Name.isInstantiationDependent()) ++ D |= ExprDependence::Instantiation; ++ if (Name.containsUnexpandedParameterPack()) ++ D |= ExprDependence::UnexpandedPack; ++ return D; ++} ++ ++ExprDependence ++clang::computeDependence(OverloadExpr *E, bool KnownDependent, ++ bool KnownInstantiationDependent, ++ bool KnownContainsUnexpandedParameterPack) { ++ auto Deps = ExprDependence::None; ++ if (KnownDependent) ++ Deps |= ExprDependence::TypeValue; ++ if (KnownInstantiationDependent) ++ Deps |= ExprDependence::Instantiation; ++ if (KnownContainsUnexpandedParameterPack) ++ Deps |= ExprDependence::UnexpandedPack; ++ Deps |= getDependenceInExpr(E->getNameInfo()); ++ if (auto *Q = E->getQualifier()) ++ Deps |= toExprDependence(Q->getDependence()); ++ for (auto *D : E->decls()) { ++ if (D->getDeclContext()->isDependentContext() || ++ isa(D)) ++ Deps |= ExprDependence::TypeValueInstantiation; ++ } ++ // If we have explicit template arguments, check for dependent ++ // template arguments and whether they contain any unexpanded pack ++ // expansions. ++ for (auto A : E->template_arguments()) ++ Deps |= toExprDependence(A.getArgument().getDependence()); ++ return Deps; ++} ++ ++ExprDependence clang::computeDependence(DependentScopeDeclRefExpr *E) { ++ auto D = ExprDependence::TypeValue; ++ D |= getDependenceInExpr(E->getNameInfo()); ++ if (auto *Q = E->getQualifier()) ++ D |= toExprDependence(Q->getDependence()); ++ for (auto A : E->template_arguments()) ++ D |= toExprDependence(A.getArgument().getDependence()); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXConstructExpr *E) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ for (auto *E : E->arguments()) ++ D |= E->getDependence() & ~ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(LambdaExpr *E, ++ bool ContainsUnexpandedParameterPack) { ++ auto D = toExprDependence(E->getType()->getDependence()); ++ if (ContainsUnexpandedParameterPack) ++ D |= ExprDependence::UnexpandedPack; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXUnresolvedConstructExpr *E) { ++ auto D = ExprDependence::ValueInstantiation; ++ D |= toExprDependence(E->getType()->getDependence()); ++ if (E->getType()->getContainedDeducedType()) ++ D |= ExprDependence::Type; ++ for (auto *A : E->arguments()) ++ D |= A->getDependence() & ExprDependence::UnexpandedPack; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(CXXDependentScopeMemberExpr *E) { ++ auto D = ExprDependence::TypeValueInstantiation; ++ if (!E->isImplicitAccess()) ++ D |= E->getBase()->getDependence(); ++ if (auto *Q = E->getQualifier()) ++ D |= toExprDependence(Q->getDependence()); ++ D |= getDependenceInExpr(E->getMemberNameInfo()); ++ for (auto A : E->template_arguments()) ++ D |= toExprDependence(A.getArgument().getDependence()); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(MaterializeTemporaryExpr *E) { ++ return E->getSubExpr()->getDependence(); ++} ++ ++ExprDependence clang::computeDependence(TypeTraitExpr *E) { ++ auto D = ExprDependence::None; ++ for (const auto *A : E->getArgs()) ++ D |= ++ toExprDependence(A->getType()->getDependence()) & ~ExprDependence::Type; ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ConceptSpecializationExpr *E, ++ bool ValueDependent) { ++ auto TA = TemplateArgumentDependence::None; ++ const auto InterestingDeps = TemplateArgumentDependence::Instantiation | ++ TemplateArgumentDependence::UnexpandedPack; ++ for (const TemplateArgumentLoc &ArgLoc : ++ E->getTemplateArgsAsWritten()->arguments()) { ++ TA |= ArgLoc.getArgument().getDependence() & InterestingDeps; ++ if (TA == InterestingDeps) ++ break; ++ } ++ ++ ExprDependence D = ++ ValueDependent ? ExprDependence::Value : ExprDependence::None; ++ return D | toExprDependence(TA); ++} ++ ++ExprDependence clang::computeDependence(ObjCArrayLiteral *E) { ++ auto D = ExprDependence::None; ++ Expr **Elements = E->getElements(); ++ for (unsigned I = 0, N = E->getNumElements(); I != N; ++I) ++ D |= turnTypeToValueDependence(Elements[I]->getDependence()); ++ return D; ++} ++ ++ExprDependence clang::computeDependence(ObjCDictionaryLiteral *E) { ++ auto Deps = ExprDependence::None; ++ for (unsigned I = 0, N = E->getNumElements(); I < N; ++I) { ++ auto KV = E->getKeyValueElement(I); ++ auto KVDeps = turnTypeToValueDependence(KV.Key->getDependence() | ++ KV.Value->getDependence()); ++ if (KV.EllipsisLoc.isValid()) ++ KVDeps &= ~ExprDependence::UnexpandedPack; ++ Deps |= KVDeps; ++ } ++ return Deps; ++} ++ ++ExprDependence clang::computeDependence(ObjCMessageExpr *E) { ++ auto D = ExprDependence::None; ++ if (auto *R = E->getInstanceReceiver()) ++ D |= R->getDependence(); ++ else ++ D |= toExprDependence(E->getType()->getDependence()); ++ for (auto *A : E->arguments()) ++ D |= A->getDependence(); ++ return D; ++} +diff --git a/../clang-10.0.1.src/lib/AST/Expr.cpp b/../clang-10.0.1.src/lib/AST/Expr.cpp +index 4b2b9e4d5eb33..1eb56c30283c6 100644 +--- a/../clang-10.0.1.src/lib/AST/Expr.cpp ++++ b/../clang-10.0.1.src/lib/AST/Expr.cpp +@@ -14,6 +14,7 @@ + #include "clang/AST/APValue.h" + #include "clang/AST/ASTContext.h" + #include "clang/AST/Attr.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclObjC.h" + #include "clang/AST/DeclTemplate.h" +@@ -369,93 +370,12 @@ APValue ConstantExpr::getAPValueResult() const { + llvm_unreachable("invalid ResultKind"); + } + +-/// Compute the type-, value-, and instantiation-dependence of a +-/// declaration reference +-/// based on the declaration being referenced. +-static ExprDependence computeDeclRefDependence(const ASTContext &Ctx, +- NamedDecl *D, QualType T) { +- auto R = ExprDependence::None; +- if (D->isParameterPack()) +- R |= ExprDependence::UnexpandedPack; +- +- // (TD) C++ [temp.dep.expr]p3: +- // An id-expression is type-dependent if it contains: +- // +- // and +- // +- // (VD) C++ [temp.dep.constexpr]p2: +- // An identifier is value-dependent if it is: +- +- // (TD) - an identifier that was declared with dependent type +- // (VD) - a name declared with a dependent type, +- if (T->isDependentType()) +- return R | ExprDependence::TypeValueInstantiation; +- else if (T->isInstantiationDependentType()) +- R |= ExprDependence::Instantiation; +- +- // (TD) - a conversion-function-id that specifies a dependent type +- if (D->getDeclName().getNameKind() +- == DeclarationName::CXXConversionFunctionName) { +- QualType T = D->getDeclName().getCXXNameType(); +- if (T->isDependentType()) +- return R | ExprDependence::TypeValueInstantiation; +- +- if (T->isInstantiationDependentType()) +- R |= ExprDependence::Instantiation; +- } +- +- // (VD) - the name of a non-type template parameter, +- if (isa(D)) +- return R | ExprDependence::ValueInstantiation; +- +- // (VD) - a constant with integral or enumeration type and is +- // initialized with an expression that is value-dependent. +- // (VD) - a constant with literal type and is initialized with an +- // expression that is value-dependent [C++11]. +- // (VD) - FIXME: Missing from the standard: +- // - an entity with reference type and is initialized with an +- // expression that is value-dependent [C++11] +- if (VarDecl *Var = dyn_cast(D)) { +- if ((Ctx.getLangOpts().CPlusPlus11 ? +- Var->getType()->isLiteralType(Ctx) : +- Var->getType()->isIntegralOrEnumerationType()) && +- (Var->getType().isConstQualified() || +- Var->getType()->isReferenceType())) { +- if (const Expr *Init = Var->getAnyInitializer()) +- if (Init->isValueDependent()) { +- R |= ExprDependence::ValueInstantiation; +- } +- } +- +- // (VD) - FIXME: Missing from the standard: +- // - a member function or a static data member of the current +- // instantiation +- if (Var->isStaticDataMember() && +- Var->getDeclContext()->isDependentContext()) { +- R |= ExprDependence::ValueInstantiation; +- TypeSourceInfo *TInfo = Var->getFirstDecl()->getTypeSourceInfo(); +- if (TInfo->getType()->isIncompleteArrayType()) +- R |= ExprDependence::Type; +- } +- +- return R; +- } +- +- // (VD) - FIXME: Missing from the standard: +- // - a member function or a static data member of the current +- // instantiation +- if (isa(D) && D->getDeclContext()->isDependentContext()) +- R |= ExprDependence::ValueInstantiation; +- return R; +-} +- + DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, ValueDecl *D, + bool RefersToEnclosingVariableOrCapture, QualType T, + ExprValueKind VK, SourceLocation L, + const DeclarationNameLoc &LocInfo, + NonOdrUseReason NOUR) +- : Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false, false), +- D(D), DNLoc(LocInfo) { ++ : Expr(DeclRefExprClass, T, VK, OK_Ordinary), D(D), DNLoc(LocInfo) { + DeclRefExprBits.HasQualifier = false; + DeclRefExprBits.HasTemplateKWAndArgsInfo = false; + DeclRefExprBits.HasFoundDecl = false; +@@ -464,7 +384,7 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, ValueDecl *D, + RefersToEnclosingVariableOrCapture; + DeclRefExprBits.NonOdrUseReason = NOUR; + DeclRefExprBits.Loc = L; +- addDependence(computeDeclRefDependence(Ctx, getDecl(), getType())); ++ setDependence(computeDependence(this, Ctx)); + } + + DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, +@@ -474,19 +394,13 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, + const DeclarationNameInfo &NameInfo, NamedDecl *FoundD, + const TemplateArgumentListInfo *TemplateArgs, + QualType T, ExprValueKind VK, NonOdrUseReason NOUR) +- : Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false, false), +- D(D), DNLoc(NameInfo.getInfo()) { ++ : Expr(DeclRefExprClass, T, VK, OK_Ordinary), D(D), ++ DNLoc(NameInfo.getInfo()) { + DeclRefExprBits.Loc = NameInfo.getLoc(); + DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0; +- if (QualifierLoc) { ++ if (QualifierLoc) + new (getTrailingObjects()) + NestedNameSpecifierLoc(QualifierLoc); +- auto *NNS = QualifierLoc.getNestedNameSpecifier(); +- if (NNS->isInstantiationDependent()) +- addDependence(ExprDependence::Instantiation); +- if (NNS->containsUnexpandedParameterPack()) +- addDependence(ExprDependence::UnexpandedPack); +- } + DeclRefExprBits.HasFoundDecl = FoundD ? 1 : 0; + if (FoundD) + *getTrailingObjects() = FoundD; +@@ -502,13 +416,12 @@ DeclRefExpr::DeclRefExpr(const ASTContext &Ctx, + Deps); + assert(!(Deps & TemplateArgumentDependence::Dependent) && + "built a DeclRefExpr with dependent template args"); +- addDependence(toExprDependence(Deps)); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); + } + DeclRefExprBits.HadMultipleCandidates = 0; +- addDependence(computeDeclRefDependence(Ctx, getDecl(), getType())); ++ setDependence(computeDependence(this, Ctx)); + } + + DeclRefExpr *DeclRefExpr::Create(const ASTContext &Context, +@@ -580,10 +493,7 @@ SourceLocation DeclRefExpr::getEndLoc() const { + + PredefinedExpr::PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK, + StringLiteral *SL) +- : Expr(PredefinedExprClass, FNTy, VK_LValue, OK_Ordinary, +- FNTy->isDependentType(), FNTy->isDependentType(), +- FNTy->isInstantiationDependentType(), +- /*ContainsUnexpandedParameterPack=*/false) { ++ : Expr(PredefinedExprClass, FNTy, VK_LValue, OK_Ordinary) { + PredefinedExprBits.Kind = IK; + assert((getIdentKind() == IK) && + "IdentKind do not fit in PredefinedExprBitfields!"); +@@ -592,6 +502,7 @@ PredefinedExpr::PredefinedExpr(SourceLocation L, QualType FNTy, IdentKind IK, + PredefinedExprBits.Loc = L; + if (HasFunctionName) + setFunctionName(SL); ++ setDependence(computeDependence(this)); + } + + PredefinedExpr::PredefinedExpr(EmptyShell Empty, bool HasFunctionName) +@@ -888,13 +799,12 @@ void APNumericStorage::setIntValue(const ASTContext &C, + + IntegerLiteral::IntegerLiteral(const ASTContext &C, const llvm::APInt &V, + QualType type, SourceLocation l) +- : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary, false, false, +- false, false), +- Loc(l) { ++ : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary), Loc(l) { + assert(type->isIntegerType() && "Illegal type in IntegerLiteral"); + assert(V.getBitWidth() == C.getIntWidth(type) && + "Integer type is not the correct size for constant."); + setValue(C, V); ++ setDependence(ExprDependence::None); + } + + IntegerLiteral * +@@ -911,13 +821,13 @@ IntegerLiteral::Create(const ASTContext &C, EmptyShell Empty) { + FixedPointLiteral::FixedPointLiteral(const ASTContext &C, const llvm::APInt &V, + QualType type, SourceLocation l, + unsigned Scale) +- : Expr(FixedPointLiteralClass, type, VK_RValue, OK_Ordinary, false, false, +- false, false), +- Loc(l), Scale(Scale) { ++ : Expr(FixedPointLiteralClass, type, VK_RValue, OK_Ordinary), Loc(l), ++ Scale(Scale) { + assert(type->isFixedPointType() && "Illegal type in FixedPointLiteral"); + assert(V.getBitWidth() == C.getTypeInfo(type).Width && + "Fixed point type is not the correct size for constant."); + setValue(C, V); ++ setDependence(ExprDependence::None); + } + + FixedPointLiteral *FixedPointLiteral::CreateFromRawInt(const ASTContext &C, +@@ -940,11 +850,11 @@ std::string FixedPointLiteral::getValueAsString(unsigned Radix) const { + + FloatingLiteral::FloatingLiteral(const ASTContext &C, const llvm::APFloat &V, + bool isexact, QualType Type, SourceLocation L) +- : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary, false, false, +- false, false), Loc(L) { ++ : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary), Loc(L) { + setSemantics(V.getSemantics()); + FloatingLiteralBits.IsExact = isexact; + setValue(C, V); ++ setDependence(ExprDependence::None); + } + + FloatingLiteral::FloatingLiteral(const ASTContext &C, EmptyShell Empty) +@@ -1004,8 +914,7 @@ StringLiteral::StringLiteral(const ASTContext &Ctx, StringRef Str, + StringKind Kind, bool Pascal, QualType Ty, + const SourceLocation *Loc, + unsigned NumConcatenated) +- : Expr(StringLiteralClass, Ty, VK_LValue, OK_Ordinary, false, false, false, +- false) { ++ : Expr(StringLiteralClass, Ty, VK_LValue, OK_Ordinary) { + assert(Ctx.getAsConstantArrayType(Ty) && + "StringLiteral must be of constant array type!"); + unsigned CharByteWidth = mapCharByteWidth(Ctx.getTargetInfo(), Kind); +@@ -1044,6 +953,8 @@ StringLiteral::StringLiteral(const ASTContext &Ctx, StringRef Str, + + // Initialize the trailing array of char holding the string data. + std::memcpy(getTrailingObjects(), Str.data(), ByteLength); ++ ++ setDependence(ExprDependence::None); + } + + StringLiteral::StringLiteral(EmptyShell Empty, unsigned NumConcatenated, +@@ -1312,10 +1223,7 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef PreArgs, + ArrayRef Args, QualType Ty, ExprValueKind VK, + SourceLocation RParenLoc, unsigned MinNumArgs, + ADLCallKind UsesADL) +- : Expr(SC, Ty, VK, OK_Ordinary, Fn->isTypeDependent(), +- Fn->isValueDependent(), Fn->isInstantiationDependent(), +- Fn->containsUnexpandedParameterPack()), +- RParenLoc(RParenLoc) { ++ : Expr(SC, Ty, VK, OK_Ordinary), RParenLoc(RParenLoc) { + NumArgs = std::max(Args.size(), MinNumArgs); + unsigned NumPreArgs = PreArgs.size(); + CallExprBits.NumPreArgs = NumPreArgs; +@@ -1329,17 +1237,14 @@ CallExpr::CallExpr(StmtClass SC, Expr *Fn, ArrayRef PreArgs, + CallExprBits.UsesADL = static_cast(UsesADL); + + setCallee(Fn); +- for (unsigned I = 0; I != NumPreArgs; ++I) { +- addDependence(PreArgs[I]->getDependence()); ++ for (unsigned I = 0; I != NumPreArgs; ++I) + setPreArg(I, PreArgs[I]); +- } +- for (unsigned I = 0; I != Args.size(); ++I) { +- addDependence(Args[I]->getDependence()); ++ for (unsigned I = 0; I != Args.size(); ++I) + setArg(I, Args[I]); +- } +- for (unsigned I = Args.size(); I != NumArgs; ++I) { ++ for (unsigned I = Args.size(); I != NumArgs; ++I) + setArg(I, nullptr); +- } ++ ++ setDependence(computeDependence(this, PreArgs)); + } + + CallExpr::CallExpr(StmtClass SC, unsigned NumPreArgs, unsigned NumArgs, +@@ -1523,28 +1428,17 @@ OffsetOfExpr *OffsetOfExpr::CreateEmpty(const ASTContext &C, + + OffsetOfExpr::OffsetOfExpr(const ASTContext &C, QualType type, + SourceLocation OperatorLoc, TypeSourceInfo *tsi, +- ArrayRef comps, ArrayRef exprs, ++ ArrayRef comps, ArrayRef exprs, + SourceLocation RParenLoc) +- : Expr(OffsetOfExprClass, type, VK_RValue, OK_Ordinary, +- /*TypeDependent=*/false, +- /*ValueDependent=*/tsi->getType()->isDependentType(), +- tsi->getType()->isInstantiationDependentType(), +- tsi->getType()->containsUnexpandedParameterPack()), +- OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi), +- NumComps(comps.size()), NumExprs(exprs.size()) +-{ +- for (unsigned i = 0; i != comps.size(); ++i) { ++ : Expr(OffsetOfExprClass, type, VK_RValue, OK_Ordinary), ++ OperatorLoc(OperatorLoc), RParenLoc(RParenLoc), TSInfo(tsi), ++ NumComps(comps.size()), NumExprs(exprs.size()) { ++ for (unsigned i = 0; i != comps.size(); ++i) + setComponent(i, comps[i]); +- } +- +- for (unsigned i = 0; i != exprs.size(); ++i) { +- if (exprs[i]->isTypeDependent() || exprs[i]->isValueDependent()) +- addDependence(ExprDependence::Value); +- if (exprs[i]->containsUnexpandedParameterPack()) +- addDependence(ExprDependence ::UnexpandedPack); +- ++ for (unsigned i = 0; i != exprs.size(); ++i) + setIndexExpr(i, exprs[i]); +- } ++ ++ setDependence(computeDependence(this)); + } + + IdentifierInfo *OffsetOfNode::getFieldName() const { +@@ -1558,38 +1452,12 @@ IdentifierInfo *OffsetOfNode::getFieldName() const { + UnaryExprOrTypeTraitExpr::UnaryExprOrTypeTraitExpr( + UnaryExprOrTypeTrait ExprKind, Expr *E, QualType resultType, + SourceLocation op, SourceLocation rp) +- : Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary, +- false, // Never type-dependent (C++ [temp.dep.expr]p3). +- // Value-dependent if the argument is type-dependent. +- E->isTypeDependent(), E->isInstantiationDependent(), +- E->containsUnexpandedParameterPack()), ++ : Expr(UnaryExprOrTypeTraitExprClass, resultType, VK_RValue, OK_Ordinary), + OpLoc(op), RParenLoc(rp) { + UnaryExprOrTypeTraitExprBits.Kind = ExprKind; + UnaryExprOrTypeTraitExprBits.IsType = false; + Argument.Ex = E; +- +- // Check to see if we are in the situation where alignof(decl) should be +- // dependent because decl's alignment is dependent. +- if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) { +- if (!isValueDependent() || !isInstantiationDependent()) { +- E = E->IgnoreParens(); +- +- const ValueDecl *D = nullptr; +- if (const auto *DRE = dyn_cast(E)) +- D = DRE->getDecl(); +- else if (const auto *ME = dyn_cast(E)) +- D = ME->getMemberDecl(); +- +- if (D) { +- for (const auto *I : D->specific_attrs()) { +- if (I->isAlignmentDependent()) { +- addDependence(ExprDependence::ValueInstantiation); +- break; +- } +- } +- } +- } +- } ++ setDependence(computeDependence(this)); + } + + MemberExpr::MemberExpr(Expr *Base, bool IsArrow, SourceLocation OperatorLoc, +@@ -1597,11 +1465,8 @@ MemberExpr::MemberExpr(Expr *Base, bool IsArrow, SourceLocation OperatorLoc, + const DeclarationNameInfo &NameInfo, QualType T, + ExprValueKind VK, ExprObjectKind OK, + NonOdrUseReason NOUR) +- : Expr(MemberExprClass, T, VK, OK, Base->isTypeDependent(), +- Base->isValueDependent(), Base->isInstantiationDependent(), +- Base->containsUnexpandedParameterPack()), +- Base(Base), MemberDecl(MemberDecl), MemberDNLoc(NameInfo.getInfo()), +- MemberLoc(NameInfo.getLoc()) { ++ : Expr(MemberExprClass, T, VK, OK), Base(Base), MemberDecl(MemberDecl), ++ MemberDNLoc(NameInfo.getInfo()), MemberLoc(NameInfo.getLoc()) { + assert(!NameInfo.getName() || + MemberDecl->getDeclName() == NameInfo.getName()); + MemberExprBits.IsArrow = IsArrow; +@@ -1610,6 +1475,7 @@ MemberExpr::MemberExpr(Expr *Base, bool IsArrow, SourceLocation OperatorLoc, + MemberExprBits.HadMultipleCandidates = false; + MemberExprBits.NonOdrUseReason = NOUR; + MemberExprBits.OperatorLoc = OperatorLoc; ++ setDependence(computeDependence(this)); + } + + MemberExpr *MemberExpr::Create( +@@ -2116,9 +1982,10 @@ SourceLocExpr::SourceLocExpr(const ASTContext &Ctx, IdentKind Kind, + SourceLocation BLoc, SourceLocation RParenLoc, + DeclContext *ParentContext) + : Expr(SourceLocExprClass, getDecayedSourceLocExprType(Ctx, Kind), +- VK_RValue, OK_Ordinary, false, false, false, false), ++ VK_RValue, OK_Ordinary), + BuiltinLoc(BLoc), RParenLoc(RParenLoc), ParentContext(ParentContext) { + SourceLocExprBits.Kind = Kind; ++ setDependence(ExprDependence::None); + } + + StringRef SourceLocExpr::getBuiltinStr() const { +@@ -2182,17 +2049,14 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx, + } + + InitListExpr::InitListExpr(const ASTContext &C, SourceLocation lbraceloc, +- ArrayRef initExprs, SourceLocation rbraceloc) +- : Expr(InitListExprClass, QualType(), VK_RValue, OK_Ordinary, false, false, +- false, false), +- InitExprs(C, initExprs.size()), +- LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), AltForm(nullptr, true) +-{ ++ ArrayRef initExprs, SourceLocation rbraceloc) ++ : Expr(InitListExprClass, QualType(), VK_RValue, OK_Ordinary), ++ InitExprs(C, initExprs.size()), LBraceLoc(lbraceloc), ++ RBraceLoc(rbraceloc), AltForm(nullptr, true) { + sawArrayRangeDesignator(false); +- for (unsigned I = 0; I != initExprs.size(); ++I) +- addDependence(initExprs[I]->getDependence()); +- + InitExprs.insert(C, InitExprs.end(), initExprs.begin(), initExprs.end()); ++ ++ setDependence(computeDependence(this)); + } + + void InitListExpr::reserveInits(const ASTContext &C, unsigned NumInits) { +@@ -4101,20 +3965,16 @@ void ExtVectorElementExpr::getEncodedElementAccess( + } + } + +-ShuffleVectorExpr::ShuffleVectorExpr(const ASTContext &C, ArrayRef args, ++ShuffleVectorExpr::ShuffleVectorExpr(const ASTContext &C, ArrayRef args, + QualType Type, SourceLocation BLoc, + SourceLocation RP) +- : Expr(ShuffleVectorExprClass, Type, VK_RValue, OK_Ordinary, +- Type->isDependentType(), Type->isDependentType(), +- Type->isInstantiationDependentType(), +- Type->containsUnexpandedParameterPack()), +- BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(args.size()) +-{ ++ : Expr(ShuffleVectorExprClass, Type, VK_RValue, OK_Ordinary), ++ BuiltinLoc(BLoc), RParenLoc(RP), NumExprs(args.size()) { + SubExprs = new (C) Stmt*[args.size()]; +- for (unsigned i = 0; i != args.size(); i++) { +- addDependence(args[i]->getDependence()); ++ for (unsigned i = 0; i != args.size(); i++) + SubExprs[i] = args[i]; +- } ++ ++ setDependence(computeDependence(this)); + } + + void ShuffleVectorExpr::setExprs(const ASTContext &C, ArrayRef Exprs) { +@@ -4132,11 +3992,7 @@ GenericSelectionExpr::GenericSelectionExpr( + bool ContainsUnexpandedParameterPack, unsigned ResultIndex) + : Expr(GenericSelectionExprClass, AssocExprs[ResultIndex]->getType(), + AssocExprs[ResultIndex]->getValueKind(), +- AssocExprs[ResultIndex]->getObjectKind(), +- AssocExprs[ResultIndex]->isTypeDependent(), +- AssocExprs[ResultIndex]->isValueDependent(), +- AssocExprs[ResultIndex]->isInstantiationDependent(), +- ContainsUnexpandedParameterPack), ++ AssocExprs[ResultIndex]->getObjectKind()), + NumAssocs(AssocExprs.size()), ResultIndex(ResultIndex), + DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) { + assert(AssocTypes.size() == AssocExprs.size() && +@@ -4150,6 +4006,8 @@ GenericSelectionExpr::GenericSelectionExpr( + getTrailingObjects() + AssocExprStartIndex); + std::copy(AssocTypes.begin(), AssocTypes.end(), + getTrailingObjects()); ++ ++ setDependence(computeDependence(this, ContainsUnexpandedParameterPack)); + } + + GenericSelectionExpr::GenericSelectionExpr( +@@ -4158,10 +4016,7 @@ GenericSelectionExpr::GenericSelectionExpr( + SourceLocation DefaultLoc, SourceLocation RParenLoc, + bool ContainsUnexpandedParameterPack) + : Expr(GenericSelectionExprClass, Context.DependentTy, VK_RValue, +- OK_Ordinary, +- /*isTypeDependent=*/true, +- /*isValueDependent=*/true, +- /*isInstantiationDependent=*/true, ContainsUnexpandedParameterPack), ++ OK_Ordinary), + NumAssocs(AssocExprs.size()), ResultIndex(ResultDependentIndex), + DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) { + assert(AssocTypes.size() == AssocExprs.size() && +@@ -4174,6 +4029,8 @@ GenericSelectionExpr::GenericSelectionExpr( + getTrailingObjects() + AssocExprStartIndex); + std::copy(AssocTypes.begin(), AssocTypes.end(), + getTrailingObjects()); ++ ++ setDependence(computeDependence(this, ContainsUnexpandedParameterPack)); + } + + GenericSelectionExpr::GenericSelectionExpr(EmptyShell Empty, unsigned NumAssocs) +@@ -4232,15 +4089,11 @@ DesignatedInitExpr::DesignatedInitExpr(const ASTContext &C, QualType Ty, + llvm::ArrayRef Designators, + SourceLocation EqualOrColonLoc, + bool GNUSyntax, +- ArrayRef IndexExprs, +- Expr *Init) +- : Expr(DesignatedInitExprClass, Ty, +- Init->getValueKind(), Init->getObjectKind(), +- Init->isTypeDependent(), Init->isValueDependent(), +- Init->isInstantiationDependent(), +- Init->containsUnexpandedParameterPack()), +- EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax), +- NumDesignators(Designators.size()), NumSubExprs(IndexExprs.size() + 1) { ++ ArrayRef IndexExprs, Expr *Init) ++ : Expr(DesignatedInitExprClass, Ty, Init->getValueKind(), ++ Init->getObjectKind()), ++ EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax), ++ NumDesignators(Designators.size()), NumSubExprs(IndexExprs.size() + 1) { + this->Designators = new (C) Designator[NumDesignators]; + + // Record the initializer itself. +@@ -4252,29 +4105,10 @@ DesignatedInitExpr::DesignatedInitExpr(const ASTContext &C, QualType Ty, + unsigned IndexIdx = 0; + for (unsigned I = 0; I != NumDesignators; ++I) { + this->Designators[I] = Designators[I]; +- + if (this->Designators[I].isArrayDesignator()) { +- // Compute type- and value-dependence. +- Expr *Index = IndexExprs[IndexIdx]; +- +- // Propagate dependence flags. +- auto Deps = Index->getDependence(); +- if (Deps & (ExprDependence::Type | ExprDependence::Value)) +- Deps |= ExprDependence::Type | ExprDependence::Value; +- addDependence(Deps); +- + // Copy the index expressions into permanent storage. + *Child++ = IndexExprs[IndexIdx++]; + } else if (this->Designators[I].isArrayRangeDesignator()) { +- // Compute type- and value-dependence. +- Expr *Start = IndexExprs[IndexIdx]; +- Expr *End = IndexExprs[IndexIdx + 1]; +- +- auto Deps = Start->getDependence() | End->getDependence(); +- if (Deps & (ExprDependence::Type | ExprDependence::Value)) +- Deps |= ExprDependence::TypeValueInstantiation; +- addDependence(Deps); +- + // Copy the start/end expressions into permanent storage. + *Child++ = IndexExprs[IndexIdx++]; + *Child++ = IndexExprs[IndexIdx++]; +@@ -4282,6 +4116,7 @@ DesignatedInitExpr::DesignatedInitExpr(const ASTContext &C, QualType Ty, + } + + assert(IndexIdx == IndexExprs.size() && "Wrong number of index expressions"); ++ setDependence(computeDependence(this)); + } + + DesignatedInitExpr * +@@ -4385,14 +4220,18 @@ void DesignatedInitExpr::ExpandDesignator(const ASTContext &C, unsigned Idx, + } + + DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C, +- SourceLocation lBraceLoc, Expr *baseExpr, SourceLocation rBraceLoc) +- : Expr(DesignatedInitUpdateExprClass, baseExpr->getType(), VK_RValue, +- OK_Ordinary, false, false, false, false) { ++ SourceLocation lBraceLoc, ++ Expr *baseExpr, ++ SourceLocation rBraceLoc) ++ : Expr(DesignatedInitUpdateExprClass, baseExpr->getType(), VK_RValue, ++ OK_Ordinary) { + BaseAndUpdaterExprs[0] = baseExpr; + + InitListExpr *ILE = new (C) InitListExpr(C, lBraceLoc, None, rBraceLoc); + ILE->setType(baseExpr->getType()); + BaseAndUpdaterExprs[1] = ILE; ++ ++ setDependence(ExprDependence::None); + } + + SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const { +@@ -4405,15 +4244,13 @@ SourceLocation DesignatedInitUpdateExpr::getEndLoc() const { + + ParenListExpr::ParenListExpr(SourceLocation LParenLoc, ArrayRef Exprs, + SourceLocation RParenLoc) +- : Expr(ParenListExprClass, QualType(), VK_RValue, OK_Ordinary, false, false, +- false, false), ++ : Expr(ParenListExprClass, QualType(), VK_RValue, OK_Ordinary), + LParenLoc(LParenLoc), RParenLoc(RParenLoc) { + ParenListExprBits.NumExprs = Exprs.size(); + +- for (unsigned I = 0, N = Exprs.size(); I != N; ++I) { +- addDependence(Exprs[I]->getDependence()); ++ for (unsigned I = 0, N = Exprs.size(); I != N; ++I) + getTrailingObjects()[I] = Exprs[I]; +- } ++ setDependence(computeDependence(this)); + } + + ParenListExpr::ParenListExpr(EmptyShell Empty, unsigned NumExprs) +@@ -4487,10 +4324,9 @@ PseudoObjectExpr *PseudoObjectExpr::Create(const ASTContext &C, Expr *syntax, + } + + PseudoObjectExpr::PseudoObjectExpr(QualType type, ExprValueKind VK, +- Expr *syntax, ArrayRef semantics, ++ Expr *syntax, ArrayRef semantics, + unsigned resultIndex) +- : Expr(PseudoObjectExprClass, type, VK, OK_Ordinary, +- /*filled in at end of ctor*/ false, false, false, false) { ++ : Expr(PseudoObjectExprClass, type, VK, OK_Ordinary) { + PseudoObjectExprBits.NumSubExprs = semantics.size() + 1; + PseudoObjectExprBits.ResultIndex = resultIndex + 1; + +@@ -4498,13 +4334,13 @@ PseudoObjectExpr::PseudoObjectExpr(QualType type, ExprValueKind VK, + Expr *E = (i == 0 ? syntax : semantics[i-1]); + getSubExprsBuffer()[i] = E; + +- addDependence(E->getDependence()); +- + if (isa(E)) + assert(cast(E)->getSourceExpr() != nullptr && + "opaque-value semantic expressions for pseudo-object " + "operations must have sources"); + } ++ ++ setDependence(computeDependence(this)); + } + + //===----------------------------------------------------------------------===// +@@ -4531,17 +4367,14 @@ Stmt::const_child_range UnaryExprOrTypeTraitExpr::children() const { + return const_child_range(&Argument.Ex, &Argument.Ex + 1); + } + +-AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef args, +- QualType t, AtomicOp op, SourceLocation RP) +- : Expr(AtomicExprClass, t, VK_RValue, OK_Ordinary, +- false, false, false, false), +- NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op) +-{ ++AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef args, QualType t, ++ AtomicOp op, SourceLocation RP) ++ : Expr(AtomicExprClass, t, VK_RValue, OK_Ordinary), ++ NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op) { + assert(args.size() == getNumSubExprs(op) && "wrong number of subexpressions"); +- for (unsigned i = 0; i != args.size(); i++) { +- addDependence(args[i]->getDependence()); ++ for (unsigned i = 0; i != args.size(); i++) + SubExprs[i] = args[i]; +- } ++ setDependence(computeDependence(this)); + } + + unsigned AtomicExpr::getNumSubExprs(AtomicOp Op) { +diff --git a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +index b507afd6551d5..cc53b663cf4e1 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +@@ -13,6 +13,7 @@ + #include "clang/AST/ExprCXX.h" + #include "clang/AST/ASTContext.h" + #include "clang/AST/Attr.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclAccessPair.h" + #include "clang/AST/DeclBase.h" +@@ -174,9 +175,7 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, + Expr *Initializer, QualType Ty, + TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, + SourceRange DirectInitRange) +- : Expr(CXXNewExprClass, Ty, VK_RValue, OK_Ordinary, Ty->isDependentType(), +- Ty->isDependentType(), Ty->isInstantiationDependentType(), +- Ty->containsUnexpandedParameterPack()), ++ : Expr(CXXNewExprClass, Ty, VK_RValue, OK_Ordinary), + OperatorNew(OperatorNew), OperatorDelete(OperatorDelete), + AllocatedTypeInfo(AllocatedTypeInfo), Range(Range), + DirectInitRange(DirectInitRange) { +@@ -194,26 +193,13 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, + CXXNewExprBits.IsParenTypeId = IsParenTypeId; + CXXNewExprBits.NumPlacementArgs = PlacementArgs.size(); + +- if (ArraySize) { +- if (Expr *SizeExpr = *ArraySize) +- addDependence(SizeExpr->getDependence() & ~ExprDependence::Type); +- ++ if (ArraySize) + getTrailingObjects()[arraySizeOffset()] = *ArraySize; +- } +- +- if (Initializer) { +- addDependence(Initializer->getDependence() & ~ExprDependence::Type); +- ++ if (Initializer) + getTrailingObjects()[initExprOffset()] = Initializer; +- } +- +- for (unsigned I = 0; I != PlacementArgs.size(); ++I) { +- addDependence(PlacementArgs[I]->getDependence() & ~ExprDependence::Type); +- ++ for (unsigned I = 0; I != PlacementArgs.size(); ++I) + getTrailingObjects()[placementNewArgsOffset() + I] = + PlacementArgs[I]; +- } +- + if (IsParenTypeId) + getTrailingObjects()[0] = TypeIdParens; + +@@ -229,6 +215,8 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, + this->Range.setEnd(TypeIdParens.getEnd()); + break; + } ++ ++ setDependence(computeDependence(this)); + } + + CXXNewExpr::CXXNewExpr(EmptyShell Empty, bool IsArray, +@@ -316,40 +304,19 @@ PseudoDestructorTypeStorage::PseudoDestructorTypeStorage(TypeSourceInfo *Info) + Location = Info->getTypeLoc().getLocalSourceRange().getBegin(); + } + +-CXXPseudoDestructorExpr::CXXPseudoDestructorExpr(const ASTContext &Context, +- Expr *Base, bool isArrow, SourceLocation OperatorLoc, +- NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, +- SourceLocation ColonColonLoc, SourceLocation TildeLoc, +- PseudoDestructorTypeStorage DestroyedType) +- : Expr(CXXPseudoDestructorExprClass, +- Context.BoundMemberTy, +- VK_RValue, OK_Ordinary, +- /*isTypeDependent=*/(Base->isTypeDependent() || +- (DestroyedType.getTypeSourceInfo() && +- DestroyedType.getTypeSourceInfo()->getType()->isDependentType())), +- /*isValueDependent=*/Base->isValueDependent(), +- (Base->isInstantiationDependent() || +- (QualifierLoc && +- QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent()) || +- (ScopeType && +- ScopeType->getType()->isInstantiationDependentType()) || +- (DestroyedType.getTypeSourceInfo() && +- DestroyedType.getTypeSourceInfo()->getType() +- ->isInstantiationDependentType())), +- // ContainsUnexpandedParameterPack +- (Base->containsUnexpandedParameterPack() || +- (QualifierLoc && +- QualifierLoc.getNestedNameSpecifier() +- ->containsUnexpandedParameterPack()) || +- (ScopeType && +- ScopeType->getType()->containsUnexpandedParameterPack()) || +- (DestroyedType.getTypeSourceInfo() && +- DestroyedType.getTypeSourceInfo()->getType() +- ->containsUnexpandedParameterPack()))), +- Base(static_cast(Base)), IsArrow(isArrow), +- OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc), +- ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc), +- DestroyedType(DestroyedType) {} ++CXXPseudoDestructorExpr::CXXPseudoDestructorExpr( ++ const ASTContext &Context, Expr *Base, bool isArrow, ++ SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, ++ TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, ++ SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType) ++ : Expr(CXXPseudoDestructorExprClass, Context.BoundMemberTy, VK_RValue, ++ OK_Ordinary), ++ Base(static_cast(Base)), IsArrow(isArrow), ++ OperatorLoc(OperatorLoc), QualifierLoc(QualifierLoc), ++ ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc), ++ DestroyedType(DestroyedType) { ++ setDependence(computeDependence(this)); ++} + + QualType CXXPseudoDestructorExpr::getDestroyedType() const { + if (TypeSourceInfo *TInfo = DestroyedType.getTypeSourceInfo()) +@@ -439,49 +406,31 @@ OverloadExpr::OverloadExpr(StmtClass SC, const ASTContext &Context, + UnresolvedSetIterator End, bool KnownDependent, + bool KnownInstantiationDependent, + bool KnownContainsUnexpandedParameterPack) +- : Expr( +- SC, Context.OverloadTy, VK_LValue, OK_Ordinary, KnownDependent, +- KnownDependent, +- (KnownInstantiationDependent || NameInfo.isInstantiationDependent() || +- (QualifierLoc && +- QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent())), +- (KnownContainsUnexpandedParameterPack || +- NameInfo.containsUnexpandedParameterPack() || +- (QualifierLoc && QualifierLoc.getNestedNameSpecifier() +- ->containsUnexpandedParameterPack()))), +- NameInfo(NameInfo), QualifierLoc(QualifierLoc) { ++ : Expr(SC, Context.OverloadTy, VK_LValue, OK_Ordinary), NameInfo(NameInfo), ++ QualifierLoc(QualifierLoc) { + unsigned NumResults = End - Begin; + OverloadExprBits.NumResults = NumResults; + OverloadExprBits.HasTemplateKWAndArgsInfo = + (TemplateArgs != nullptr ) || TemplateKWLoc.isValid(); + + if (NumResults) { +- // Determine whether this expression is type-dependent. +- for (UnresolvedSetImpl::const_iterator I = Begin; I != End; ++I) { +- if ((*I)->getDeclContext()->isDependentContext() || +- isa(*I)) +- addDependence(ExprDependence::TypeValueInstantiation); +- } +- + // Copy the results to the trailing array past UnresolvedLookupExpr + // or UnresolvedMemberExpr. + DeclAccessPair *Results = getTrailingResults(); + memcpy(Results, Begin.I, NumResults * sizeof(DeclAccessPair)); + } + +- // If we have explicit template arguments, check for dependent +- // template arguments and whether they contain any unexpanded pack +- // expansions. + if (TemplateArgs) { + auto Deps = TemplateArgumentDependence::None; + getTrailingASTTemplateKWAndArgsInfo()->initializeFrom( + TemplateKWLoc, *TemplateArgs, getTrailingTemplateArgumentLoc(), Deps); +- addDependence(toExprDependence(Deps)); +- + } else if (TemplateKWLoc.isValid()) { + getTrailingASTTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc); + } + ++ setDependence(computeDependence(this, KnownDependent, ++ KnownInstantiationDependent, ++ KnownContainsUnexpandedParameterPack)); + if (isTypeDependent()) + setType(Context.DependentTy); + } +@@ -498,15 +447,7 @@ DependentScopeDeclRefExpr::DependentScopeDeclRefExpr( + QualType Ty, NestedNameSpecifierLoc QualifierLoc, + SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, + const TemplateArgumentListInfo *Args) +- : Expr( +- DependentScopeDeclRefExprClass, Ty, VK_LValue, OK_Ordinary, true, +- true, +- (NameInfo.isInstantiationDependent() || +- (QualifierLoc && +- QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent())), +- (NameInfo.containsUnexpandedParameterPack() || +- (QualifierLoc && QualifierLoc.getNestedNameSpecifier() +- ->containsUnexpandedParameterPack()))), ++ : Expr(DependentScopeDeclRefExprClass, Ty, VK_LValue, OK_Ordinary), + QualifierLoc(QualifierLoc), NameInfo(NameInfo) { + DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo = + (Args != nullptr) || TemplateKWLoc.isValid(); +@@ -514,12 +455,11 @@ DependentScopeDeclRefExpr::DependentScopeDeclRefExpr( + auto Deps = TemplateArgumentDependence::None; + getTrailingObjects()->initializeFrom( + TemplateKWLoc, *Args, getTrailingObjects(), Deps); +- if (Deps & TemplateArgumentDependence::UnexpandedPack) +- addDependence(ExprDependence::UnexpandedPack); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); + } ++ setDependence(computeDependence(this)); + } + + DependentScopeDeclRefExpr *DependentScopeDeclRefExpr::Create( +@@ -959,17 +899,19 @@ const IdentifierInfo *UserDefinedLiteral::getUDSuffix() const { + return cast(getCalleeDecl())->getLiteralIdentifier(); + } + +-CXXDefaultInitExpr::CXXDefaultInitExpr(const ASTContext &Ctx, SourceLocation Loc, +- FieldDecl *Field, QualType Ty, +- DeclContext *UsedContext) ++CXXDefaultInitExpr::CXXDefaultInitExpr(const ASTContext &Ctx, ++ SourceLocation Loc, FieldDecl *Field, ++ QualType Ty, DeclContext *UsedContext) + : Expr(CXXDefaultInitExprClass, Ty.getNonLValueExprType(Ctx), +- Ty->isLValueReferenceType() ? VK_LValue : Ty->isRValueReferenceType() +- ? VK_XValue +- : VK_RValue, +- /*FIXME*/ OK_Ordinary, false, false, false, false), ++ Ty->isLValueReferenceType() ++ ? VK_LValue ++ : Ty->isRValueReferenceType() ? VK_XValue : VK_RValue, ++ /*FIXME*/ OK_Ordinary), + Field(Field), UsedContext(UsedContext) { + CXXDefaultInitExprBits.Loc = Loc; + assert(Field->hasInClassInitializer()); ++ ++ setDependence(ExprDependence::None); + } + + CXXTemporary *CXXTemporary::Create(const ASTContext &C, +@@ -1067,11 +1009,8 @@ CXXConstructExpr::CXXConstructExpr( + bool ListInitialization, bool StdInitListInitialization, + bool ZeroInitialization, ConstructionKind ConstructKind, + SourceRange ParenOrBraceRange) +- : Expr(SC, Ty, VK_RValue, OK_Ordinary, Ty->isDependentType(), +- Ty->isDependentType(), Ty->isInstantiationDependentType(), +- Ty->containsUnexpandedParameterPack()), +- Constructor(Ctor), ParenOrBraceRange(ParenOrBraceRange), +- NumArgs(Args.size()) { ++ : Expr(SC, Ty, VK_RValue, OK_Ordinary), Constructor(Ctor), ++ ParenOrBraceRange(ParenOrBraceRange), NumArgs(Args.size()) { + CXXConstructExprBits.Elidable = Elidable; + CXXConstructExprBits.HadMultipleCandidates = HadMultipleCandidates; + CXXConstructExprBits.ListInitialization = ListInitialization; +@@ -1083,10 +1022,10 @@ CXXConstructExpr::CXXConstructExpr( + Stmt **TrailingArgs = getTrailingArgs(); + for (unsigned I = 0, N = Args.size(); I != N; ++I) { + assert(Args[I] && "NULL argument in CXXConstructExpr!"); +- addDependence(Args[I]->getDependence() & ~ExprDependence::Type); +- + TrailingArgs[I] = Args[I]; + } ++ ++ setDependence(computeDependence(this)); + } + + CXXConstructExpr::CXXConstructExpr(StmtClass SC, EmptyShell Empty, +@@ -1139,9 +1078,7 @@ LambdaExpr::LambdaExpr(QualType T, SourceRange IntroducerRange, + bool ExplicitResultType, ArrayRef CaptureInits, + SourceLocation ClosingBrace, + bool ContainsUnexpandedParameterPack) +- : Expr(LambdaExprClass, T, VK_RValue, OK_Ordinary, T->isDependentType(), +- T->isDependentType(), T->isDependentType(), +- ContainsUnexpandedParameterPack), ++ : Expr(LambdaExprClass, T, VK_RValue, OK_Ordinary), + IntroducerRange(IntroducerRange), CaptureDefaultLoc(CaptureDefaultLoc), + NumCaptures(Captures.size()), CaptureDefault(CaptureDefault), + ExplicitParams(ExplicitParams), ExplicitResultType(ExplicitResultType), +@@ -1173,6 +1110,8 @@ LambdaExpr::LambdaExpr(QualType T, SourceRange IntroducerRange, + + // Copy the body of the lambda. + *Stored++ = getCallOperator()->getBody(); ++ ++ setDependence(computeDependence(this, ContainsUnexpandedParameterPack)); + } + + LambdaExpr *LambdaExpr::Create( +@@ -1324,19 +1263,13 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(TypeSourceInfo *TSI, + ? VK_LValue + : TSI->getType()->isRValueReferenceType() ? VK_XValue + : VK_RValue), +- OK_Ordinary, +- TSI->getType()->isDependentType() || +- TSI->getType()->getContainedDeducedType(), +- true, true, TSI->getType()->containsUnexpandedParameterPack()), ++ OK_Ordinary), + TSI(TSI), LParenLoc(LParenLoc), RParenLoc(RParenLoc) { + CXXUnresolvedConstructExprBits.NumArgs = Args.size(); + auto **StoredArgs = getTrailingObjects(); +- for (unsigned I = 0; I != Args.size(); ++I) { +- if (Args[I]->containsUnexpandedParameterPack()) +- addDependence(ExprDependence::UnexpandedPack); +- ++ for (unsigned I = 0; I != Args.size(); ++I) + StoredArgs[I] = Args[I]; +- } ++ setDependence(computeDependence(this)); + } + + CXXUnresolvedConstructExpr *CXXUnresolvedConstructExpr::Create( +@@ -1364,11 +1297,7 @@ CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( + DeclarationNameInfo MemberNameInfo, + const TemplateArgumentListInfo *TemplateArgs) + : Expr(CXXDependentScopeMemberExprClass, Ctx.DependentTy, VK_LValue, +- OK_Ordinary, true, true, true, +- ((Base && Base->containsUnexpandedParameterPack()) || +- (QualifierLoc && QualifierLoc.getNestedNameSpecifier() +- ->containsUnexpandedParameterPack()) || +- MemberNameInfo.containsUnexpandedParameterPack())), ++ OK_Ordinary), + Base(Base), BaseType(BaseType), QualifierLoc(QualifierLoc), + MemberNameInfo(MemberNameInfo) { + CXXDependentScopeMemberExprBits.IsArrow = IsArrow; +@@ -1383,8 +1312,6 @@ CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( + getTrailingObjects()->initializeFrom( + TemplateKWLoc, *TemplateArgs, getTrailingObjects(), + Deps); +- if (Deps & TemplateArgumentDependence::UnexpandedPack) +- addDependence(ExprDependence::UnexpandedPack); + } else if (TemplateKWLoc.isValid()) { + getTrailingObjects()->initializeFrom( + TemplateKWLoc); +@@ -1392,6 +1319,7 @@ CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( + + if (hasFirstQualifierFoundInScope()) + *getTrailingObjects() = FirstQualifierFoundInScope; ++ setDependence(computeDependence(this)); + } + + CXXDependentScopeMemberExpr::CXXDependentScopeMemberExpr( +@@ -1573,16 +1501,15 @@ SizeOfPackExpr *SizeOfPackExpr::CreateDeserialized(ASTContext &Context, + return new (Storage) SizeOfPackExpr(EmptyShell(), NumPartialArgs); + } + +-SubstNonTypeTemplateParmPackExpr:: +-SubstNonTypeTemplateParmPackExpr(QualType T, +- ExprValueKind ValueKind, +- NonTypeTemplateParmDecl *Param, +- SourceLocation NameLoc, +- const TemplateArgument &ArgPack) +- : Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind, OK_Ordinary, +- true, true, true, true), ++SubstNonTypeTemplateParmPackExpr::SubstNonTypeTemplateParmPackExpr( ++ QualType T, ExprValueKind ValueKind, NonTypeTemplateParmDecl *Param, ++ SourceLocation NameLoc, const TemplateArgument &ArgPack) ++ : Expr(SubstNonTypeTemplateParmPackExprClass, T, ValueKind, OK_Ordinary), + Param(Param), Arguments(ArgPack.pack_begin()), +- NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) {} ++ NumArguments(ArgPack.pack_size()), NameLoc(NameLoc) { ++ setDependence(ExprDependence::TypeValueInstantiation | ++ ExprDependence::UnexpandedPack); ++} + + TemplateArgument SubstNonTypeTemplateParmPackExpr::getArgumentPack() const { + return TemplateArgument(llvm::makeArrayRef(Arguments, NumArguments)); +@@ -1592,12 +1519,13 @@ FunctionParmPackExpr::FunctionParmPackExpr(QualType T, VarDecl *ParamPack, + SourceLocation NameLoc, + unsigned NumParams, + VarDecl *const *Params) +- : Expr(FunctionParmPackExprClass, T, VK_LValue, OK_Ordinary, true, true, +- true, true), ++ : Expr(FunctionParmPackExprClass, T, VK_LValue, OK_Ordinary), + ParamPack(ParamPack), NameLoc(NameLoc), NumParameters(NumParams) { + if (Params) + std::uninitialized_copy(Params, Params + NumParams, + getTrailingObjects()); ++ setDependence(ExprDependence::TypeValueInstantiation | ++ ExprDependence::UnexpandedPack); + } + + FunctionParmPackExpr * +@@ -1619,16 +1547,14 @@ MaterializeTemporaryExpr::MaterializeTemporaryExpr( + QualType T, Expr *Temporary, bool BoundToLvalueReference, + LifetimeExtendedTemporaryDecl *MTD) + : Expr(MaterializeTemporaryExprClass, T, +- BoundToLvalueReference ? VK_LValue : VK_XValue, OK_Ordinary, +- Temporary->isTypeDependent(), Temporary->isValueDependent(), +- Temporary->isInstantiationDependent(), +- Temporary->containsUnexpandedParameterPack()) { ++ BoundToLvalueReference ? VK_LValue : VK_XValue, OK_Ordinary) { + if (MTD) { + State = MTD; + MTD->ExprWithTemporary = Temporary; + return; + } + State = Temporary; ++ setDependence(computeDependence(this)); + } + + void MaterializeTemporaryExpr::setExtendingDecl(ValueDecl *ExtendedBy, +@@ -1650,25 +1576,18 @@ void MaterializeTemporaryExpr::setExtendingDecl(ValueDecl *ExtendedBy, + + TypeTraitExpr::TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind, + ArrayRef Args, +- SourceLocation RParenLoc, +- bool Value) +- : Expr(TypeTraitExprClass, T, VK_RValue, OK_Ordinary, +- /*TypeDependent=*/false, +- /*ValueDependent=*/false, +- /*InstantiationDependent=*/false, +- /*ContainsUnexpandedParameterPack=*/false), +- Loc(Loc), RParenLoc(RParenLoc) { ++ SourceLocation RParenLoc, bool Value) ++ : Expr(TypeTraitExprClass, T, VK_RValue, OK_Ordinary), Loc(Loc), ++ RParenLoc(RParenLoc) { + TypeTraitExprBits.Kind = Kind; + TypeTraitExprBits.Value = Value; + TypeTraitExprBits.NumArgs = Args.size(); + + auto **ToArgs = getTrailingObjects(); +- +- for (unsigned I = 0, N = Args.size(); I != N; ++I) { +- addDependence(toExprDependence(Args[I]->getType()->getDependence()) & +- ~ExprDependence::Type); ++ for (unsigned I = 0, N = Args.size(); I != N; ++I) + ToArgs[I] = Args[I]; +- } ++ ++ setDependence(computeDependence(this)); + } + + TypeTraitExpr *TypeTraitExpr::Create(const ASTContext &C, QualType T, +@@ -1720,4 +1639,4 @@ CUDAKernelCallExpr *CUDAKernelCallExpr::CreateEmpty(const ASTContext &Ctx, + void *Mem = Ctx.Allocate(sizeof(CUDAKernelCallExpr) + SizeOfTrailingObjects, + alignof(CUDAKernelCallExpr)); + return new (Mem) CUDAKernelCallExpr(NumArgs, Empty); +-} ++} +\ No newline at end of file +diff --git a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +index 479a88a14ecae..b3a4bd9215d5c 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +@@ -13,6 +13,7 @@ + #include "clang/AST/ExprConcepts.h" + #include "clang/AST/ASTConcept.h" + #include "clang/AST/ASTContext.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" +@@ -29,39 +30,28 @@ + + using namespace clang; + +-ConceptSpecializationExpr::ConceptSpecializationExpr(const ASTContext &C, +- NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, +- DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, +- ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ++ConceptSpecializationExpr::ConceptSpecializationExpr( ++ const ASTContext &C, NestedNameSpecifierLoc NNS, ++ SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, ++ NamedDecl *FoundDecl, ConceptDecl *NamedConcept, ++ const ASTTemplateArgumentListInfo *ArgsAsWritten, + ArrayRef ConvertedArgs, + const ConstraintSatisfaction *Satisfaction) +- : Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary, +- /*TypeDependent=*/false, +- // All the flags below are set in setTemplateArguments. +- /*ValueDependent=*/!Satisfaction, /*InstantiationDependent=*/false, +- /*ContainsUnexpandedParameterPacks=*/false), ++ : Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary), + ConceptReference(NNS, TemplateKWLoc, ConceptNameInfo, FoundDecl, + NamedConcept, ArgsAsWritten), + NumTemplateArgs(ConvertedArgs.size()), +- Satisfaction(Satisfaction ? +- ASTConstraintSatisfaction::Create(C, *Satisfaction) : +- nullptr) { ++ Satisfaction(Satisfaction ++ ? ASTConstraintSatisfaction::Create(C, *Satisfaction) ++ : nullptr) { + setTemplateArguments(ConvertedArgs); +- auto Deps = TemplateArgumentDependence::None; +- const auto InterestingDeps = TemplateArgumentDependence::Instantiation | +- TemplateArgumentDependence::UnexpandedPack; +- for (const TemplateArgumentLoc& ArgLoc : ArgsAsWritten->arguments()) { +- Deps |= ArgLoc.getArgument().getDependence() & InterestingDeps; +- if (Deps == InterestingDeps) +- break; +- } ++ setDependence(computeDependence(this, /*ValueDependent=*/!Satisfaction)); + + // Currently guaranteed by the fact concepts can only be at namespace-scope. + assert(!NestedNameSpec || + (!NestedNameSpec.getNestedNameSpecifier()->isInstantiationDependent() && + !NestedNameSpec.getNestedNameSpecifier() + ->containsUnexpandedParameterPack())); +- addDependence(toExprDependence(Deps)); + assert((!isValueDependent() || isInstantiationDependent()) && + "should not be value-dependent"); + } +@@ -101,18 +91,23 @@ ConceptSpecializationExpr::ConceptSpecializationExpr( + ArrayRef ConvertedArgs, + const ConstraintSatisfaction *Satisfaction, bool Dependent, + bool ContainsUnexpandedParameterPack) +- : Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary, +- /*TypeDependent=*/false, +- /*ValueDependent=*/!Satisfaction, Dependent, +- ContainsUnexpandedParameterPack), ++ : Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary), + ConceptReference(NestedNameSpecifierLoc(), SourceLocation(), +- DeclarationNameInfo(), NamedConcept, +- NamedConcept, nullptr), ++ DeclarationNameInfo(), NamedConcept, NamedConcept, ++ nullptr), + NumTemplateArgs(ConvertedArgs.size()), +- Satisfaction(Satisfaction ? +- ASTConstraintSatisfaction::Create(C, *Satisfaction) : +- nullptr) { ++ Satisfaction(Satisfaction ++ ? ASTConstraintSatisfaction::Create(C, *Satisfaction) ++ : nullptr) { + setTemplateArguments(ConvertedArgs); ++ ExprDependence D = ExprDependence::None; ++ if (!Satisfaction) ++ D |= ExprDependence::Value; ++ if (Dependent) ++ D |= ExprDependence::Instantiation; ++ if (ContainsUnexpandedParameterPack) ++ D |= ExprDependence::UnexpandedPack; ++ setDependence(D); + } + + ConceptSpecializationExpr * +@@ -151,11 +146,9 @@ RequiresExpr::RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc, + ArrayRef LocalParameters, + ArrayRef Requirements, + SourceLocation RBraceLoc) +- : Expr(RequiresExprClass, C.BoolTy, VK_RValue, OK_Ordinary, +- /*TD=*/false, /*VD=*/false, /*ID=*/false, +- /*ContainsUnexpandedParameterPack=*/false), +- NumLocalParameters(LocalParameters.size()), +- NumRequirements(Requirements.size()), Body(Body), RBraceLoc(RBraceLoc) { ++ : Expr(RequiresExprClass, C.BoolTy, VK_RValue, OK_Ordinary), ++ NumLocalParameters(LocalParameters.size()), ++ NumRequirements(Requirements.size()), Body(Body), RBraceLoc(RBraceLoc) { + RequiresExprBits.IsSatisfied = false; + RequiresExprBits.RequiresKWLoc = RequiresKWLoc; + bool Dependent = false; +@@ -180,6 +173,7 @@ RequiresExpr::RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc, + std::copy(Requirements.begin(), Requirements.end(), + getTrailingObjects()); + RequiresExprBits.IsSatisfied |= Dependent; ++ // FIXME: move the computing dependency logic to ComputeDependence.h + if (ContainsUnexpandedParameterPack) + addDependence(ExprDependence::UnexpandedPack); + // FIXME: this is incorrect for cases where we have a non-dependent +diff --git a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +index f2c060a084f66..662bc325f12c8 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +@@ -12,6 +12,7 @@ + + #include "clang/AST/ExprObjC.h" + #include "clang/AST/ASTContext.h" ++#include "clang/AST/ComputeDependence.h" + #include "clang/AST/DependenceFlags.h" + #include "clang/AST/SelectorLocationsKind.h" + #include "clang/AST/Type.h" +@@ -26,14 +27,13 @@ using namespace clang; + + ObjCArrayLiteral::ObjCArrayLiteral(ArrayRef Elements, QualType T, + ObjCMethodDecl *Method, SourceRange SR) +- : Expr(ObjCArrayLiteralClass, T, VK_RValue, OK_Ordinary, false, false, +- false, false), ++ : Expr(ObjCArrayLiteralClass, T, VK_RValue, OK_Ordinary), + NumElements(Elements.size()), Range(SR), ArrayWithObjectsMethod(Method) { + Expr **SaveElements = getElements(); +- for (unsigned I = 0, N = Elements.size(); I != N; ++I) { +- addDependence(turnTypeToValueDependence(Elements[I]->getDependence())); ++ for (unsigned I = 0, N = Elements.size(); I != N; ++I) + SaveElements[I] = Elements[I]; +- } ++ ++ setDependence(computeDependence(this)); + } + + ObjCArrayLiteral *ObjCArrayLiteral::Create(const ASTContext &C, +@@ -54,20 +54,13 @@ ObjCDictionaryLiteral::ObjCDictionaryLiteral(ArrayRef VK, + bool HasPackExpansions, QualType T, + ObjCMethodDecl *method, + SourceRange SR) +- : Expr(ObjCDictionaryLiteralClass, T, VK_RValue, OK_Ordinary, false, false, +- false, false), ++ : Expr(ObjCDictionaryLiteralClass, T, VK_RValue, OK_Ordinary), + NumElements(VK.size()), HasPackExpansions(HasPackExpansions), Range(SR), + DictWithObjectsMethod(method) { + KeyValuePair *KeyValues = getTrailingObjects(); + ExpansionData *Expansions = + HasPackExpansions ? getTrailingObjects() : nullptr; + for (unsigned I = 0; I < NumElements; I++) { +- auto Deps = turnTypeToValueDependence(VK[I].Key->getDependence() | +- VK[I].Value->getDependence()); +- if (VK[I].EllipsisLoc.isValid()) +- Deps &= ~ExprDependence::UnexpandedPack; +- addDependence(Deps); +- + KeyValues[I].Key = VK[I].Key; + KeyValues[I].Value = VK[I].Value; + if (Expansions) { +@@ -78,6 +71,7 @@ ObjCDictionaryLiteral::ObjCDictionaryLiteral(ArrayRef VK, + Expansions[I].NumExpansionsPlusOne = 0; + } + } ++ setDependence(computeDependence(this)); + } + + ObjCDictionaryLiteral * +@@ -117,10 +111,7 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, + SelectorLocationsKind SelLocsK, + ObjCMethodDecl *Method, ArrayRef Args, + SourceLocation RBracLoc, bool isImplicit) +- : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary, +- /*TypeDependent=*/false, /*ValueDependent=*/false, +- /*InstantiationDependent=*/false, +- /*ContainsUnexpandedParameterPack=*/false), ++ : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary), + SelectorOrMethod( + reinterpret_cast(Method ? Method : Sel.getAsOpaquePtr())), + Kind(IsInstanceSuper ? SuperInstance : SuperClass), +@@ -129,6 +120,7 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, + RBracLoc(RBracLoc) { + initArgsAndSelLocs(Args, SelLocs, SelLocsK); + setReceiverPointer(SuperType.getAsOpaquePtr()); ++ setDependence(computeDependence(this)); + } + + ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, +@@ -138,15 +130,14 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, + SelectorLocationsKind SelLocsK, + ObjCMethodDecl *Method, ArrayRef Args, + SourceLocation RBracLoc, bool isImplicit) +- : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary, T->isDependentType(), +- T->isDependentType(), T->isInstantiationDependentType(), +- T->containsUnexpandedParameterPack()), ++ : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary), + SelectorOrMethod( + reinterpret_cast(Method ? Method : Sel.getAsOpaquePtr())), + Kind(Class), HasMethod(Method != nullptr), IsDelegateInitCall(false), + IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc) { + initArgsAndSelLocs(Args, SelLocs, SelLocsK); + setReceiverPointer(Receiver); ++ setDependence(computeDependence(this)); + } + + ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, +@@ -155,16 +146,14 @@ ObjCMessageExpr::ObjCMessageExpr(QualType T, ExprValueKind VK, + SelectorLocationsKind SelLocsK, + ObjCMethodDecl *Method, ArrayRef Args, + SourceLocation RBracLoc, bool isImplicit) +- : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary, +- Receiver->isTypeDependent(), Receiver->isTypeDependent(), +- Receiver->isInstantiationDependent(), +- Receiver->containsUnexpandedParameterPack()), ++ : Expr(ObjCMessageExprClass, T, VK, OK_Ordinary), + SelectorOrMethod( + reinterpret_cast(Method ? Method : Sel.getAsOpaquePtr())), + Kind(Instance), HasMethod(Method != nullptr), IsDelegateInitCall(false), + IsImplicit(isImplicit), LBracLoc(LBracLoc), RBracLoc(RBracLoc) { + initArgsAndSelLocs(Args, SelLocs, SelLocsK); + setReceiverPointer(Receiver); ++ setDependence(computeDependence(this)); + } + + void ObjCMessageExpr::initArgsAndSelLocs(ArrayRef Args, +@@ -172,10 +161,8 @@ void ObjCMessageExpr::initArgsAndSelLocs(ArrayRef Args, + SelectorLocationsKind SelLocsK) { + setNumArgs(Args.size()); + Expr **MyArgs = getArgs(); +- for (unsigned I = 0; I != Args.size(); ++I) { +- addDependence(Args[I]->getDependence()); ++ for (unsigned I = 0; I != Args.size(); ++I) + MyArgs[I] = Args[I]; +- } + + SelLocsKind = SelLocsK; + if (!isImplicit()) { +diff --git a/../clang-10.0.1.src/lib/Sema/SemaExpr.cpp b/../clang-10.0.1.src/lib/Sema/SemaExpr.cpp +index 3cfaf9fa00683..546f3ac7325bd 100644 +--- a/../clang-10.0.1.src/lib/Sema/SemaExpr.cpp ++++ b/../clang-10.0.1.src/lib/Sema/SemaExpr.cpp +@@ -14204,11 +14204,9 @@ ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, + ExprValueKind VK = VK_RValue; + ExprObjectKind OK = OK_Ordinary; + QualType resType; +- bool ValueDependent = false; + bool CondIsTrue = false; + if (CondExpr->isTypeDependent() || CondExpr->isValueDependent()) { + resType = Context.DependentTy; +- ValueDependent = true; + } else { + // The conditional expression is required to be a constant expression. + llvm::APSInt condEval(32); +@@ -14224,14 +14222,12 @@ ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc, + Expr *ActiveExpr = CondIsTrue ? LHSExpr : RHSExpr; + + resType = ActiveExpr->getType(); +- ValueDependent = ActiveExpr->isValueDependent(); + VK = ActiveExpr->getValueKind(); + OK = ActiveExpr->getObjectKind(); + } + +- return new (Context) +- ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr, resType, VK, OK, RPLoc, +- CondIsTrue, resType->isDependentType(), ValueDependent); ++ return new (Context) ChooseExpr(BuiltinLoc, CondExpr, LHSExpr, RHSExpr, ++ resType, VK, OK, RPLoc, CondIsTrue); + } + + //===----------------------------------------------------------------------===// +diff --git a/../clang-10.0.1.src/lib/Sema/SemaPseudoObject.cpp b/../clang-10.0.1.src/lib/Sema/SemaPseudoObject.cpp +index 5587e0d24c7f4..87c3c264b472e 100644 +--- a/../clang-10.0.1.src/lib/Sema/SemaPseudoObject.cpp ++++ b/../clang-10.0.1.src/lib/Sema/SemaPseudoObject.cpp +@@ -167,16 +167,11 @@ namespace { + Expr *&rebuiltExpr = ce->isConditionTrue() ? LHS : RHS; + rebuiltExpr = rebuild(rebuiltExpr); + +- return new (S.Context) ChooseExpr(ce->getBuiltinLoc(), +- ce->getCond(), +- LHS, RHS, +- rebuiltExpr->getType(), +- rebuiltExpr->getValueKind(), +- rebuiltExpr->getObjectKind(), +- ce->getRParenLoc(), +- ce->isConditionTrue(), +- rebuiltExpr->isTypeDependent(), +- rebuiltExpr->isValueDependent()); ++ return new (S.Context) ++ ChooseExpr(ce->getBuiltinLoc(), ce->getCond(), LHS, RHS, ++ rebuiltExpr->getType(), rebuiltExpr->getValueKind(), ++ rebuiltExpr->getObjectKind(), ce->getRParenLoc(), ++ ce->isConditionTrue()); + } + + llvm_unreachable("bad expression to rebuild!"); diff --git a/LLVM/patches/windows/003-rename_DependencyFlags.patch.txt b/LLVM/patches/windows/003-rename_DependencyFlags.patch.txt new file mode 100644 index 0000000000..2a718f9053 --- /dev/null +++ b/LLVM/patches/windows/003-rename_DependencyFlags.patch.txt @@ -0,0 +1,244 @@ +From 67d25914b2a42cef88124fe267c7a89cce9e7987 Mon Sep 17 00:00:00 2001 +From: Haojian Wu +Date: Mon, 16 Mar 2020 13:43:40 +0100 +Subject: [PATCH] [AST] rename DependencyFlags.h => DependenceFlags.h, NFC + +We forgot to fix in the previous patch. +--- + .../clang/AST/{DependencyFlags.h => DependenceFlags.h} | 6 +++--- + clang/include/clang/AST/Expr.h | 2 +- + clang/include/clang/AST/NestedNameSpecifier.h | 2 +- + clang/include/clang/AST/Stmt.h | 2 +- + clang/include/clang/AST/TemplateBase.h | 2 +- + clang/include/clang/AST/TemplateName.h | 2 +- + clang/include/clang/AST/Type.h | 2 +- + clang/lib/AST/Expr.cpp | 2 +- + clang/lib/AST/ExprCXX.cpp | 2 +- + clang/lib/AST/ExprConcepts.cpp | 2 +- + clang/lib/AST/ExprObjC.cpp | 2 +- + clang/lib/AST/NestedNameSpecifier.cpp | 2 +- + clang/lib/AST/TemplateBase.cpp | 2 +- + clang/lib/AST/TemplateName.cpp | 2 +- + clang/lib/Sema/SemaOverload.cpp | 2 +- + clang/lib/Serialization/ASTReaderStmt.cpp | 2 +- + 16 files changed, 18 insertions(+), 18 deletions(-) + rename clang/include/clang/AST/{DependencyFlags.h => DependenceFlags.h} (97%) + +diff --git a/../clang-10.0.1.src/include/clang/AST/DependencyFlags.h b/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h +similarity index 97% +rename from clang/include/clang/AST/DependencyFlags.h +rename to clang/include/clang/AST/DependenceFlags.h +index c27016aa9aec4..8aeb828b8e8c1 100644 +--- a/../clang-10.0.1.src/include/clang/AST/DependencyFlags.h ++++ b/../clang-10.0.1.src/include/clang/AST/DependenceFlags.h +@@ -1,12 +1,12 @@ +-//===--- DependencyFlags.h ------------------------------------------------===// ++//===--- DependenceFlags.h ------------------------------------------------===// + // + // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + // See https://llvm.org/LICENSE.txt for license information. + // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + // + //===----------------------------------------------------------------------===// +-#ifndef LLVM_CLANG_AST_DEPENDENCYFLAGS_H +-#define LLVM_CLANG_AST_DEPENDENCYFLAGS_H ++#ifndef LLVM_CLANG_AST_DEPENDENCEFLAGS_H ++#define LLVM_CLANG_AST_DEPENDENCEFLAGS_H + + #include "clang/Basic/BitmaskEnum.h" + #include "llvm/ADT/BitmaskEnum.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/Expr.h b/../clang-10.0.1.src/include/clang/AST/Expr.h +index b1f17631c8925..372d64763c4bc 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Expr.h ++++ b/../clang-10.0.1.src/include/clang/AST/Expr.h +@@ -17,7 +17,7 @@ + #include "clang/AST/ASTVector.h" + #include "clang/AST/Decl.h" + #include "clang/AST/DeclAccessPair.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/OperationKinds.h" + #include "clang/AST/Stmt.h" + #include "clang/AST/TemplateBase.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h b/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h +index e465c33e2cc5f..47f5268c938b5 100644 +--- a/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h ++++ b/../clang-10.0.1.src/include/clang/AST/NestedNameSpecifier.h +@@ -14,7 +14,7 @@ + #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H + #define LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H + +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/Basic/Diagnostic.h" + #include "clang/Basic/SourceLocation.h" + #include "llvm/ADT/FoldingSet.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/Stmt.h b/../clang-10.0.1.src/include/clang/AST/Stmt.h +index d0efad03e42fc..87e1d7f26a168 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Stmt.h ++++ b/../clang-10.0.1.src/include/clang/AST/Stmt.h +@@ -14,7 +14,7 @@ + #define LLVM_CLANG_AST_STMT_H + + #include "clang/AST/DeclGroup.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/StmtIterator.h" + #include "clang/Basic/CapturedStmt.h" + #include "clang/Basic/IdentifierTable.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +index e5fd1ca9dd461..1875e3eda0395 100644 +--- a/../clang-10.0.1.src/include/clang/AST/TemplateBase.h ++++ b/../clang-10.0.1.src/include/clang/AST/TemplateBase.h +@@ -14,7 +14,7 @@ + #ifndef LLVM_CLANG_AST_TEMPLATEBASE_H + #define LLVM_CLANG_AST_TEMPLATEBASE_H + +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateName.h" + #include "clang/AST/Type.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/TemplateName.h b/../clang-10.0.1.src/include/clang/AST/TemplateName.h +index bf917788477f7..9bcf2838dcf13 100644 +--- a/../clang-10.0.1.src/include/clang/AST/TemplateName.h ++++ b/../clang-10.0.1.src/include/clang/AST/TemplateName.h +@@ -13,7 +13,7 @@ + #ifndef LLVM_CLANG_AST_TEMPLATENAME_H + #define LLVM_CLANG_AST_TEMPLATENAME_H + +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/Basic/LLVM.h" + #include "llvm/ADT/FoldingSet.h" +diff --git a/../clang-10.0.1.src/include/clang/AST/Type.h b/../clang-10.0.1.src/include/clang/AST/Type.h +index f9a269e12d2d8..e72b44fbb31ff 100644 +--- a/../clang-10.0.1.src/include/clang/AST/Type.h ++++ b/../clang-10.0.1.src/include/clang/AST/Type.h +@@ -17,7 +17,7 @@ + #ifndef LLVM_CLANG_AST_TYPE_H + #define LLVM_CLANG_AST_TYPE_H + +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateName.h" + #include "clang/Basic/AddressSpaces.h" +diff --git a/../clang-10.0.1.src/lib/AST/Expr.cpp b/../clang-10.0.1.src/lib/AST/Expr.cpp +index 4eb7a177de004..4b2b9e4d5eb33 100644 +--- a/../clang-10.0.1.src/lib/AST/Expr.cpp ++++ b/../clang-10.0.1.src/lib/AST/Expr.cpp +@@ -17,7 +17,7 @@ + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclObjC.h" + #include "clang/AST/DeclTemplate.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/EvaluatedExprVisitor.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/Mangle.h" +diff --git a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +index 38cdfcf752df5..69db80f452aaa 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprCXX.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprCXX.cpp +@@ -19,7 +19,7 @@ + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/LambdaCapture.h" + #include "clang/AST/NestedNameSpecifier.h" +diff --git a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +index 42cc4576562e4..479a88a14ecae 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprConcepts.cpp +@@ -16,7 +16,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/TemplateBase.h" +diff --git a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +index 6d98429bc89dc..f2c060a084f66 100644 +--- a/../clang-10.0.1.src/lib/AST/ExprObjC.cpp ++++ b/../clang-10.0.1.src/lib/AST/ExprObjC.cpp +@@ -12,7 +12,7 @@ + + #include "clang/AST/ExprObjC.h" + #include "clang/AST/ASTContext.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/SelectorLocationsKind.h" + #include "clang/AST/Type.h" + #include "clang/AST/TypeLoc.h" +diff --git a/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp b/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp +index 8cd65a857beb4..af53c7fd9ba42 100644 +--- a/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp ++++ b/../clang-10.0.1.src/lib/AST/NestedNameSpecifier.cpp +@@ -16,7 +16,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclCXX.h" + #include "clang/AST/DeclTemplate.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/PrettyPrinter.h" + #include "clang/AST/TemplateName.h" + #include "clang/AST/Type.h" +diff --git a/../clang-10.0.1.src/lib/AST/TemplateBase.cpp b/../clang-10.0.1.src/lib/AST/TemplateBase.cpp +index 3c550bddaff8c..c122213766915 100644 +--- a/../clang-10.0.1.src/lib/AST/TemplateBase.cpp ++++ b/../clang-10.0.1.src/lib/AST/TemplateBase.cpp +@@ -16,7 +16,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclBase.h" + #include "clang/AST/DeclTemplate.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/PrettyPrinter.h" +diff --git a/../clang-10.0.1.src/lib/AST/TemplateName.cpp b/../clang-10.0.1.src/lib/AST/TemplateName.cpp +index 3b8ae06c63397..40a8736ae1afd 100644 +--- a/../clang-10.0.1.src/lib/AST/TemplateName.cpp ++++ b/../clang-10.0.1.src/lib/AST/TemplateName.cpp +@@ -14,7 +14,7 @@ + #include "clang/AST/Decl.h" + #include "clang/AST/DeclBase.h" + #include "clang/AST/DeclTemplate.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/NestedNameSpecifier.h" + #include "clang/AST/PrettyPrinter.h" + #include "clang/AST/TemplateBase.h" +diff --git a/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp b/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp +index 9ecf5867e9661..d80aac9d703ac 100644 +--- a/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp ++++ b/../clang-10.0.1.src/lib/Sema/SemaOverload.cpp +@@ -13,7 +13,7 @@ + #include "clang/AST/ASTContext.h" + #include "clang/AST/CXXInheritance.h" + #include "clang/AST/DeclObjC.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/ExprObjC.h" +diff --git a/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp b/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp +index 4efd337650b29..d74b0d514eda0 100644 +--- a/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp ++++ b/../clang-10.0.1.src/lib/Serialization/ASTReaderStmt.cpp +@@ -21,7 +21,7 @@ + #include "clang/AST/DeclObjC.h" + #include "clang/AST/DeclTemplate.h" + #include "clang/AST/DeclarationName.h" +-#include "clang/AST/DependencyFlags.h" ++#include "clang/AST/DependenceFlags.h" + #include "clang/AST/Expr.h" + #include "clang/AST/ExprCXX.h" + #include "clang/AST/ExprObjC.h" diff --git a/LLVM/patches/windows/004-smallVector_is_trivially_copyable.patch.txt b/LLVM/patches/windows/004-smallVector_is_trivially_copyable.patch.txt new file mode 100644 index 0000000000..ec4f9ae5ec --- /dev/null +++ b/LLVM/patches/windows/004-smallVector_is_trivially_copyable.patch.txt @@ -0,0 +1,58 @@ +From f7bf28b2c02a4785d0d533fbbe4a7d8810b6dcf1 Mon Sep 17 00:00:00 2001 +From: Benjamin Kramer +Date: Sat, 2 May 2020 19:22:15 +0200 +Subject: [PATCH] [SmallVector] Weaken the predicate for the memcpy + optimization + +We don't require the type to be trivially assignable. While the standard +says that only is_trivially_copyable types may be memcpy'd, this seems +overly strict. We never assign the type, so there's no way for the type +to observe that the copy/move construction got elided. This is important +for std::pair, which is not trivially assignable and probably +never will be because changing that would break ABI. + +As a side-effect this no longer allows types with deleted copy/move +constructors in SmallVector. That's an unintended side-effect of +is_trivially_copyable anyways. + +Shrinks Release+Asserts clang by 20k. +--- + include/llvm/ADT/SmallVector.h | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h +index 38aa1fa78a7e1..6313fc563beae 100644 +--- a/include/llvm/ADT/SmallVector.h ++++ b/include/llvm/ADT/SmallVector.h +@@ -200,9 +200,17 @@ class SmallVectorTemplateCommon + } + }; + +-/// SmallVectorTemplateBase - This is where we put method +-/// implementations that are designed to work with non-POD-like T's. +-template ::value> ++/// SmallVectorTemplateBase - This is where we put ++/// method implementations that are designed to work with non-trivial T's. ++/// ++/// We approximate is_trivially_copyable with trivial move/copy construction and ++/// trivial destruction. While the standard doesn't specify that you're allowed ++/// copy these types with memcpy, there is no way for the type to observe this. ++/// This catches the important case of std::pair, which is not ++/// trivially assignable. ++template ::value) && ++ (is_trivially_move_constructible::value) && ++ std::is_trivially_destructible::value> + class SmallVectorTemplateBase : public SmallVectorTemplateCommon { + protected: + SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon(Size) {} +@@ -290,7 +298,9 @@ void SmallVectorTemplateBase::grow(size_t MinSize) { + } + + /// SmallVectorTemplateBase - This is where we put +-/// method implementations that are designed to work with POD-like T's. ++/// method implementations that are designed to work with trivially copyable ++/// T's. This allows using memcpy in place of copy/move construction and ++/// skipping destruction. + template + class SmallVectorTemplateBase : public SmallVectorTemplateCommon { + protected: diff --git a/LZ4/config.py b/LZ4/config.py index b852ca0c89..50cf0a5699 100644 --- a/LZ4/config.py +++ b/LZ4/config.py @@ -21,4 +21,24 @@ ], + "platform:windows" : { + + "manifest" : [ + + "lib\\liblz4.dll", + "lib\\liblz4.lib", + + ], + + "commands" : [ + + # From the LZ4 appveyor script + "msbuild visual\\VS2017\\lz4.sln /m /verbosity:minimal /property:PlatformToolset=v142 /property:WindowsTargetPlatformVersion=10.0.17763.0 /t:Clean,Build /p:Platform=x64 /p:Configuration=Release", + "copy visual\\VS2017\\bin\\x64_Release\\liblz4.dll {buildDir}\\lib", + "copy visual\\VS2017\\bin\\x64_Release\\liblz4.lib {buildDir}\\lib", + + ], + + }, + } diff --git a/LibFFI/config.py b/LibFFI/config.py index 8661791639..364f1d086c 100644 --- a/LibFFI/config.py +++ b/LibFFI/config.py @@ -19,8 +19,16 @@ "manifest" : [ - "lib/libffi*{sharedLibraryExtension}*", + "lib/{libraryPrefix}ffi*{sharedLibraryExtension}*", + "lib/{libraryPrefix}ffi*{staticLibraryExtension}*", ], + "platform:windows" : { + + "manifest" : [], + "commands" : [], + + }, + } diff --git a/LibJPEG-Turbo/config.py b/LibJPEG-Turbo/config.py index 8ae7aab8b6..b9704cd9b6 100644 --- a/LibJPEG-Turbo/config.py +++ b/LibJPEG-Turbo/config.py @@ -24,8 +24,29 @@ "include/jmorecfg.h", "include/jpeglib.h", - "lib/libjpeg*{sharedLibraryExtension}*", - + "lib/libjpeg*{sharedLibraryExtension}*", # Linux / Mac OS + "lib/libjpeg*.lib*", + "lib/jpeg62{sharedLibraryExtension}", # Windows only + "lib/turbojpeg{sharedLibraryExtension}", # Windows only ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D WITH_SIMD=OFF" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\jpeg62{sharedLibraryExtension} {buildDir}\\lib\\", + "copy {buildDir}\\bin\\turbojpeg{sharedLibraryExtension} {buildDir}\\lib\\", + ], + + }, } diff --git a/LibPNG/config.py b/LibPNG/config.py index 5828e14bdc..c2626a5661 100644 --- a/LibPNG/config.py +++ b/LibPNG/config.py @@ -21,8 +21,29 @@ "include/png*", "include/libpng*", - "lib/libpng*{sharedLibraryExtension}*", + "lib/libpng*{sharedLibraryExtension}*", # lib prefix is accurate for all platforms + "lib/libpng*.lib", ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D ZLIB_INCLUDE_DIR={buildDir}\\include" + " -D ZLIB_LIBRARY={buildDir}\\lib\\zlib.lib" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\libpng*{sharedLibraryExtension}* {buildDir}\\lib\\", + + ], + + }, } diff --git a/LibRaw/config.py b/LibRaw/config.py index 4ba530e4bd..2f9931f95d 100644 --- a/LibRaw/config.py +++ b/LibRaw/config.py @@ -18,11 +18,27 @@ ], + # The "lib" prefix is correct for all platforms including Windows "manifest" : [ "include/libraw", "lib/libraw*{sharedLibraryExtension}*", + "lib/libraw{staticLibraryExtension}", ], + "platform:windows" : { + + "commands" : [ + + "nmake -f Makefile.msvc", + "xcopy /s /e /h /y /i libraw include\\libraw", + "copy bin\\libraw.dll lib\\libraw.dll" + + ], + + }, + + + } diff --git a/LibTIFF/config.py b/LibTIFF/config.py index acc0d5224c..41dc3e027c 100644 --- a/LibTIFF/config.py +++ b/LibTIFF/config.py @@ -36,5 +36,16 @@ "lib/libtiff*{sharedLibraryExtension}*", ], + "platform:windows" : { + + "commands" : [ + + "nmake /f makefile.vc", + "copy libtiff\\*.h {buildDir}\\include", + "copy libtiff\\libtiff.lib {buildDir}\\lib", + + ], + + }, } diff --git a/LibTIFF/patches/windows/zip.patch b/LibTIFF/patches/windows/zip.patch new file mode 100644 index 0000000000..e889fe2b61 --- /dev/null +++ b/LibTIFF/patches/windows/zip.patch @@ -0,0 +1,16 @@ +--- ./nmake.opt 2018-11-03 14:26:00.959361000 -0400 ++++ ./nmake.opt 2018-12-14 17:48:11.536126800 -0500 +@@ -62,10 +62,9 @@ + # Uncomment and edit following lines to enable ZIP support + # (required for Deflate compression and Pixar log-format) + # +-#ZIP_SUPPORT = 1 +-#ZLIBDIR = d:/projects/zlib-1.2.1 +-#ZLIB_INCLUDE = -I$(ZLIBDIR) +-#ZLIB_LIB = $(ZLIBDIR)/zlib.lib ++ZIP_SUPPORT = 1 ++ZLIB_INCLUDE = -I%BUILD_DIR%/include ++ZLIB_LIB = %BUILD_DIR%/lib/zlib.lib + + # + # Uncomment and edit following lines to enable ISO JBIG support diff --git a/OpenColorIO/config.py b/OpenColorIO/config.py index eeecbad30f..0f49500bd0 100644 --- a/OpenColorIO/config.py +++ b/OpenColorIO/config.py @@ -55,7 +55,8 @@ "manifest" : [ "include/OpenColorIO", - "lib/libOpenColorIO*{sharedLibraryExtension}*", + "lib/{libraryPrefix}OpenColorIO*{sharedLibraryExtension}*", + "lib/{libraryPrefix}OpenColorIO*.lib", "openColorIO", "python/PyOpenColorIO*", @@ -86,4 +87,52 @@ }, + "platform:windows" : { + + "variables" : { + + "cmakeBuildType" : "Release", + "cmakeGenerator": "\"Visual Studio 16 2019\"", + + }, + + "environment" : { + + "PATH" : "%PATH%;%ROOT_DIR%\\winbuild\\patch\\bin", + + }, + + "commands" : [ + + #OCIO is particular about needing all slashes to be forward slashes + "mkdir build", + "cd build && cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_CXX_STANDARD={c++Standard}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D Python_ROOT_DIR={buildDir}" + " -D Python_FIND_STRATEGY=LOCATION" + " -D BUILD_SHARED_LIBS=ON" + " -D OCIO_BUILD_APPS=OFF" + " -D OCIO_BUILD_NUKE=OFF" + " -D OCIO_BUILD_TESTS=OFF" + " -D OCIO_BUILD_GPU_TESTS=OFF" + # Will need removing when we update to OpenEXR 3 + " -D OCIO_USE_OPENEXR_HALF=ON" + " -D OCIO_PYTHON_VERSION={pythonVersion}" + " ..", + "cd build && cmake --build . --config {cmakeBuildType} --target install", + # "if not exist \"{buildDir}\\python\" mkdir {buildDir}\\python", + # "move {buildDir}\\PyOpenColorIO.dll {buildDir}\\python\\PyOpenColorIO.pyd", + "if not exist \"{buildDir}\\openColorIO\" mkdir {buildDir}\\openColorIO", + "if not exist \"{buildDir}\\openColorIO\\luts\" mkdir {buildDir}\\openColorIO\\luts", + "copy ..\\OpenColorIO-Configs-1.0_r2\\nuke-default\\config.ocio {buildDir}\\openColorIO", + "xcopy /s /e /h /y /i ..\\OpenColorIO-Configs-1.0_r2\\nuke-default\\luts {buildDir}\\openColorIO\\luts", + "copy {buildDir}\\bin\\{libraryPrefix}OpenColorIO*{sharedLibraryExtension}* {buildDir}\\lib\\", + ], + + }, } diff --git a/OpenEXR/config.py b/OpenEXR/config.py index bb9246537b..8fecd86d82 100644 --- a/OpenEXR/config.py +++ b/OpenEXR/config.py @@ -55,17 +55,74 @@ "bin/exrheader", "include/OpenEXR", - "lib/libIlmImf*{sharedLibraryExtension}*", - "lib/libIex*{sharedLibraryExtension}*", - "lib/libHalf*{sharedLibraryExtension}*", - "lib/libIlmThread*{sharedLibraryExtension}*", - "lib/libImath*{sharedLibraryExtension}*", - "lib/libPyIex*{sharedLibraryExtension}*", - "lib/libPyImath*{sharedLibraryExtension}*", - - "python/iex.so", - "python/imath.so", + "lib/{libraryPrefix}IlmImf*{sharedLibraryExtension}*", + "lib/{libraryPrefix}Iex*{sharedLibraryExtension}*", + "lib/{libraryPrefix}Half*{sharedLibraryExtension}*", + "lib/{libraryPrefix}IlmThread*{sharedLibraryExtension}*", + "lib/{libraryPrefix}Imath*{sharedLibraryExtension}*", + "lib/{libraryPrefix}PyIex*{sharedLibraryExtension}*", + "lib/{libraryPrefix}PyImath*{sharedLibraryExtension}*", + + "lib/{libraryPrefix}IlmImf*.lib", + "lib/{libraryPrefix}Iex*.lib", + "lib/{libraryPrefix}Half*.lib", + "lib/{libraryPrefix}IlmThread*.lib", + "lib/{libraryPrefix}Imath*.lib", + "lib/{libraryPrefix}PyIex*.lib", + "lib/{libraryPrefix}PyImath*.lib", + + "python/iex{pythonModuleExtension}", + "python/imath{pythonModuleExtension}", ], + "platform:windows" : { + + "variables" : { + + "cmakeGenerator" : "\"Visual Studio 16 2019\"", + + }, + + "downloads" : [ + + "https://github.com/openexr/openexr/archive/v2.4.1.zip" + + ], + + "dependencies" : [ "Python", "Boost", "Zlib" ], + + "commands" : [ + "mkdir gafferBuild", + "cd gafferBuild && cmake" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -G {cmakeGenerator}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D OPENEXR_LIB_SUFFIX=" + " -D ILMBASE_LIB_SUFFIX=" + " -D PYILMBASE_LIB_SUFFIX=" + " -D Boost_NO_SYSTEM_PATHS=TRUE" + " -D Boost_NO_BOOST_CMAKE=TRUE" + " -D BOOST_ROOT={buildDir}" + " -D Python3_ROOT_DIR={buildDir}" + " -D Python_NO_SYSTEM_PATHS=TRUE" + " -D Python3_FIND_STRATEGY=LOCATION" + " -D CMAKE_CXX_FLAGS=\"-DBOOST_ALL_NO_LIB\"" + " -D ZLIB_ROOT={buildDir}" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install", + "if not exist {buildDir}\\python mkdir {buildDir}\\python", + "copy {buildDir}\\lib\\site-packages\\iex.pyd {buildDir}\\python\\iex.pyd", + "copy {buildDir}\\lib\\site-packages\\imath.pyd {buildDir}\\python\\imath.pyd", + "copy {buildDir}\\bin\\{libraryPrefix}IlmImf*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}Iex*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}Half*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}IlmThread*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}Imath*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}PyIex*{sharedLibraryExtension}* {buildDir}\\lib\\", + "copy {buildDir}\\bin\\{libraryPrefix}PyImath*{sharedLibraryExtension}* {buildDir}\\lib\\", + ] + }, + } diff --git a/OpenEXR/patches/windows/push_pop_warnings.patch b/OpenEXR/patches/windows/push_pop_warnings.patch new file mode 100644 index 0000000000..472ca36cf0 --- /dev/null +++ b/OpenEXR/patches/windows/push_pop_warnings.patch @@ -0,0 +1,53 @@ +From 6e968ed9fefa3b61475270c6c20a05c8f091ce89 Mon Sep 17 00:00:00 2001 +From: Cary Phillips +Date: Mon, 14 Jun 2021 19:03:10 -0400 +Subject: [PATCH] Push/pop Windows warning pragma (#168) + +Signed-off-by: Cary Phillips +--- + src/Imath/ImathEuler.h | 3 ++- + src/Imath/ImathQuat.h | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/Imath/ImathEuler.h b/src/Imath/ImathEuler.h +index b88c6124..03fa6c19 100644 +--- a/IlmBase/Imath/ImathEuler.h ++++ b/IlmBase/Imath/ImathEuler.h +@@ -138,6 +138,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER + // Disable MS VC++ warnings about conversion from double to float ++#pragma warning(push) + #pragma warning(disable:4244) + #endif + +@@ -919,7 +919,7 @@ Euler::makeNear (const Euler& target) IMATH_NOEXCEPT + } + + #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER +-#pragma warning(default:4244) ++#pragma warning(pop) + #endif + + /// @endcond +diff --git a/IlmBase/Imath/ImathQuat.h b/src/Imath/ImathQuat.h +index d03a2f7a..51ef93ae 100644 +--- a/IlmBase/Imath/ImathQuat.h ++++ b/IlmBase/Imath/ImathQuat.h +@@ -65,6 +65,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER + // Disable MS VC++ warnings about conversion from double to float ++#pragma warning(push) + #pragma warning(disable:4244) + #endif + +@@ -957,7 +957,7 @@ operator* (const Vec3& v, const Quat& q) IMATH_NOEXCEPT + } + + #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER +-#pragma warning(default:4244) ++#pragma warning(pop) + #endif + + IMATH_INTERNAL_NAMESPACE_HEADER_EXIT diff --git a/OpenImageIO/config.py b/OpenImageIO/config.py index fb9c2799bd..b69216b09d 100644 --- a/OpenImageIO/config.py +++ b/OpenImageIO/config.py @@ -70,14 +70,63 @@ "manifest" : [ - "bin/maketx", - "bin/oiiotool", + "bin/maketx{executableExtension}", + "bin/oiiotool{executableExtension}", "include/OpenImageIO", - "lib/libOpenImageIO*{sharedLibraryExtension}*", + "lib/{libraryPrefix}OpenImageIO*{sharedLibraryExtension}*", + "lib/{libraryPrefix}OpenImageIO*.lib", "doc/openimageio.pdf", ], + "platform:windows" : { + + "environment" : { + + "PATH" : "{buildDir}/bin;{buildDir}/lib;%PATH%", + + }, + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_CXX_STANDARD={c++Standard}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDirFwd}" + " -D CMAKE_PREFIX_PATH={buildDirFwd}" + " -D USE_FFMPEG=NO" + " -D USE_QT=NO" + " -D USE_PYTHON=YES" + " -D BUILDSTATIC=NO" + " -D BOOST_ROOT={buildDirFwd}" + " -D OIIO_BUILD_TESTS=NO" + " -D OIIO_DOWNLOAD_MISSING_TESTDATA=NO" + " -D OPENEXR_INCLUDE_PATH={buildDirFwd}/include" + " -D OPENEXR_IMATH_LIBRARY={buildDirFwd}/lib/Imath.lib" + " -D OPENEXR_ILMIMF_LIBRARY={buildDirFwd}/lib/IlmImf.lib" + " -D OPENEXR_IEX_LIBRARY={buildDirFwd}/lib/Iex.lib" + " -D OPENEXR_ILMTHREAD_LIBRARY={buildDirFwd}/lib/IlmThread.lib" + " -D ZLIB_INCLUDE_DIR={buildDirFwd}/include" + " -D ZLIB_LIBRARY={buildDirFwd}/lib/zlib.lib" + " -D PNG_PNG_INCLUDE_DIR={buildDirFwd}/include" + " -D PNG_LIBRARY={buildDirFwd}/lib/libpng16.lib" + " -D JPEG_INCLUDE_DIR={buildDirFwd}/include" + " -D JPEG_LIBRARY={buildDirFwd}/lib/jpeg.lib" + " -D TIFF_INCLUDE_DIR={buildDirFwd}/include" + " -D TIFF_LIBRARY={buildDirFwd}/lib/libtiff.lib" + " -D PYTHON_INCLUDE_DIR={pythonIncludeDir}" + " -D PYTHON_LIBRARY={pythonLibDir}/python{pythonMajorVersion}{pythonMinorVersion}.lib" + " -D OCIO_LIBRARY_PATH={buildDirFwd}/lib/OpenColorIO.lib" + " -D USE_SIMD=sse4.2" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}OpenImageIO*{sharedLibraryExtension}* {buildDir}\\lib\\", + ] + + } } diff --git a/OpenJPEG/config.py b/OpenJPEG/config.py index a982f0141a..aa4acad4a1 100644 --- a/OpenJPEG/config.py +++ b/OpenJPEG/config.py @@ -25,8 +25,29 @@ "manifest" : [ "include/openjpeg-2.4", - "lib/libopenjp2*{sharedLibraryExtension}*", + "lib/{libraryPrefix}openjp2*{sharedLibraryExtension}*", + "lib/{libraryPrefix}openjp2*{staticLibraryExtension}", ], + "platform:windows" : { + + "commands" : [ + + "mkdir build", + "cd build &&" + " cmake" + " -W-nodev -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D BUILD_SHADER_LIBS=on" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " ..", + "cd build && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}openjp2*{sharedLibraryExtension}* {buildDir}\\lib\\", + + ] + + } + } diff --git a/OpenSSL/config.py b/OpenSSL/config.py index 7555c0ecc8..9417d4483e 100644 --- a/OpenSSL/config.py +++ b/OpenSSL/config.py @@ -20,6 +20,8 @@ "manifest" : [ + # The "lib" prefix is correct for all platforms + "lib/libssl*{sharedLibraryExtension}*", "lib/libcrypto*{sharedLibraryExtension}*", @@ -35,4 +37,13 @@ }, + "platform:windows" : { + + # Python builds it's own OpenSSL that we don't want to conflict with + + "manifest" : [], + "commands" : [], + + }, + } diff --git a/OpenShadingLanguage/config.py b/OpenShadingLanguage/config.py index 3597cf27c4..a68e7b13a5 100644 --- a/OpenShadingLanguage/config.py +++ b/OpenShadingLanguage/config.py @@ -46,14 +46,66 @@ "manifest" : [ - "bin/oslc", - "bin/oslinfo", + "bin/oslc{executableExtension}", + "bin/oslinfo{executableExtension}", "include/OSL", - "lib/libosl*", + "lib/{libraryPrefix}osl*", "lib/osl.imageio.*", "doc/osl*", "shaders", ], + "platform:windows" : { + + "variables" : { + + "version" : "1.11.11.0", + + }, + + "environment" : { + "PATH" : "{buildDir}\\lib;{buildDir}\\bin;%ROOT_DIR%\\OpenShadingLanguage\\working\\OpenShadingLanguage-Release-{version}\\gafferBuild\\src\\liboslcomp;%ROOT_DIR%\\OpenShadingLanguage\\working\\OpenShadingLanguage-Release-{version}\\gafferBuild\\src\\oslc;%PATH%", + + }, + + "commands" : [ + "mkdir gafferBuild", + "cd gafferBuild &&" + " cmake" + " -Wno-dev -G {cmakeGenerator}" + " -D CMAKE_CXX_STANDARD={c++Standard}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D BUILDSTATIC=OFF" + " -D USE_OIIO_STATIC=OFF" + " -D OSL_BUILD_PLUGINS=OFF" + " -D ENABLERTTI=1" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D STOP_ON_WARNING=0" + " -D LLVM_DIRECTORY={buildDir}" + " -D USE_LLVM_BITCODE=OFF" + " -D OSL_BUILD_TESTS=OFF" + " -D BOOST_ROOT={buildDir}" + " -D Boost_USE_STATIC_LIBS=OFF" + " -D LLVM_STATIC=ON" + " -D OPENEXR_INCLUDE_PATH={buildDir}\\include" + " -D OPENEXR_IMATH_LIBRARY={buildDir}\\lib\\Imath.lib" + " -D OPENEXR_ILMIMF_LIBRARY={buildDir}\\lib\\IlmImf.lib" + " -D OPENEXR_IEX_LIBRARY={buildDir}\\lib\\Iex.lib" + " -D OPENEXR_ILMTHREAD_LIBRARY={buildDir}\\lib\\IlmThread.lib" + " -D OPENIMAGEIOHOME={buildDir}" + " -D ZLIB_INCLUDE_DIR={buildDir}\\include" + " -D ZLIB_LIBRARY={buildDir}\\lib\\zlib.lib" + " -D EXTRA_CPP_ARGS=\" /D TINYFORMAT_ALLOW_WCHAR_STRINGS\"" + " -D OSL_BUILD_MATERIALX=1" + " -D OSL_SHADER_INSTALL_DIR={buildDir}\\shaders" + " -D CMAKE_CXX_FLAGS=\"-DBOOST_ALL_NO_LIB\"" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}osl* {buildDir}\\lib\\", + + ], + + } } diff --git a/OpenShadingLanguage/patches/llvmCompileFlagsMac.patch b/OpenShadingLanguage/patches/osx/llvmCompileFlagsMac.patch similarity index 100% rename from OpenShadingLanguage/patches/llvmCompileFlagsMac.patch rename to OpenShadingLanguage/patches/osx/llvmCompileFlagsMac.patch diff --git a/OpenSubdiv/config.py b/OpenSubdiv/config.py index d34a6368bf..7e474445fd 100644 --- a/OpenSubdiv/config.py +++ b/OpenSubdiv/config.py @@ -13,6 +13,7 @@ "commands" : [ "cmake" + " -G {cmakeGenerator}" " -D CMAKE_INSTALL_PREFIX={buildDir}" " -D CMAKE_PREFIX_PATH={buildDir}" " -D NO_DOC=1" @@ -28,8 +29,7 @@ " ." , - "make VERBOSE=1 -j {jobs}", - "make install", + "cmake --build . --config {cmakeBuildType} --target install -- VERBOSE=1 -j {jobs}", ], @@ -40,4 +40,35 @@ ], + "platform:windows" : { + + "variables" : { + "cmakeGenerator" : "\"Visual Studio 16 2019\"", + }, + + "commands" : [ + + "cmake" + " -G {cmakeGenerator}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D NO_DOC=1" + " -D NO_OMP=1" + " -D NO_CUDA=1" + " -D NO_OPENCL=1" + " -D NO_GLEW=1" + " -D NO_GLFW=1" + " -D NO_DX=1" + " -D NO_TESTS=1" + " -D NO_TBB=1" + " -D OPENEXR_LOCATION={buildDir}/lib" + " ." + , + + "cmake --build . --config {cmakeBuildType} --target install", + + ], + + }, + } diff --git a/OpenVDB/config.py b/OpenVDB/config.py index 2dc1169d31..67212cb8fa 100644 --- a/OpenVDB/config.py +++ b/OpenVDB/config.py @@ -50,9 +50,48 @@ "include/openvdb", "include/pyopenvdb.h", "include/nanovdb", - "lib/libopenvdb*{sharedLibraryExtension}*", + "lib/{libraryPrefix}openvdb*{sharedLibraryExtension}*", + "lib/{libraryPrefix}openvdb*.lib", "python/pyopenvdb*", ], + "platform:windows" : { + + "variables" : { + + "cmakeGenerator" : "\"Visual Studio 16 2019\"", + }, + + "commands" : [ + # OpenVDB requests Python 2.7 specifically but Boost doesn't add version numbers until v1.67 + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -Wno-dev" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D OPENVDB_BUILD_UNITTESTS=OFF" + " -D OPENVDB_BUILD_DOCS=OFF" + " -D OPENVDB_BUILD_PYTHON_MODULE=ON" + " -D OPENVDB_BUILD_NANOVDB=ON" + " -D USE_GLFW3=OFF" + " -D TBB_LOCATION={buildDir}" + " -D BOOST_ROOT={buildDir}" + " -D GLEW_LOCATION={buildDir}" + " -D ILMBASE_LOCATION={buildDir}" + " -D OPENEXR_LOCATION={buildDir}" + " -D BLOSC_LOCATION={buildDir}" + " -D OPENVDB_ENABLE_3_ABI_COMPATIBLE=OFF" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install", + "move {buildDir}\\bin\\{libraryPrefix}openvdb*{sharedLibraryExtension}* {buildDir}\\lib\\", + "move {buildDir}\\lib\\python{pythonVersion}\\site-packages\\pyopenvdb.pyd {buildDir}\\python\\pyopenvdb.pyd", + "move {buildDir}\\lib\\python{pythonVersion}\\site-packages\\pyopenvdb*.lib {buildDir}\\lib\\" + ], + + }, + } diff --git a/OpenVDB/patches/windows/0001-fix_duplicate_exports.patch b/OpenVDB/patches/windows/0001-fix_duplicate_exports.patch new file mode 100644 index 0000000000..958b8c74ff --- /dev/null +++ b/OpenVDB/patches/windows/0001-fix_duplicate_exports.patch @@ -0,0 +1,13 @@ +--- a/./openvdb/openvdb/python/pyOpenVDBModule.cc ++++ b/./openvdb/openvdb/python/pyOpenVDBModule.cc +@@ -804,10 +804,8 @@ struct VecTypeDescr + + #ifdef DWA_OPENVDB + #define PY_OPENVDB_MODULE_NAME _openvdb +-extern "C" { void init_openvdb(); } + #else + #define PY_OPENVDB_MODULE_NAME pyopenvdb +-extern "C" { void initpyopenvdb(); } + #endif + + BOOST_PYTHON_MODULE(PY_OPENVDB_MODULE_NAME) diff --git a/PugiXML/config.py b/PugiXML/config.py index 6a253bfa39..12bf9b2a2d 100644 --- a/PugiXML/config.py +++ b/PugiXML/config.py @@ -21,4 +21,29 @@ ], + "platform:windows" : { + + "environment" : { + + "PATH" : "{buildDir}\\bin;%PATH%" + + }, + + # using nmake instead of make causes an error "Makefile:35 missing separator. Stop." + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild &&" + " cmake" + " -Wno-dev -G {cmakeGenerator}" + " -D CMAKE_CXX_STANDARD={c++Standard}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -j {jobs}", + + ], + + }, + } diff --git a/PyBind11/config.py b/PyBind11/config.py index de0ba82da8..f96e11ec6d 100644 --- a/PyBind11/config.py +++ b/PyBind11/config.py @@ -22,6 +22,7 @@ "commands" : [ "cmake" + " -G {cmakeGenerator}" " -D CMAKE_INSTALL_PREFIX={buildDir} ." " -D PYBIND11_TEST=0" " -D PYBIND11_FINDPYTHON=1" @@ -37,4 +38,25 @@ ], + "platform:windows" : { + + "environment" : { + + "PATH" : "{buildDir}\\bin;%PATH%" + + }, + + # using make instead of nmake causes an error "Makefile:35 missing separator. Stop." + "commands" : [ + + "cmake" + " -G {cmakeGenerator}" + " -D CMAKE_INSTALL_PREFIX={buildDir} ." + " -D PYBIND11_TEST=0", + "nmake install", + + ], + + }, + } diff --git a/PyOpenGL/config.py b/PyOpenGL/config.py index a246193ef3..0248e3a6f2 100644 --- a/PyOpenGL/config.py +++ b/PyOpenGL/config.py @@ -31,6 +31,16 @@ "python/OpenGL", ], + + "platform:windows" : { + + "commands" : [ + + "{buildDir}\\bin\\python setup.py install {extraArgs} --root / --prefix {buildDir} --install-lib {buildDir}\\python", + + ] + + }, "variables" : { diff --git a/PySide/config.py b/PySide/config.py index 8b7e928c74..af79f9749f 100644 --- a/PySide/config.py +++ b/PySide/config.py @@ -25,6 +25,14 @@ ], + "manifest" : [ + + "include/PySide2", + "lib/python{pythonVersion}/site-packages/PySide2", + "lib/python{pythonVersion}/site-packages/pyside2uic", + + ], + "platform:linux" : { "environment" : { @@ -51,4 +59,47 @@ }, + "platform:windows" : { + + "downloads" : [ + + # Avoids a symlink introduced in 5.15.4 that causes a warning that causes build.py to make a poor decision when testing `len( dirs ) == 1` + "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.15.4-src/pyside-setup-opensource-src-5.15.4.zip" + + ], + + "manifest" : [ + + "include/PySide2", + "python/PySide2", + "python/pyside2uic", + "python/shiboken2", + "python/shiboken2_generator", + + ], + + "environment" : { + + "PATH" : "{buildDir}\\bin;{buildDir}\\lib;%PATH%", + "VERSION" : "", # PySide will pull in VERSION from the environment if it exists and cause a failure because the --ignore-git conflicts with VERSION + + }, + + "commands" : [ + "xcopy /s /e /h /y /i %ROOT_DIR%\\PySide\\working\\pyside-setup-opensource-src-5.15.4 %ROOT_DIR%\\PySide\\working\\p", # Shorten overall paths to avoid Windows command character limit + "cd ..\\p && python setup.py install" + " --ignore-git" + " --qmake=%BUILD_DIR%\\bin\\qmake.exe" + " --openssl={buildDir}\\lib" + " --cmake=\"C:\\Program Files\\CMake\\bin\\cmake.exe\"" + " --parallel {jobs}" + " --no-examples", + + "xcopy /s /e /h /y /i {buildDir}\\lib\\site-packages\\PySide2 {buildDir}\\python\\PySide2", + "xcopy /s /e /h /y /i {buildDir}\\lib\\site-packages\\shiboken2 {buildDir}\\python\\shiboken2", + "xcopy /s /e /h /y /i {buildDir}\\lib\\site-packages\\shiboken2_generator {buildDir}\\python\\shiboken2_generator", + + ] + }, + } diff --git a/PySide/patches/ezSetupRedirect.patch b/PySide/patches/linux/ezSetupRedirect.patch similarity index 100% rename from PySide/patches/ezSetupRedirect.patch rename to PySide/patches/linux/ezSetupRedirect.patch diff --git a/PySide/patches/compilerFromCMake.patch b/PySide/patches/osx/compilerFromCMake.patch similarity index 100% rename from PySide/patches/compilerFromCMake.patch rename to PySide/patches/osx/compilerFromCMake.patch diff --git a/Python/config.py b/Python/config.py index 4e9b518473..83d23d6316 100644 --- a/Python/config.py +++ b/Python/config.py @@ -33,12 +33,12 @@ "manifest" : [ - "bin/python", - "bin/python*[0-9]", + "bin/python{executableExtension}", + "bin/python*[0-9]{executableExtension}", "include/python*", - "lib/libpython*{sharedLibraryExtension}*", + "lib/{libraryPrefix}python*{sharedLibraryExtension}*", "lib/Python.framework*", "lib/python{pythonVersion}", @@ -80,10 +80,10 @@ "publicVariables" : { "pythonVersion" : "3.7", - # Python 3 unconditionally puts these infuriating "m" ABI suffixes on - # everything. This is intended to allow different types of Python builds - # to exist in the same place, but that's not a problem we have. The problem - # we _do_ have is that a bunch of our projects get tripped up by these + # On POSIX systems, Python 3 unconditionally puts these infuriating "m" ABI + # suffixes on everything. This is intended to allow different types of Python + # builds to exist in the same place, but that's not a problem we have. The + # problem we _do_ have is that a bunch of our projects get tripped up by these # suffixes. See : https://www.python.org/dev/peps/pep-3149. "pythonABIVersion" : "3.7m", "pythonMajorVersion" : "3", @@ -91,11 +91,19 @@ }, - "symbolicLinks" : [ + }, - ( "{buildDir}/bin/python", "python3" ), + "platform:linux" : { - ], + "variant:3" : { + + "symbolicLinks" : [ + + ( "{buildDir}/bin/python", "python3" ), + + ], + + } }, @@ -145,4 +153,383 @@ }, + "platform:windows" : { + + "publicVariables" : { + + "pythonIncludeDir" : "{buildDirFwd}/include", + "pythonLibDir" : "{buildDirFwd}/libs", + + }, + + "manifest" : [ + + "bin/python{executableExtension}", + "bin/{libraryPrefix}python*{sharedLibraryExtension}*", + + "lib/{libraryPrefix}python*.lib", + "lib/python{pythonVersion}", + + "libs", + + "DLLs", + + # Gross. But here's the reasoning for now: we can't put the modules into a directory + # like `lib` as on Linux because it causes havoc with cmake finding the site-packages + # directory for downstream projects that need to install their Python modules. + # If we just do `Lib/*` then the packager will sweep up everything in the `lib` + # folder at the end of the entire dependencies build, not at the time Python is built. + # So for now to come up with this list, do a build of just Python, and then a simple + # Python script or similar to get a list of everything in the `lib` folder. + "Lib/abc.py", + "Lib/aifc.py", + "Lib/antigravity.py", + "Lib/argparse.py", + "Lib/ast.py", + "Lib/asynchat.py", + "Lib/asyncio", + "Lib/asyncore.py", + "Lib/base64.py", + "Lib/bdb.py", + "Lib/binhex.py", + "Lib/bisect.py", + "Lib/bz2.py", + "Lib/calendar.py", + "Lib/cgi.py", + "Lib/cgitb.py", + "Lib/chunk.py", + "Lib/cmd.py", + "Lib/code.py", + "Lib/codecs.py", + "Lib/codeop.py", + "Lib/collections", + "Lib/colorsys.py", + "Lib/compileall.py", + "Lib/concurrent", + "Lib/configparser.py", + "Lib/contextlib.py", + "Lib/contextvars.py", + "Lib/copy.py", + "Lib/copyreg.py", + "Lib/cProfile.py", + "Lib/crypt.py", + "Lib/csv.py", + "Lib/ctypes", + "Lib/curses", + "Lib/dataclasses.py", + "Lib/datetime.py", + "Lib/dbm", + "Lib/decimal.py", + "Lib/difflib.py", + "Lib/dis.py", + "Lib/distutils", + "Lib/doctest.py", + "Lib/dummy_threading.py", + "Lib/email", + "Lib/encodings", + "Lib/enum.py", + "Lib/filecmp.py", + "Lib/fileinput.py", + "Lib/fnmatch.py", + "Lib/formatter.py", + "Lib/fractions.py", + "Lib/ftplib.py", + "Lib/functools.py", + "Lib/genericpath.py", + "Lib/getopt.py", + "Lib/getpass.py", + "Lib/gettext.py", + "Lib/glob.py", + "Lib/gzip.py", + "Lib/hashlib.py", + "Lib/heapq.py", + "Lib/hmac.py", + "Lib/html", + "Lib/http", + "Lib/imaplib.py", + "Lib/imghdr.py", + "Lib/imp.py", + "Lib/importlib", + "Lib/inspect.py", + "Lib/io.py", + "Lib/ipaddress.py", + "Lib/json", + "Lib/keyword.py", + "Lib/lib2to3", + "Lib/linecache.py", + "Lib/locale.py", + "Lib/logging", + "Lib/lzma.py", + "Lib/macpath.py", + "Lib/mailbox.py", + "Lib/mailcap.py", + "Lib/mimetypes.py", + "Lib/modulefinder.py", + "Lib/msilib", + "Lib/multiprocessing", + "Lib/netrc.py", + "Lib/nntplib.py", + "Lib/ntpath.py", + "Lib/nturl2path.py", + "Lib/numbers.py", + "Lib/opcode.py", + "Lib/operator.py", + "Lib/optparse.py", + "Lib/os.py", + "Lib/pathlib.py", + "Lib/pdb.py", + "Lib/pickle.py", + "Lib/pickletools.py", + "Lib/pipes.py", + "Lib/pkgutil.py", + "Lib/platform.py", + "Lib/plistlib.py", + "Lib/poplib.py", + "Lib/posixpath.py", + "Lib/pprint.py", + "Lib/profile.py", + "Lib/pstats.py", + "Lib/pty.py", + "Lib/pyclbr.py", + "Lib/pydoc.py", + "Lib/pydoc_data", + "Lib/py_compile.py", + "Lib/queue.py", + "Lib/quopri.py", + "Lib/random.py", + "Lib/re.py", + "Lib/reprlib.py", + "Lib/rlcompleter.py", + "Lib/runpy.py", + "Lib/sched.py", + "Lib/secrets.py", + "Lib/selectors.py", + "Lib/shelve.py", + "Lib/shlex.py", + "Lib/shutil.py", + "Lib/signal.py", + "Lib/site-packages", + "Lib/site.py", + "Lib/smtpd.py", + "Lib/smtplib.py", + "Lib/sndhdr.py", + "Lib/socket.py", + "Lib/socketserver.py", + "Lib/sqlite3", + "Lib/sre_compile.py", + "Lib/sre_constants.py", + "Lib/sre_parse.py", + "Lib/ssl.py", + "Lib/stat.py", + "Lib/statistics.py", + "Lib/string.py", + "Lib/stringprep.py", + "Lib/struct.py", + "Lib/subprocess.py", + "Lib/sunau.py", + "Lib/symbol.py", + "Lib/symtable.py", + "Lib/sysconfig.py", + "Lib/tabnanny.py", + "Lib/tarfile.py", + "Lib/telnetlib.py", + "Lib/tempfile.py", + "Lib/textwrap.py", + "Lib/this.py", + "Lib/threading.py", + "Lib/timeit.py", + "Lib/token.py", + "Lib/tokenize.py", + "Lib/trace.py", + "Lib/traceback.py", + "Lib/tracemalloc.py", + "Lib/tty.py", + "Lib/types.py", + "Lib/typing.py", + "Lib/unittest", + "Lib/urllib", + "Lib/uu.py", + "Lib/uuid.py", + "Lib/warnings.py", + "Lib/wave.py", + "Lib/weakref.py", + "Lib/webbrowser.py", + "Lib/wsgiref", + "Lib/xdrlib.py", + "Lib/xml", + "Lib/xmlrpc", + "Lib/zipapp.py", + "Lib/zipfile.py", + "Lib/_bootlocale.py", + "Lib/_collections_abc.py", + "Lib/_compat_pickle.py", + "Lib/_compression.py", + "Lib/_dummy_thread.py", + "Lib/_markupbase.py", + "Lib/_osx_support.py", + "Lib/_pydecimal.py", + "Lib/_pyio.py", + "Lib/_py_abc.py", + "Lib/_sitebuiltins.py", + "Lib/_strptime.py", + "Lib/_threading_local.py", + "Lib/_weakrefset.py", + "Lib/__future__.py", + "Lib/__phello__.foo.py", + "Lib/__pycache__", + + # Double gross. Python on Windows seems pretty insistent on having the + # includes in the `include` directory, not a subdirectory. Many of the + # GafferDependencies projects can handle it in a subdirectory, but + # PySide and perhaps others can't. There's also a good change putting + # includes in a subdirectory would break installing things with pip + # or setuptools (the distutils.sysconfig.get_config_var("INCLUDEPY") will + # return the wrong value if the includes are located anywhere except `include`) + "include/abstract.h", + "include/accu.h", + "include/asdl.h", + "include/ast.h", + "include/bitset.h", + "include/bltinmodule.h", + "include/boolobject.h", + "include/bytearrayobject.h", + "include/bytesobject.h", + "include/bytes_methods.h", + "include/cellobject.h", + "include/ceval.h", + "include/classobject.h", + "include/code.h", + "include/codecs.h", + "include/compile.h", + "include/complexobject.h", + "include/context.h", + "include/datetime.h", + "include/descrobject.h", + "include/dictobject.h", + "include/dtoa.h", + "include/dynamic_annotations.h", + "include/enumobject.h", + "include/errcode.h", + "include/eval.h", + "include/fileobject.h", + "include/fileutils.h", + "include/floatobject.h", + "include/frameobject.h", + "include/funcobject.h", + "include/genobject.h", + "include/graminit.h", + "include/grammar.h", + "include/import.h", + "include/intrcheck.h", + "include/iterobject.h", + "include/listobject.h", + "include/longintrepr.h", + "include/longobject.h", + "include/marshal.h", + "include/memoryobject.h", + "include/metagrammar.h", + "include/methodobject.h", + "include/modsupport.h", + "include/moduleobject.h", + "include/namespaceobject.h", + "include/node.h", + "include/object.h", + "include/objimpl.h", + "include/odictobject.h", + "include/opcode.h", + "include/osdefs.h", + "include/osmodule.h", + "include/parsetok.h", + "include/patchlevel.h", + "include/pgen.h", + "include/pgenheaders.h", + "include/pyarena.h", + "include/pyatomic.h", + "include/pycapsule.h", + "include/pyconfig.h", + "include/pyctype.h", + "include/pydebug.h", + "include/pydtrace.h", + "include/pyerrors.h", + "include/pyexpat.h", + "include/pyfpe.h", + "include/pyhash.h", + "include/pylifecycle.h", + "include/pymacconfig.h", + "include/pymacro.h", + "include/pymath.h", + "include/pymem.h", + "include/pyport.h", + "include/pystate.h", + "include/pystrcmp.h", + "include/pystrhex.h", + "include/pystrtod.h", + "include/Python-ast.h", + "include/Python.h", + "include/pythonrun.h", + "include/pythread.h", + "include/pytime.h", + "include/py_curses.h", + "include/rangeobject.h", + "include/setobject.h", + "include/sliceobject.h", + "include/structmember.h", + "include/structseq.h", + "include/symtable.h", + "include/sysmodule.h", + "include/token.h", + "include/traceback.h", + "include/tupleobject.h", + "include/typeslots.h", + "include/ucnhash.h", + "include/unicodeobject.h", + "include/warnings.h", + "include/weakrefobject.h", + + # `lib` prefix is correct for Windows + "DLLs/libssl*{sharedLibraryExtension}*", + "DLLs/libcrypto*{sharedLibraryExtension}*", + ], + + "commands" : [ + + "call PCbuild/build.bat -p x64 --no-tkinter \"/p:PlatformToolset=v142\"", + + # Recreate the typical Python 3 directory structure + "if not exist {buildDir}\\DLLs mkdir {buildDir}\\DLLs", + "if not exist {buildDir}\\bin mkdir {buildDir}\\bin", + "if not exist {buildDir}\\lib mkdir {buildDir}\\lib", + "if exist {buildDir}\\libs rmdir /Q /S {buildDir}\\libs", + "if not exist {buildDir}\\include mkdir {buildDir}\\include", + "if exist {buildDir}\\include\\openssl rmdir /S /Q {buildDir}\\include\\openssl", + "mkdir {buildDir}\\include\\openssl", + + # Initially copy all components to `DLLs` to avoid needing to copy + # individual DLL files later + "PCbuild\\amd64\\python.exe PC\\layout -s . -b PCbuild\\amd64 -v --precompile --flat-dlls --include-pip --include-dev --copy {buildDir}\\DLLs", + + "xcopy /sehyi {buildDir}\\DLLs\\include {buildDir}\\include", + "xcopy /sehyi {buildDir}\\DLLs\\Lib {buildDir}\\lib", + "move {buildDir}\\DLLs\\libs {buildDir}", + + "rmdir /Q /S {buildDir}\\DLLs\\include", + "rmdir /Q /S {buildDir}\\DLLs\\Lib", + + "move {buildDir}\\DLLs\\python.exe {buildDir}\\bin", + "move {buildDir}\\DLLs\\python{pythonMajorVersion}{pythonMinorVersion}.dll {buildDir}\\bin", + # pythonw runs a script without an accompanying terminal which means we don't get + # stdout, stderr, etc. + "del {buildDir}\\DLLs\\pythonw.exe", + "del {buildDir}\\DLLs\\LICENSE.txt", # build.py puts the license in the right place + + # Grab OpenSSL libs from the Python externals (needed by PySide2) + "copy externals\\openssl-bin-1.1.1d\\amd64\\libcrypto.lib {buildDir}\\lib", + "copy externals\\openssl-bin-1.1.1d\\amd64\\libssl.lib {buildDir}\\lib", + "xcopy /sehyi externals\\openssl-bin-1.1.1d\\amd64\\include\\openssl\\* {buildDir}\\include\\openssl", + + + ], + + } + } diff --git a/Python/patches/windows/9cc9e277254023c0ca08e1a9e379fd89475ca9c2.patch b/Python/patches/windows/9cc9e277254023c0ca08e1a9e379fd89475ca9c2.patch new file mode 100644 index 0000000000..9ee9e4c565 --- /dev/null +++ b/Python/patches/windows/9cc9e277254023c0ca08e1a9e379fd89475ca9c2.patch @@ -0,0 +1,31 @@ +From 9cc9e277254023c0ca08e1a9e379fd89475ca9c2 Mon Sep 17 00:00:00 2001 +From: Steve Dower +Date: Mon, 16 Nov 2020 23:22:42 +0000 +Subject: [PATCH] bpo-42120: Remove macro defining copysign to _copysign on + Windows (GH-23326) + +--- + .../NEWS.d/next/Windows/2020-11-16-22-41-02.bpo-42120.9scgko.rst | 1 + + PC/pyconfig.h | 1 - + 2 files changed, 1 insertion(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Windows/2020-11-16-22-41-02.bpo-42120.9scgko.rst + +diff --git a/Misc/NEWS.d/next/Windows/2020-11-16-22-41-02.bpo-42120.9scgko.rst b/Misc/NEWS.d/next/Windows/2020-11-16-22-41-02.bpo-42120.9scgko.rst +new file mode 100644 +index 0000000000000..c574956d11d93 +--- /dev/null ++++ b/Misc/NEWS.d/next/Windows/2020-11-16-22-41-02.bpo-42120.9scgko.rst +@@ -0,0 +1 @@ ++Remove macro definition of ``copysign`` (to ``_copysign``) in headers. +diff --git a/PC/pyconfig.h b/PC/pyconfig.h +index b29f63c35bccb..592b487adcb45 100644 +--- a/PC/pyconfig.h ++++ b/PC/pyconfig.h +@@ -193,7 +193,6 @@ typedef int pid_t; + #define Py_IS_NAN _isnan + #define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X)) + #define Py_IS_FINITE(X) _finite(X) +-#define copysign _copysign + + /* define some ANSI types that are not defined in earlier Win headers */ + #if _MSC_VER >= 1200 diff --git a/Qt.py/config.py b/Qt.py/config.py index 610702fa85..a822638578 100644 --- a/Qt.py/config.py +++ b/Qt.py/config.py @@ -23,4 +23,14 @@ ], -} + "platform:windows" : { + + "commands" : [ + + "copy Qt.py {buildDir}\\python", + + ] + + } + +} \ No newline at end of file diff --git a/Qt/config.py b/Qt/config.py index e5e96b9a49..bcf9321c28 100644 --- a/Qt/config.py +++ b/Qt/config.py @@ -49,14 +49,14 @@ "manifest" : [ - "bin/moc", - "bin/qmake", - "bin/rcc", - "bin/uic", + "bin/moc{executableExtension}", + "bin/qmake{executableExtension}", + "bin/rcc{executableExtension}", + "bin/uic{executableExtension}", "include/Qt*", - "lib/libQt*", + "lib/{libraryPrefix}Qt*", "lib/Qt*.framework", "mkspecs", @@ -91,4 +91,59 @@ }, + "platform:windows" : { + + "environment" : { + + "PATH" : "%ROOT_DIR%\\Qt\\working\\qt-everywhere-src-5.15.4\\qtbase\\lib;{buildDir}\\lib;{buildDir}\\bin;%PATH%", + + }, + + "commands" : [ + + "copy {buildDir}\\lib\\zlib.lib {buildDir}\\lib\\zdll.lib", + "copy {buildDir}\\lib\\libpng16.lib {buildDir}\\lib\\libpng.lib", + "copy {buildDir}\\lib\\jpeg.lib {buildDir}\\lib\\libjpeg.lib", + # help Qt find the right zlib.dll + "copy {buildDir}\\bin\\zlib.dll %ROOT_DIR%\\Qt\\working\\qt-everywhere-src-5.15.4\\qtbase\\bin\\zlib.dll", + "call configure.bat" + " -prefix {buildDir}" + " -plugindir {buildDir}\\qt\\plugins" + " -release" + " -opensource" + " -confirm-license" + " -opengl desktop" + " -no-angle" + " -no-rpath" + " -no-dbus" + " -skip qt3d" + " -skip qtcharts" + " -skip qtconnectivity" + " -skip qtdatavis3d" + " -skip qtdeclarative" + " -skip qtgamepad" + " -skip qtnetworkauth" + " -skip qtpurchasing" + " -skip qtremoteobjects" + " -skip qtsensors" + " -skip qtserialbus" + " -skip qtserialport" + " -skip qtspeech" + " -skip qtwebchannel" + " -skip qtwebengine" + " -no-libudev" + " -no-icu" + " -qt-pcre" + " -nomake examples" + " -nomake tests" + " -system-zlib" + " -I {buildDir}\\include" + " -L {buildDir}\\lib", + "jom.exe", + "jom.exe install", + "copy {buildDir}\\bin\\{libraryPrefix}Qt* {buildDir}\\lib\\", + + ] + } + } diff --git a/README.md b/README.md index 4032fa3775..3827acbcf4 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,35 @@ We strongly recommend using the precompiled binaries as described above, but if Since the build covers so many different projects, it requires the installation of several common software development tools, most of which should be installed by default on a typical developer machine. They include (but are probably not limited to) : +#### Linux and OS X - Make - CMake - SCons - libbz2 (and headers) See https://github.com/GafferHQ/build for a Docker container which contains all necessary prerequisites. +#### Windows +- It is recommended to enable long path support on Windows. Some packages like Boost have heavily nested directory structures that may exceed the default 260 character limit. Python 3 installers offer a convenient option to enable long paths after installation, or you can follow Microsoft's recommendations: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation. +- Microsoft Visual Studio 2017 (Community edition is a free version that is known to work) +- CMake (test with version 3.15.7) +- Python 3.6.xx +- Git +- Jom + - Available from Qt: https://wiki.qt.io/Jom + - Ensure the installation directory is included in your PATH +- Cygwin packages + - Bison + - Flex + - NASM + - autoconf + - gawk + - grep + - sed + - patch + - __Flex and Bison should not be installed in a path that contains spaces.__ This includes the installer default (C:\\Program Files (x86)\\) Doing so will prevent Open Shading Language from building. +- Perl with Windows-compatible slash directions + - Strawberry Perl (strawberryperl.com) is an open-source option. + - __The Perl installed by Cygwin is not suitable.__ It will fail to build OpenSSL correctly, but it is required for autoconf. __You must have Strawberry Perl (or a compatible alternative) in your PATH environment variable before your Cygwin binaries path.__ Otherwise the OpenSSL build will fail when attempting configuration. ### Invoking the build @@ -31,20 +54,35 @@ The build is controlled by several environment variables, which must be set up b - ARNOLD_ROOT : Path to the root of an Arnold installation - RMAN_ROOT : Path to the root of a 3delight installation -The build is then initiated with `build.py`, which should be run from the root directory of the project : +#### Linux and OS X +The build is then initiated using a Python script, which should be run from the root directory of the project : ``` -./build.py --buildDir /path/to/build +./build.py --buildDir /path/to/build --projects TBB ``` -Subsets of the dependencies can be built using the `--projects` command line argument : +Variants are specified using the `--variant:` command line arguments : ``` -./build.py --buildDir /path/to/build --projects TBB +./build.py --buildDir /path/to/build --variants:Python 3 ``` +#### Windows +The build is then initiated using the "x64 Native Tools Command Prompt" for Visual Studio 2017. This is a special command prompt that sets up all of the environment variables for Visual Studio to find the various tools needed for building. It is installed with Visual Studio and is accessible from the start menu under Visual Studio 2017. -Variants are specified using the `--variant:` command line arguments : +Individual packages and variants are built using the build.py script in the manner as Linux and OS X dependencies. +#### Universal Python Builder +Some packages are built using a common Python script and configuration settings for each package. These are built by calling the build.py script in the "build" directory (for all of Linux, OS X and Windows) and specifying the package to build and the build directory. + +For example, to build Boost on Linux and OS X and you would run: ``` -./build.py --buildDir /path/to/build --variants:Python 3 +./build/build.py --project Boost --buildDir $BUILD_DIR +``` +and on Windows : +``` +python build/build.py --project Boost --buildDir %BUILD_DIR% +``` +A list of projects that have are built using this script is shown if you run ``` +./build/build.py +``` \ No newline at end of file diff --git a/Six/config.py b/Six/config.py index d6845d4d04..d98cde304b 100644 --- a/Six/config.py +++ b/Six/config.py @@ -24,4 +24,15 @@ ], + "platform:windows" : { + + "commands" : [ + + "if not exist {buildDir}\\python mkdir {buildDir}\\python", + "copy six.py {buildDir}\\python", + + ], + + }, + } diff --git a/Subprocess32/config.py b/Subprocess32/config.py index 02d0c8cf84..ec6237f6dc 100644 --- a/Subprocess32/config.py +++ b/Subprocess32/config.py @@ -25,4 +25,17 @@ ], + "manifest" : [ + + "lib/python{pythonVersion}/site-packages/subprocess32.py", + "lib/python{pythonVersion}/site-packages/_posixsubprocess.so", + + ], + + "platform:windows" : { + + "enabled" : False, + + }, + } diff --git a/TBB/config.py b/TBB/config.py index a433db59f9..bcaafbc51a 100644 --- a/TBB/config.py +++ b/TBB/config.py @@ -23,7 +23,8 @@ "manifest" : [ "include/tbb", - "lib/libtbb*{sharedLibraryExtension}*", + "lib/{libraryPrefix}tbb*{sharedLibraryExtension}*", + "lib/{libraryPrefix}tbb*.lib", ], @@ -59,4 +60,26 @@ }, + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_CXX_STANDARD={c++Standard}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D TBB_BUILD_TESTS=OFF" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + "copy {buildDir}\\bin\\{libraryPrefix}tbb*{sharedLibraryExtension}* {buildDir}\\lib\\", + + ], + + }, + } diff --git a/TBB/patches/windows/001-cmake.patch b/TBB/patches/windows/001-cmake.patch new file mode 100644 index 0000000000..8e2d977187 --- /dev/null +++ b/TBB/patches/windows/001-cmake.patch @@ -0,0 +1,578 @@ +From 53303ec80c78df847cee960f7be8f2fe250d20fa Mon Sep 17 00:00:00 2001 +From: Alex Fuller +Date: Sun, 17 Sep 2017 15:11:22 -0700 +Subject: [PATCH] TBB CMake build scripts from https://github.com/wjakob/tbb + +--- + ./CMakeLists.txt | 524 ++++++++++++++++++++++++++++ + ./build/mingw_cross_toolchain.cmake | 9 + + ./build/version_string.ver.in | 11 + + 3 files changed, 550 insertions(+), 11 deletions(-) + create mode 100644 ./CMakeLists.txt + create mode 100644 ./build/mingw_cross_toolchain.cmake + create mode 100644 ./build/version_string.ver.in + +diff --git a/./CMakeLists.txt b/./CMakeLists.txt +new file mode 100644 +index 0000000000..e020273fc6 +--- /dev/null ++++ b/./CMakeLists.txt +@@ -0,0 +1,524 @@ ++cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) ++project (tbb CXX) ++ ++include(CheckCXXCompilerFlag) ++include(CheckCXXSourceRuns) ++ ++if(POLICY CMP0058) ++ cmake_policy(SET CMP0058 NEW) ++endif() ++ ++if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ++ message(STATUS "Setting build type to 'Release' as none was specified.") ++ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) ++ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" ++ "MinSizeRel" "RelWithDebInfo") ++endif() ++ ++if(NOT TBB_INSTALL_RUNTIME_DIR) ++ set(TBB_INSTALL_RUNTIME_DIR bin) ++endif() ++if(NOT TBB_INSTALL_LIBRARY_DIR) ++ set(TBB_INSTALL_LIBRARY_DIR lib) ++endif() ++if(NOT TBB_INSTALL_ARCHIVE_DIR) ++ set(TBB_INSTALL_ARCHIVE_DIR lib) ++endif() ++if(NOT TBB_INSTALL_INCLUDE_DIR) ++ set(TBB_INSTALL_INCLUDE_DIR include) ++endif() ++ ++include_directories(include src src/rml/include ${CMAKE_CURRENT_BINARY_DIR}) ++ ++option(TBB_BUILD_SHARED "Build TBB shared library" ON) ++option(TBB_BUILD_STATIC "Build TBB static library" ON) ++option(TBB_BUILD_TBBMALLOC "Build TBB malloc library" ON) ++option(TBB_BUILD_TBBMALLOC_PROXY "Build TBB malloc proxy library" ON) ++option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" ON) ++option(TBB_CI_BUILD "Is this a continuous integration build?" OFF) ++ ++if(APPLE) ++ set(CMAKE_MACOSX_RPATH ON) ++endif() ++ ++file(GLOB tbb_src "${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/old/*.cpp") ++list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/rml/client/rml_tbb.cpp) ++file(GLOB to_remove "${CMAKE_CURRENT_SOURCE_DIR}/src/old/test*.cpp") ++list(REMOVE_ITEM tbb_src ${to_remove}) ++ ++set(tbbmalloc_static_src ++ src/tbbmalloc/backend.cpp ++ src/tbbmalloc/large_objects.cpp ++ src/tbbmalloc/backref.cpp ++ src/tbbmalloc/tbbmalloc.cpp ++ src/tbbmalloc/frontend.cpp ++ src/tbb/itt_notify.cpp) ++ ++set(tbbmalloc_src ${tbbmalloc_static_src}) ++ ++set(tbbmalloc_proxy_src ++ src/tbbmalloc/proxy.cpp ++ src/tbbmalloc/tbb_function_replacement.cpp) ++ ++if (CMAKE_SYSTEM_PROCESSOR MATCHES "(i386|x86_64)") ++ if (NOT APPLE AND NOT MINGW) ++ add_definitions(-DDO_ITT_NOTIFY) ++ endif() ++endif() ++ ++if (APPLE) ++ # Disable annoying "has no symbols" warnings ++ set(CMAKE_C_ARCHIVE_CREATE " Scr ") ++ set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") ++ set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++endif() ++ ++macro(CHECK_CXX_COMPILER_AND_LINKER_FLAGS _RESULT _CXX_FLAGS _LINKER_FLAGS) ++ set(CMAKE_REQUIRED_FLAGS ${_CXX_FLAGS}) ++ set(CMAKE_REQUIRED_LIBRARIES ${_LINKER_FLAGS}) ++ set(CMAKE_REQUIRED_QUIET TRUE) ++ check_cxx_source_runs("#include \nint main(int argc, char **argv) { std::cout << \"test\"; return 0; }" ${_RESULT}) ++ set(CMAKE_REQUIRED_FLAGS "") ++ set(CMAKE_REQUIRED_LIBRARIES "") ++endmacro() ++ ++# Prefer libc++ in conjunction with Clang ++if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") ++ if (CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+") ++ message(STATUS "TBB: using libc++.") ++ else() ++ CHECK_CXX_COMPILER_AND_LINKER_FLAGS(HAS_LIBCPP "-stdlib=libc++" "-stdlib=libc++") ++ if (HAS_LIBCPP) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -D_LIBCPP_VERSION") ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") ++ message(STATUS "TBB: using libc++.") ++ else() ++ message(STATUS "TBB: NOT using libc++.") ++ endif() ++ endif() ++endif() ++ ++if (UNIX) ++ add_definitions (-DUSE_PTHREAD) ++ ++ check_cxx_compiler_flag ("-std=c++11" SUPPORTS_STDCXX11) ++ if (SUPPORTS_STDCXX11) ++ set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") ++ endif () ++ ++ check_cxx_compiler_flag ("-mrtm -Werror" SUPPORTS_MRTM) ++ if (SUPPORTS_MRTM) ++ set (CMAKE_CXX_FLAGS "-mrtm ${CMAKE_CXX_FLAGS}") ++ endif () ++ ++elseif(WIN32) ++ if (MSVC) ++ cmake_minimum_required (VERSION 3.1) ++ enable_language(ASM_MASM) ++ set(CMAKE_CXX_FLAGS "/GS- /Zc:wchar_t /Zc:forScope /DUSE_WINTHREAD ${CMAKE_CXX_FLAGS}") ++ set(CMAKE_CXX_FLAGS "/D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0600 ${CMAKE_CXX_FLAGS}") ++ check_cxx_compiler_flag ("/volatile:iso" SUPPORTS_VOLATILE_FLAG) ++ if (SUPPORTS_VOLATILE_FLAG) ++ set(CMAKE_CXX_FLAGS "/volatile:iso ${CMAKE_CXX_FLAGS}") ++ endif () ++ set(CMAKE_CXX_FLAGS "/wd4267 /wd4800 /wd4146 /wd4244 /wd4577 /wd4018 ${CMAKE_CXX_FLAGS}") ++ if (NOT CMAKE_SIZEOF_VOID_P) ++ message(FATAL_ERROR "'CMAKE_SIZEOF_VOID_P' is undefined. Please delete your build directory and rerun CMake again!") ++ endif() ++ ++ if (CMAKE_SIZEOF_VOID_P EQUAL 8) ++ list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm ++ src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm) ++ list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm) ++ set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1 ${CMAKE_ASM_MASM_FLAGS}") ++ else() ++ list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm ++ src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm) ++ # Enable SAFESEH feature for assembly (x86 builds only). ++ set(CMAKE_ASM_MASM_FLAGS "/safeseh ${CMAKE_ASM_MASM_FLAGS}") ++ endif() ++ elseif (MINGW) ++ add_definitions(-DUSE_WINTHREAD) ++ add_definitions(-D_WIN32_WINNT=0x0502) ++ set(CMAKE_CXX_FLAGS "-mthreads ${CMAKE_CXX_FLAGS}") ++ endif () ++endif() ++ ++if (MSVC) ++ set(ENABLE_RTTI "/EHsc /GR ") ++ set(DISABLE_RTTI "/EHs- /GR- ") ++elseif (UNIX) ++ set(ENABLE_RTTI "-frtti -fexceptions ") ++ set(DISABLE_RTTI "-fno-rtti -fno-exceptions ") ++endif () ++ ++##-------- ++# - Added TBB_USE_GLIBCXX_VERSION macro to specify the version of GNU ++# libstdc++ when it cannot be properly recognized, e.g. when used ++# with Clang on Linux* OS. Inspired by a contribution from David A. ++if (NOT TBB_USE_GLIBCXX_VERSION AND UNIX AND NOT APPLE) ++ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ++ # using Clang ++ string(REPLACE "." "0" TBB_USE_GLIBCXX_VERSION ${CMAKE_CXX_COMPILER_VERSION}) ++ endif() ++endif() ++ ++if (TBB_USE_GLIBCXX_VERSION) ++ add_definitions(-DTBB_USE_GLIBCXX_VERSION=${TBB_USE_GLIBCXX_VERSION}) ++endif() ++ ++##------- ++ ++if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") ++ check_cxx_compiler_flag ("-flifetime-dse=1" SUPPORTS_FLIFETIME) ++ if (SUPPORTS_FLIFETIME) ++ add_definitions(-flifetime-dse=1) ++ endif() ++endif() ++ ++# Linker export definitions ++if (APPLE) ++ set (ARCH_PREFIX "mac") ++elseif(WIN32) ++ set (ARCH_PREFIX "win") ++else() ++ set (ARCH_PREFIX "lin") ++endif() ++ ++if (CMAKE_SIZEOF_VOID_P EQUAL 8) ++ set(ARCH_PREFIX "${ARCH_PREFIX}64") ++else() ++ set(ARCH_PREFIX "${ARCH_PREFIX}32") ++endif() ++ ++if (MINGW) ++ set (ARCH_PREFIX "${ARCH_PREFIX}-gcc") ++ # there's no win32-gcc-tbb-export.def, use lin32-tbb-export.def ++ execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/lin32-tbb-export.def ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/win32-gcc-tbb-export.def) ++endif() ++ ++if (MSVC) ++ add_custom_command(OUTPUT tbb.def ++ COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbb.def ++ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def ++ COMMENT "Preprocessing tbb.def" ++ ) ++ ++ add_custom_command(OUTPUT tbbmalloc.def ++ COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbbmalloc.def ++ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def ++ COMMENT "Preprocessing tbbmalloc.def" ++ ) ++else() ++ add_custom_command(OUTPUT tbb.def ++ COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def ++ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def ++ COMMENT "Preprocessing tbb.def" ++ ) ++ ++ add_custom_command(OUTPUT tbbmalloc.def ++ COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def ++ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def ++ COMMENT "Preprocessing tbbmalloc.def" ++ ) ++endif() ++ ++add_custom_target(tbb_def_files DEPENDS tbb.def tbbmalloc.def) ++ ++# TBB library ++if (TBB_BUILD_STATIC) ++ add_library(tbb_static STATIC ${tbb_src}) ++ set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1") ++ set_property(TARGET tbb_static APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI}) ++ install(TARGETS tbb_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}) ++ if (MSVC) ++ target_compile_definitions(tbb_static PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1) ++ endif() ++ ++ if (UNIX AND NOT APPLE) ++ target_link_libraries(tbb_static PUBLIC pthread dl) ++ endif() ++endif() ++ ++if (TBB_BUILD_SHARED) ++ add_library(tbb SHARED ${tbb_src}) ++ set_property(TARGET tbb APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1") ++ set_property(TARGET tbb APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI}) ++ add_dependencies(tbb tbb_def_files) ++ ++ if (APPLE) ++ set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbb.def") ++ elseif (MSVC) ++ set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def") ++ else () ++ set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def") ++ endif() ++ ++ install(TARGETS tbb ++ LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR} ++ ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR} ++ RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR}) ++ if (UNIX AND NOT APPLE) ++ target_link_libraries(tbb PUBLIC pthread dl) ++ endif() ++ if (MSVC) ++ target_compile_definitions(tbb PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1) ++ endif() ++endif() ++ ++ ++if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") ++ # Quench a warning on GCC ++ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/governor.cpp COMPILE_FLAGS "-Wno-missing-field-initializers ") ++elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ++ # Quench a warning on Clang ++ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/itt_notify.cpp COMPILE_FLAGS "-Wno-varargs ") ++elseif(MSVC) ++ # Quench a warning on MSVC ++ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/scheduler.cpp COMPILE_FLAGS "/wd4458 ") ++endif() ++ ++if(TBB_BUILD_TBBMALLOC) ++ # TBB malloc library ++ if (TBB_BUILD_STATIC) ++ add_library(tbbmalloc_static STATIC ${tbbmalloc_static_src}) ++ set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") ++ set_property(TARGET tbbmalloc_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) ++ if (MSVC) ++ target_compile_definitions(tbbmalloc_static PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1) ++ endif() ++ install(TARGETS tbbmalloc_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}) ++ endif() ++ ++ if (TBB_BUILD_SHARED) ++ add_library(tbbmalloc SHARED ${tbbmalloc_src}) ++ set_property(TARGET tbbmalloc APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") ++ set_property(TARGET tbbmalloc APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) ++ add_dependencies(tbbmalloc tbb_def_files) ++ if (APPLE) ++ set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") ++ elseif (MSVC) ++ set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") ++ else () ++ set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") ++ endif() ++ if (MSVC) ++ target_compile_definitions(tbbmalloc PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1) ++ endif() ++ install(TARGETS tbbmalloc ++ LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR} ++ ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR} ++ RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR}) ++ if (UNIX AND NOT APPLE) ++ target_link_libraries(tbbmalloc PUBLIC pthread dl) ++ endif() ++ endif() ++endif() ++ ++if(TBB_BUILD_TBBMALLOC_PROXY) ++ # TBB malloc proxy library ++ if (TBB_BUILD_STATIC) ++ add_library(tbbmalloc_proxy_static STATIC ${tbbmalloc_proxy_src}) ++ set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") ++ set_property(TARGET tbbmalloc_proxy_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) ++ install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}) ++ endif() ++ ++ if (TBB_BUILD_SHARED) ++ add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src}) ++ set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") ++ set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) ++ target_link_libraries(tbbmalloc_proxy PUBLIC tbbmalloc) ++ install(TARGETS tbbmalloc_proxy ++ LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR} ++ ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR} ++ RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR}) ++ if (UNIX AND NOT APPLE) ++ target_link_libraries(tbbmalloc_proxy PUBLIC pthread dl) ++ endif() ++ endif() ++endif() ++ ++install(DIRECTORY include/tbb DESTINATION ${TBB_INSTALL_INCLUDE_DIR}) ++ ++# version_string.ver ++if (UNIX) ++ execute_process (COMMAND date "+%a, %d %b %Y %H:%M:%S %z" ++ OUTPUT_VARIABLE _configure_date ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++elseif (WIN32) ++ execute_process (COMMAND cmd " /C date /T" ++ OUTPUT_VARIABLE _configure_date ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++else () ++ set (_configure_date "Unknown") ++endif() ++include_directories (${CMAKE_BINARY_DIR}) ++configure_file (build/version_string.ver.in version_string.ver @ONLY) ++ ++if (TBB_BUILD_TESTS) ++ enable_language (C) ++ enable_testing () ++ ++ find_library (LIBRT_LIBRARIES rt) ++ find_library (LIDL_LIBRARIES dl) ++ find_package (Threads) ++ if (NOT APPLE) ++ find_package (OpenMP) ++ endif() ++ ++ macro (tbb_add_test testname) ++ set (full_testname tbb_test_${testname}) ++ add_executable (${full_testname} src/test/test_${testname}.cpp) ++ if (TBB_BUILD_SHARED) ++ target_link_libraries (${full_testname} PRIVATE tbb tbbmalloc) ++ target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb) ++ else () ++ target_link_libraries (${full_testname} PRIVATE tbb_static tbbmalloc_static) ++ target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb_static) ++ endif () ++ if (LIBRT_LIBRARIES) ++ target_link_libraries (${full_testname} PRIVATE ${LIBRT_LIBRARIES}) ++ endif () ++ if (LIDL_LIBRARIES) ++ target_link_libraries (${full_testname} PRIVATE ${LIDL_LIBRARIES}) ++ endif () ++ if (Threads_FOUND) ++ target_link_libraries (${full_testname} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) ++ endif () ++ if (OPENMP_FOUND AND "${testname}" MATCHES "openmp") ++ set_target_properties (${full_testname} PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}") ++ set_target_properties (${full_testname} PROPERTIES LINK_FLAGS "${OpenMP_CXX_FLAGS}") ++ endif() ++ if (MINGW) ++ target_link_libraries (${full_testname} PRIVATE psapi) ++ endif () ++ add_test (NAME ${full_testname} COMMAND ${full_testname}) ++ endmacro () ++ ++ tbb_add_test (aggregator) ++ tbb_add_test (aligned_space) ++ tbb_add_test (assembly) ++ tbb_add_test (async_msg) ++ tbb_add_test (async_node) ++ # tbb_add_test (atomic) # msvc64/debug timeouts: Compile-time initialization fails for static tbb::atomic variables ++ tbb_add_test (blocked_range2d) ++ tbb_add_test (blocked_range3d) ++ tbb_add_test (blocked_range) ++ tbb_add_test (broadcast_node) ++ tbb_add_test (buffer_node) ++ tbb_add_test (cache_aligned_allocator) ++ if (NOT WIN32) ++ tbb_add_test (cache_aligned_allocator_STL) ++ endif() ++ tbb_add_test (cilk_dynamic_load) ++ tbb_add_test (cilk_interop) ++ tbb_add_test (combinable) ++ tbb_add_test (composite_node) ++ tbb_add_test (concurrent_hash_map) ++ tbb_add_test (concurrent_lru_cache) ++ # tbb_add_test (concurrent_monitor) # too long ++ # tbb_add_test (concurrent_priority_queue) ++ tbb_add_test (concurrent_queue) ++ # tbb_add_test (concurrent_queue_whitebox) ++ tbb_add_test (concurrent_unordered_map) ++ # tbb_add_test (concurrent_unordered_set) ++ tbb_add_test (concurrent_vector) ++ tbb_add_test (continue_node) ++ tbb_add_test (critical_section) ++ tbb_add_test (dynamic_link) ++ # tbb_add_test (eh_algorithms) ++ tbb_add_test (eh_flow_graph) ++ # tbb_add_test (eh_tasks) ++ tbb_add_test (enumerable_thread_specific) ++ tbb_add_test (examples_common_utility) ++ # tbb_add_test (fast_random) ++ tbb_add_test (flow_graph) ++ tbb_add_test (flow_graph_whitebox) ++ # tbb_add_test (fp) # mingw: harness_fp.h:66, assertion !checkConsistency || (ctl.mxcsr & SSE_RND_MODE_MASK) >> 3 == (ctl.x87cw & FE_RND_MODE_MASK): failed ++ # tbb_add_test (function_node) # mingw:random timeout ++ # tbb_add_test (global_control) ++ # tbb_add_test (global_control_whitebox) ++ tbb_add_test (halt) ++ tbb_add_test (handle_perror) ++ # tbb_add_test (hw_concurrency) ++ tbb_add_test (indexer_node) ++ tbb_add_test (inits_loop) ++ tbb_add_test (intrusive_list) ++ tbb_add_test (ittnotify) ++ # tbb_add_test (join_node) #msvc/64: fatal error C1128: number of sections exceeded object file format limit: compile with /bigob ++ tbb_add_test (lambda) ++ tbb_add_test (limiter_node) ++ # tbb_add_test (malloc_atexit) ++ tbb_add_test (malloc_compliance) ++ tbb_add_test (malloc_init_shutdown) ++ # tbb_add_test (malloc_lib_unload) ++ # tbb_add_test (malloc_overload) ++ tbb_add_test (malloc_pools) ++ tbb_add_test (malloc_regression) ++ # tbb_add_test (malloc_used_by_lib) ++ # tbb_add_test (malloc_whitebox) ++ tbb_add_test (model_plugin) ++ # tbb_add_test (multifunction_node) # too long ++ tbb_add_test (mutex) ++ tbb_add_test (mutex_native_threads) ++ # tbb_add_test (opencl_node) ++ if (OPENMP_FOUND) ++ tbb_add_test (openmp) ++ endif () ++ tbb_add_test (overwrite_node) ++ # tbb_add_test (parallel_do) ++ if (NOT TBB_CI_BUILD) ++ # This seems to fail on CI platforms (AppVeyor/Travis), perhaps because the VM exposes just 1 core? ++ tbb_add_test (parallel_for) ++ endif() ++ tbb_add_test (parallel_for_each) ++ tbb_add_test (parallel_for_vectorization) ++ tbb_add_test (parallel_invoke) ++ tbb_add_test (parallel_pipeline) ++ tbb_add_test (parallel_reduce) ++ tbb_add_test (parallel_scan) ++ tbb_add_test (parallel_sort) ++ tbb_add_test (parallel_while) ++ # tbb_add_test (partitioner_whitebox) # too long ++ tbb_add_test (pipeline) ++ # tbb_add_test (pipeline_with_tbf) # takes forever on appveyor ++ tbb_add_test (priority_queue_node) ++ tbb_add_test (queue_node) ++ tbb_add_test (reader_writer_lock) ++ # tbb_add_test (runtime_loader) # LINK : fatal error LNK1104: cannot open file 'tbbproxy.lib' [C:\projects\tbb\test_runtime_loader.vcxproj] ++ tbb_add_test (rwm_upgrade_downgrade) ++ # tbb_add_test (ScalableAllocator) ++ if (NOT WIN32) ++ tbb_add_test (ScalableAllocator_STL) ++ endif() ++ tbb_add_test (semaphore) ++ # tbb_add_test (sequencer_node) # msvc: timeout ++ tbb_add_test (source_node) ++ tbb_add_test (split_node) ++ tbb_add_test (static_assert) ++ tbb_add_test (std_thread) ++ tbb_add_test (tagged_msg) ++ # tbb_add_test (task_arena) # LINK : fatal error LNK1104: cannot open file '__TBB_LIB_NAME.lib' [C:\projects\tbb\test_task_arena.vcxproj] ++ # tbb_add_test (task_assertions) ++ tbb_add_test (task_auto_init) ++ tbb_add_test (task) ++ # tbb_add_test (task_enqueue) # too long ++ tbb_add_test (task_group) ++ # tbb_add_test (task_leaks) ++ # tbb_add_test (task_priority) ++ # tbb_add_test (task_scheduler_init) # msvc: test_task_scheduler_init.cpp:68, assertion !test_mandatory_parallelism || Harness::CanReachConcurrencyLevel(threads): failed ++ tbb_add_test (task_scheduler_observer) ++ tbb_add_test (task_steal_limit) ++ tbb_add_test (tbb_condition_variable) ++ tbb_add_test (tbb_fork) ++ # tbb_add_test (tbb_header) ++ tbb_add_test (tbb_thread) ++ # tbb_add_test (tbb_version) ++ tbb_add_test (tick_count) ++ tbb_add_test (tuple) ++ tbb_add_test (write_once_node) ++ tbb_add_test (yield) ++endif () +\ No newline at end of file +diff --git a/./build/mingw_cross_toolchain.cmake b/./build/mingw_cross_toolchain.cmake +new file mode 100644 +index 0000000000..f0671b513c +--- /dev/null ++++ b/./build/mingw_cross_toolchain.cmake +@@ -0,0 +1,9 @@ ++# CMake toolchain file, cf. README.mingw_cross ++SET(CMAKE_SYSTEM_NAME Windows) ++include(CMakeForceCompiler) ++IF("${GNU_HOST}" STREQUAL "") ++ SET(GNU_HOST i586-mingw32msvc) ++ENDIF() ++# Prefix detection only works with compiler id "GNU" ++CMAKE_FORCE_C_COMPILER(${GNU_HOST}-gcc GNU) ++SET(CMAKE_RC_COMPILER ${GNU_HOST}-windres) +diff --git a/./build/version_string.ver.in b/./build/version_string.ver.in +new file mode 100644 +index 0000000000..bb9f96e8f2 +--- /dev/null ++++ b/./build/version_string.ver.in +@@ -0,0 +1,11 @@ ++#define __TBB_VERSION_STRINGS(N) \ ++#N": BUILD_HOST @CMAKE_SYSTEM_NAME@" ENDL \ ++#N": BUILD_OS @CMAKE_SYSTEM@" ENDL \ ++#N": BUILD_KERNEL @CMAKE_SYSTEM_VERSION@" ENDL \ ++#N": BUILD_GCC @CMAKE_CXX_COMPILER_ID@" ENDL \ ++#N": BUILD_LIBC Unknown" ENDL \ ++#N": BUILD_LD Unknown" ENDL \ ++#N": BUILD_TARGET Unknown" ENDL \ ++#N": BUILD_COMMAND Unknown" ENDL ++ ++#define __TBB_DATETIME "@_configure_date@" + diff --git a/TBB/patches/windows/002-cmake.patch b/TBB/patches/windows/002-cmake.patch new file mode 100644 index 0000000000..f0267b1543 --- /dev/null +++ b/TBB/patches/windows/002-cmake.patch @@ -0,0 +1,10 @@ +--- ./CMakeLists.txt 2021-12-22 12:35:01.012377400 -0500 ++++ ./CMakeLists.txt 2021-12-22 12:37:57.055092500 -0500 +@@ -45,6 +45,7 @@ + list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/rml/client/rml_tbb.cpp) + file(GLOB to_remove "${CMAKE_CURRENT_SOURCE_DIR}/src/old/test*.cpp") + list(REMOVE_ITEM tbb_src ${to_remove}) ++list(REMOVE_ITEM tbb_src "${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/tbb_bind.cpp") + + set(tbbmalloc_static_src + src/tbbmalloc/backend.cpp diff --git a/TBB/patches/windows/msvc2017_workaround.patch b/TBB/patches/windows/msvc2017_workaround.patch new file mode 100644 index 0000000000..8aefdb506b --- /dev/null +++ b/TBB/patches/windows/msvc2017_workaround.patch @@ -0,0 +1,23 @@ +From acac892ffc3759bf9b0fd9bf0500f1cc7feb3c39 Mon Sep 17 00:00:00 2001 +From: alanb-sony <62992435+alanb-sony@users.noreply.github.com> +Date: Sat, 24 Oct 2020 10:31:15 +0100 +Subject: [PATCH] Workaround bug in visual studio 2017 + +Fixes #274 +--- + include/tbb/tbb_config.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/tbb/tbb_config.h b/include/tbb/tbb_config.h +index 7a8d06a03..886699d87 100644 +--- a/include/tbb/tbb_config.h ++++ b/include/tbb/tbb_config.h +@@ -620,7 +620,7 @@ There are four cases that are supported: + // instantiation site, which is too late for suppression of the corresponding messages for internal + // stuff. + #if !defined(__INTEL_COMPILER) && (!defined(TBB_SUPPRESS_DEPRECATED_MESSAGES) || (TBB_SUPPRESS_DEPRECATED_MESSAGES == 0)) +- #if (__cplusplus >= 201402L) ++ #if (__cplusplus >= 201402L && (!defined(_MSC_VER) || _MSC_VER >= 1920)) + #define __TBB_DEPRECATED [[deprecated]] + #define __TBB_DEPRECATED_MSG(msg) [[deprecated(msg)]] + #elif _MSC_VER diff --git a/USD/config.py b/USD/config.py index 7d7e7f81b2..e652b1b5f7 100644 --- a/USD/config.py +++ b/USD/config.py @@ -58,37 +58,67 @@ "manifest" : [ "bin/usd*", - "bin/sdfdump", + "bin/sdfdump{executableExtension}", "include/pxr", - "lib/libtrace{sharedLibraryExtension}", - "lib/libarch{sharedLibraryExtension}", - "lib/libtf{sharedLibraryExtension}", - "lib/libjs{sharedLibraryExtension}", - "lib/libwork{sharedLibraryExtension}", - "lib/libplug{sharedLibraryExtension}", - "lib/libkind{sharedLibraryExtension}", - "lib/libgf{sharedLibraryExtension}", - "lib/libvt{sharedLibraryExtension}", - "lib/libar{sharedLibraryExtension}", - "lib/libsdf{sharedLibraryExtension}", - "lib/libpcp{sharedLibraryExtension}", - "lib/libusd*{sharedLibraryExtension}", - "lib/libndr{sharedLibraryExtension}", - "lib/libsdr{sharedLibraryExtension}", - "lib/libhd{sharedLibraryExtension}", - "lib/libhdx{sharedLibraryExtension}", - "lib/libhdSt{sharedLibraryExtension}", - "lib/libhio{sharedLibraryExtension}", - "lib/libglf{sharedLibraryExtension}", - "lib/libgarch{sharedLibraryExtension}", - "lib/libhgi{sharedLibraryExtension}", - "lib/libhgiInterop{sharedLibraryExtension}", - "lib/libhgiGL{sharedLibraryExtension}", - "lib/libhf{sharedLibraryExtension}", - "lib/libcameraUtil{sharedLibraryExtension}", - "lib/libpxOsd{sharedLibraryExtension}", + # lib prefix is accurate for all platforms + "lib/{libraryPrefix}trace{sharedLibraryExtension}", + "lib/{libraryPrefix}arch{sharedLibraryExtension}", + "lib/{libraryPrefix}tf{sharedLibraryExtension}", + "lib/{libraryPrefix}js{sharedLibraryExtension}", + "lib/{libraryPrefix}work{sharedLibraryExtension}", + "lib/{libraryPrefix}plug{sharedLibraryExtension}", + "lib/{libraryPrefix}kind{sharedLibraryExtension}", + "lib/{libraryPrefix}gf{sharedLibraryExtension}", + "lib/{libraryPrefix}vt{sharedLibraryExtension}", + "lib/{libraryPrefix}ar{sharedLibraryExtension}", + "lib/{libraryPrefix}sdf{sharedLibraryExtension}", + "lib/{libraryPrefix}pcp{sharedLibraryExtension}", + "lib/{libraryPrefix}usd*{sharedLibraryExtension}", + "lib/{libraryPrefix}ndr{sharedLibraryExtension}", + "lib/{libraryPrefix}sdr{sharedLibraryExtension}", + "lib/{libraryPrefix}hd{sharedLibraryExtension}", + "lib/{libraryPrefix}hdx{sharedLibraryExtension}", + "lib/{libraryPrefix}hdSt{sharedLibraryExtension}", + "lib/{libraryPrefix}hio{sharedLibraryExtension}", + "lib/{libraryPrefix}glf{sharedLibraryExtension}", + "lib/{libraryPrefix}garch{sharedLibraryExtension}", + "lib/{libraryPrefix}hgi{sharedLibraryExtension}", + "lib/{libraryPrefix}hgiInterop{sharedLibraryExtension}", + "lib/{libraryPrefix}hgiGL{sharedLibraryExtension}", + "lib/{libraryPrefix}hf{sharedLibraryExtension}", + "lib/{libraryPrefix}cameraUtil{sharedLibraryExtension}", + "lib/{libraryPrefix}pxOsd{sharedLibraryExtension}", + + "lib/{libraryPrefix}trace{staticLibraryExtension}", + "lib/{libraryPrefix}arch{staticLibraryExtension}", + "lib/{libraryPrefix}tf{staticLibraryExtension}", + "lib/{libraryPrefix}js{staticLibraryExtension}", + "lib/{libraryPrefix}work{staticLibraryExtension}", + "lib/{libraryPrefix}plug{staticLibraryExtension}", + "lib/{libraryPrefix}kind{staticLibraryExtension}", + "lib/{libraryPrefix}gf{staticLibraryExtension}", + "lib/{libraryPrefix}vt{staticLibraryExtension}", + "lib/{libraryPrefix}ar{staticLibraryExtension}", + "lib/{libraryPrefix}sdf{staticLibraryExtension}", + "lib/{libraryPrefix}pcp{staticLibraryExtension}", + "lib/{libraryPrefix}usd*{staticLibraryExtension}", + "lib/{libraryPrefix}ndr{staticLibraryExtension}", + "lib/{libraryPrefix}sdr{staticLibraryExtension}", + "lib/{libraryPrefix}hd{staticLibraryExtension}", + "lib/{libraryPrefix}hdx{staticLibraryExtension}", + "lib/{libraryPrefix}hdSt{staticLibraryExtension}", + "lib/{libraryPrefix}hio{staticLibraryExtension}", + "lib/{libraryPrefix}glf{staticLibraryExtension}", + "lib/{libraryPrefix}garch{staticLibraryExtension}", + "lib/{libraryPrefix}hgi{staticLibraryExtension}", + "lib/{libraryPrefix}hgiInterop{staticLibraryExtension}", + "lib/{libraryPrefix}hgiGL{staticLibraryExtension}", + "lib/{libraryPrefix}hf{staticLibraryExtension}", + "lib/{libraryPrefix}cameraUtil{staticLibraryExtension}", + "lib/{libraryPrefix}pxOsd{staticLibraryExtension}", + "lib/usd", "python/pxr", @@ -105,6 +135,40 @@ "extraArguments" : "-D PXR_USE_PYTHON_3=TRUE", }, + + }, + + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D CMAKE_PREFIX_PATH={buildDir}" + " -D Boost_NO_BOOST_CMAKE=TRUE" + " -D PXR_ENABLE_OPENVDB_SUPPORT=TRUE" + " -D PXR_ENABLE_PTEX_SUPPORT=FALSE" + " -D PXR_BUILD_IMAGING=FALSE" + " -D PXR_BUILD_TESTS=FALSE" + " -D Boost_NO_SYSTEM_PATHS=TRUE" + " -D PXR_BUILD_ALEMBIC_PLUGIN=TRUE" + " -D PXR_BUILD_EMBREE_PLUGIN=TRUE" + " -D PXR_ENABLE_HDF5_SUPPORT=FALSE" + " -D ALEMBIC_DIR={buildDir}\\lib" + " -D OPENEXR_LOCATION={buildDir}\\lib" + " -D PXR_USE_PYTHON_3=TRUE" + " -D CMAKE_CXX_FLAGS=\"-DBOOST_ALL_NO_LIB\"" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + + "xcopy /s /e /h /y /i {buildDir}\\lib\\python\\pxr {buildDir}\\python\\pxr", + + ], }, diff --git a/Xerces/config.py b/Xerces/config.py index cf10d62081..5ffdb11737 100644 --- a/Xerces/config.py +++ b/Xerces/config.py @@ -2,7 +2,7 @@ "downloads" : [ - "https://archive.apache.org/dist/xerces/c/3/sources/xerces-c-3.2.2.tar.gz", + "http://apache.mirror.anlx.net//xerces/c/3/sources/xerces-c-3.2.3.tar.gz" ], @@ -12,16 +12,38 @@ "commands" : [ - "./configure --prefix={buildDir} --without-icu", - "make -j {jobs}", - "make install", - + "mkdir gafferBuild", + "cd gafferBuild &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}" ], "manifest" : [ - "lib/libxerces-c*{sharedLibraryExtension}*", + "lib/{libraryPrefix}xerces-c*{sharedLibraryExtension}*", + "lib/{libraryPrefix}xerces-c*.lib", ], + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + "cd gafferBuild &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " -D BUILD_SHARED_LIBS=OFF" + " ..", + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + + ] + + } } diff --git a/Zlib/config.py b/Zlib/config.py new file mode 100644 index 0000000000..13d0170f6f --- /dev/null +++ b/Zlib/config.py @@ -0,0 +1,71 @@ +{ + + "downloads" : [ + + "https://github.com/madler/zlib/archive/v1.2.11.tar.gz" + + ], + + "url" : "http://zlib.net/", + + "license" : None, + + "commands" : [ + + "mkdir gafferBuild", + + "cd gafferBuild &&" + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}" + + ], + + "manifest" : [ + + "include/zlib.h", + "include/zconf.h", + "lib/{libraryPrefix}zlib*{sharedLibraryExtension}*", + "lib/{libraryPrefix}zlib*.lib", + + ], + + "platform:osx" : { + + "enabled" : False, + + }, + + "platform:linux" : { + + "enabled" : False, + + }, + + "platform:windows" : { + + "commands" : [ + + "mkdir gafferBuild", + + "cd gafferBuild && " + " cmake" + " -G {cmakeGenerator}" + " -D CMAKE_BUILD_TYPE={cmakeBuildType}" + " -D CMAKE_INSTALL_PREFIX={buildDir}" + " ..", + + "cd gafferBuild && cmake --build . --config {cmakeBuildType} --target install -- -j {jobs}", + # for some reason Zlib building doesn't put zconf.h in the main source directory alongside zlib.h + # manually copy it there so Boost can find it + "cd gafferBuild && copy zconf.h ..", + "copy {buildDir}\\bin\\{libraryPrefix}zlib*{sharedLibraryExtension}* {buildDir}\\lib\\", + ] + + } + +} diff --git a/build.py b/build.py index 03f227e7ff..79ea9b5c93 100755 --- a/build.py +++ b/build.py @@ -12,9 +12,12 @@ import shutil import sys import tarfile +from telnetlib import STATUS import zipfile +from urllib.request import urlretrieve +import stat -__version = "5.0.0" +__version = "6.0.0" """ Config file format @@ -99,12 +102,14 @@ def __decompress( archive ) : with zipfile.ZipFile( archive ) as f : for info in f.infolist() : extracted = f.extract( info.filename ) - os.chmod( extracted, info.external_attr >> 16 ) + os.chmod( extracted, ( info.external_attr >> 16 ) | stat.S_IWUSR ) files = f.namelist() elif archive.endswith( ".tar.xz" ) : ## \todo When we eventually move to Python 3, we can use # the `tarfile` module for this too. command = "tar -xvf {archive}".format( archive=archive ) + if sys.platform == "win32": + command = "cmake -E tar xvf {archive}".format( archive=archive ) sys.stderr.write( command + "\n" ) files = subprocess.check_output( command, stderr=subprocess.STDOUT, shell = True, universal_newlines = True ) files = [ f for f in files.split( "\n" ) if f ] @@ -203,11 +208,12 @@ def __loadConfigs( variables, variants ) : configs = {} for project in __projects() : config = __loadJSON( project ) + config[ "platform" ] = variables[ "platform" ] if project in variants : __applyConfigOverrides( config, "variant:{}".format( variants[project] ) ) for variantProject, variant in variants.items() : __applyConfigOverrides( config, "variant:{}:{}".format( variantProject, variant ) ) - __applyConfigOverrides( config, "platform:macos" if sys.platform == "darwin" else "platform:linux" ) + __applyConfigOverrides( config, { "darwin": "platform:macos", "win32": "platform:windows" }.get( sys.platform, "platform:linux" ) ) if config.get( "enabled", True ) : configs[project] = config @@ -278,9 +284,10 @@ def __buildProject( project, config, buildDir ) : if os.path.exists( archivePath ) : continue - downloadCommand = "curl -L {0} > {1}".format( download, archivePath ) - sys.stderr.write( downloadCommand + "\n" ) - subprocess.check_call( downloadCommand, shell = True ) + # downloadCommand = "curl -L {0} > {1}".format( download, archivePath ) + # sys.stderr.write( downloadCommand + "\n" ) + # subprocess.check_call( downloadCommand, shell = True ) + urlretrieve( download, archivePath ) workingDir = project + "/working" if os.path.exists( workingDir ) : @@ -303,13 +310,14 @@ def __buildProject( project, config, buildDir ) : shutil.rmtree( licenseDest ) shutil.copytree( config["license"], licenseDest ) - for patch in glob.glob( "../../patches/*.patch" ) : + for patch in glob.glob( "../../patches/{}/*.patch".format( config["platform"] ) ) + glob.glob( "../../patches/*.patch" ) : + # subprocess.check_call( "git apply --ignore-space-change --ignore-whitespace --whitespace=nowarn {patch}".format( patch = patch ), shell = True ) subprocess.check_call( "patch -p1 < {patch}".format( patch = patch ), shell = True ) environment = os.environ.copy() for k, v in config.get( "environment", {} ).items() : environment[k] = os.path.expandvars( v ) - + for command in config["commands"] : sys.stderr.write( command + "\n" ) subprocess.check_call( command, shell = True, env = environment ) @@ -406,10 +414,25 @@ def walk( project, configs, buildDir ) : with open( os.path.join( buildDir, "doc", "licenses", "manifest.json" ), "w" ) as file : json.dump( projectManifest, file, indent = 4 ) - rootName = os.path.basename( package ).replace( ".tar.gz", "" ) - with tarfile.open( package, "w:gz" ) as file : - for m in files : - file.add( os.path.join( buildDir, m ), arcname = os.path.join( rootName, m ) ) + if sys.platform == "win32" : + rootName = os.path.basename( package ).replace( ".zip", "" ) + buildDirLength = len( buildDir ) + with zipfile.ZipFile( package, "w", zipfile.ZIP_DEFLATED ) as file: + for m in files : + path = os.path.join( buildDir, m ) + if os.path.isfile( path ) : + file.write( os.path.join( buildDir, m ), arcname = os.path.join( rootName, m ) ) + elif os.path.isdir( path ) : + for root, dirs, files in os.walk( path ): + for f in files: + fullPath = os.path.join( root, f ) + relativePath = fullPath[ buildDirLength : ].lstrip( "\\" ) + file.write( fullPath, arcname = os.path.join( rootName, relativePath ) ) + else : + rootName = os.path.basename( package ).replace( ".tar.gz", "" ) + with tarfile.open( package, "w:gz" ) as file : + for m in files : + file.add( os.path.join( buildDir, m ), arcname = os.path.join( rootName, m ) ) parser = argparse.ArgumentParser() @@ -429,7 +452,7 @@ def walk( project, configs, buildDir ) : parser.add_argument( "--package", - default = "gafferDependencies-{version}{variants}-{platform}.tar.gz", + default = "gafferDependencies-{version}{variants}-{platform}" + ( ".zip" if sys.platform == "win32" else ".tar.gz" ), help = "The filename of the tarball package to create.", ) @@ -464,13 +487,20 @@ def walk( project, configs, buildDir ) : variables = { "buildDir" : os.path.abspath( args.buildDir ), + "buildDirFwd" : args.buildDir.replace("\\", "/"), "jobs" : args.jobs, "path" : os.environ["PATH"], "version" : __version, - "platform" : "macos" if sys.platform == "darwin" else "linux", - "sharedLibraryExtension" : ".dylib" if sys.platform == "darwin" else ".so", + "platform" : { "darwin": "macos", "win32": "windows" }.get( sys.platform, "linux" ), + "sharedLibraryExtension" : { "darwin": ".dylib", "win32": ".dll" }.get( sys.platform, ".so" ), + "staticLibraryExtension" : ".lib" if sys.platform == "win32" else ".a", + "pythonModuleExtension" : ".pyd" if sys.platform == "win32" else ".so", + "executableExtension" : ".exe" if sys.platform == "win32" else "", + "libraryPrefix" : "" if sys.platform == "win32" else "lib", "c++Standard" : "17", "compilerRoot" : __compilerRoot(), + "cmakeGenerator" : "\"NMake Makefiles JOM\"" if sys.platform == "win32" else "\"Unix Makefiles\"", + "cmakeBuildType": "Release", "variants" : "".join( "-{}{}".format( key, variants[key] ) for key in sorted( variants.keys() ) ), }