From 6cbabc4b8c86a838216cb9d17dce14167222e6f7 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Mon, 23 Aug 2021 18:42:19 -0400 Subject: [PATCH] maint(clang-tidy): Enable cpp-coreguideline slicing checks (#3210) * maint(clang-tidy): add a clang-tidy slicing check * Add self + touch up readme * Fix typo --- .clang-tidy | 1 + README.rst | 4 ++-- include/pybind11/pybind11.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index c83b9b2f5..cefffba1e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ FormatStyle: file Checks: ' *bugprone*, cppcoreguidelines-init-variables, +cppcoreguidelines-slicing, clang-analyzer-optin.cplusplus.VirtualCall, llvm-namespace-comment, misc-misplaced-const, diff --git a/README.rst b/README.rst index 57eb06e55..7ce57b03a 100644 --- a/README.rst +++ b/README.rst @@ -134,9 +134,9 @@ About This project was created by `Wenzel Jakob `_. Significant features and/or improvements to the code were contributed by Jonas Adler, Lori A. Burns, -Sylvain Corlay, Eric Cousineau, Ralf Grosse-Kunstleve, Trent Houliston, Axel +Sylvain Corlay, Eric Cousineau, Aaron Gokaslan, Ralf Grosse-Kunstleve, Trent Houliston, Axel Huebl, @hulucc, Yannick Jadoul, Sergey Lyskov Johan Mabille, Tomasz Miąsko, -Dean Moldovan, Ben Pritchard, Jason Rhinelander, Boris Schäling, Pim +Dean Moldovan, Ben Pritchard, Jason Rhinelander, Boris Schäling, Pim Schellart, Henry Schreiner, Ivan Smirnov, Boris Staletic, and Patrick Stewart. We thank Google for a generous financial contribution to the continuous diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 7b7b3ca71..47b042147 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1664,7 +1664,7 @@ inline str enum_name(handle arg) { } struct enum_base { - enum_base(handle base, handle parent) : m_base(base), m_parent(parent) { } + enum_base(const handle &base, const handle &parent) : m_base(base), m_parent(parent) { } PYBIND11_NOINLINE void init(bool is_arithmetic, bool is_convertible) { m_base.attr("__entries") = dict();