aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hieta <tobias@hieta.se>2022-08-05 21:45:55 +0200
committerTobias Hieta <tobias@hieta.se>2022-08-06 09:42:10 +0200
commitb1356504e63ae821cccf1e051a0d2526bdfef2b0 (patch)
tree7b0199b5d86ea079574c3fad0a613b363689acd3
parent786b503f66b1a35f79312203fcb533ad27511982 (diff)
Also make the soft toolchain requirements hard. This allows us to use C++17 features in LLVM now. If we find patterns with C++17 that improve readability it should be recommended in the coding standards. Reviewed By: jhenderson, cor3ntin, MaskRay Differential Revision: https://reviews.llvm.org/D130689
-rw-r--r--bolt/runtime/CMakeLists.txt2
-rw-r--r--clang/CMakeLists.txt2
-rw-r--r--lld/CMakeLists.txt2
-rw-r--r--lldb/CMakeLists.txt2
-rw-r--r--llvm/CMakeLists.txt2
-rw-r--r--llvm/cmake/modules/CheckCompilerVersion.cmake24
-rw-r--r--llvm/docs/CodingStandards.rst10
-rw-r--r--llvm/docs/ReleaseNotes.rst12
8 files changed, 32 insertions, 24 deletions
diff --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index 7c1b79af4d2c..ef7ad02c98c7 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13.4)
include(CheckIncludeFiles)
set(CMAKE_CXX_EXTENSIONS OFF)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
project(libbolt_rt_project)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 82207fae0c01..bf1268c08420 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
include(GNUInstallDirs)
if(CLANG_BUILT_STANDALONE)
- set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 58dca54642e4..22aa84ffc186 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
include(GNUInstallDirs)
if(LLD_BUILT_STANDALONE)
- set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index edb4c513a64d..fff25c344708 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -20,7 +20,7 @@ include(GNUInstallDirs)
if(LLDB_BUILT_STANDALONE)
include(LLDBStandalone)
- set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
endif()
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c3172d6b8172..b0c6a15ef0e8 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -58,7 +58,7 @@ project(LLVM
# Must go after project(..)
include(GNUInstallDirs)
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
if (CYGWIN)
# Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in
diff --git a/llvm/cmake/modules/CheckCompilerVersion.cmake b/llvm/cmake/modules/CheckCompilerVersion.cmake
index c73135864c9e..efe403f7f168 100644
--- a/llvm/cmake/modules/CheckCompilerVersion.cmake
+++ b/llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,19 @@
include(CheckCXXSourceCompiles)
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
set(APPLECLANG_SOFT_ERROR 9.3)
# https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
-# _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
# _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
set(MSVC_SOFT_ERROR 19.27)
-# Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
set(LIBSTDCXX_SOFT_ERROR 7)
@@ -76,22 +74,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
- # Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
- # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
check_cxx_source_compiles("
#include <iosfwd>
#if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
+#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
#error Unsupported libstdc++ version
#endif
#endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4whatEv[];
-const char *chk = _ZNKSt17bad_function_call4whatEv;
-#else
-const char *chk = \"\";
-#endif
-int main() { ++chk; return 0; }
+int main() { return 0; }
"
LLVM_LIBSTDCXX_MIN)
if(NOT LLVM_LIBSTDCXX_MIN)
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index 89a82d981c52..fd5bf25106b1 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -53,7 +53,7 @@ choice.
C++ Standard Versions
---------------------
-Unless otherwise documented, LLVM subprojects are written using standard C++14
+Unless otherwise documented, LLVM subprojects are written using standard C++17
code and avoid unnecessary vendor-specific extensions.
Nevertheless, we restrict ourselves to features which are available in the
@@ -63,7 +63,13 @@ section `Software`).
Each toolchain provides a good reference for what it accepts:
* Clang: https://clang.llvm.org/cxx_status.html
-* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx14
+
+ * libc++: https://libcxx.llvm.org/Status/Cxx17.html
+
+* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx17
+
+ * libstdc++: https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017
+
* MSVC: https://msdn.microsoft.com/en-us/library/hh567368.aspx
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index e57e6e6c9509..dc952ee54a62 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,18 @@ Non-comprehensive list of changes in this release
Update on required toolchains to build LLVM
-------------------------------------------
+LLVM is now built with C++17 by default. This means C++17 can be used in
+the code base.
+
+The previous "soft" toolchain requirements have now been changed to "hard".
+This means that the the following versions are now required to build LLVM
+and there is no way to suppress this error.
+
+* GCC >= 7.1
+* Clang >= 5.0
+* Apple Clang >= 9.3
+* Visual Studio 2019 >= 16.7
+
Changes to the LLVM IR
----------------------