Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Replace all uses of std::unique_ptr with Catch::Detail::unique_ptr

Doing some benchmarking with ClangBuildAnalyzer suggests that
compiling Catch2's `SelfTest` spends 10% of the time instantiating
`std::unique_ptr` for some interface types required for registering
and running tests.

The lesser compilation overhead of `Catch::Detail::unique_ptr` should
significantly reduce that time.

The compiled implementation was also changed to use the custom impl,
to avoid having to convert between using `std::unique_ptr` and
`Catch::Detail::unique_ptr`. This will likely also improve the compile
times of the implementation, but that is less important than improving
compilation times of the user's TUs with tests.
Commit
1d1ccf8f3c0c9e121b16afd4fafb850d14ef9fb0
Author
Martin Hořeňovský ·
Parents
41bbaa6d573a

Files · Download .tar.gz

Changes

 examples/300-Gen-OwnGenerator.cpp                  |  6 ++-
 examples/301-Gen-MapTypeConversion.cpp             |  2 +-
 .../benchmark/detail/catch_benchmark_function.hpp  |  4 +-
 src/catch2/catch_config.hpp                        |  4 +-
 src/catch2/catch_registry_hub.cpp                  |  2 +-
 src/catch2/catch_reporter_registrars.hpp           |  9 ++--
 src/catch2/catch_session.cpp                       |  8 ++--
 src/catch2/catch_session.hpp                       |  5 +--
 src/catch2/catch_test_case_info.cpp                |  4 +-
 src/catch2/catch_test_case_info.hpp                |  5 ++-
 src/catch2/catch_test_spec.cpp                     |  1 -
 src/catch2/catch_test_spec.hpp                     |  6 +--
 src/catch2/generators/catch_generators.hpp         | 48 +++++++++++++---------
 .../generators/catch_generators_adapters.hpp       | 12 +++---
 src/catch2/generators/catch_generators_random.hpp  |  4 +-
 src/catch2/generators/catch_generators_range.hpp   |  8 ++--
 .../interfaces/catch_interfaces_exception.hpp      |  3 +-
 .../catch_interfaces_generatortracker.hpp          |  4 +-
 .../interfaces/catch_interfaces_registry_hub.hpp   |  6 +--
 .../interfaces/catch_interfaces_reporter.hpp       |  6 +--
 .../interfaces/catch_interfaces_testcase.hpp       |  4 +-
 src/catch2/internal/catch_enum_values_registry.cpp |  4 +-
 src/catch2/internal/catch_enum_values_registry.hpp |  6 +--
 .../catch_exception_translator_registry.cpp        |  2 +-
 .../catch_exception_translator_registry.hpp        |  3 +-
 src/catch2/internal/catch_reporter_registry.cpp    | 16 ++++----
 src/catch2/internal/catch_stream.cpp               | 16 ++++----
 .../internal/catch_template_test_registry.hpp      |  2 -
 .../internal/catch_test_case_registry_impl.cpp     |  9 ++--
 .../internal/catch_test_case_registry_impl.hpp     | 12 ++++--
 src/catch2/internal/catch_test_registry.cpp        |  9 ++--
 src/catch2/internal/catch_test_registry.hpp        | 11 +++--
 src/catch2/internal/catch_test_spec_parser.cpp     | 16 ++++----
 src/catch2/reporters/catch_reporter_bases.cpp      |  1 -
 src/catch2/reporters/catch_reporter_console.hpp    |  3 +-
 .../IntrospectiveTests/GeneratorsImpl.tests.cpp    |  2 +-
 .../SelfTest/IntrospectiveTests/ToString.tests.cpp |  2 +-
 tests/SelfTest/UsageTests/Misc.tests.cpp           |  1 +
 38 files changed, 141 insertions(+), 125 deletions(-)

diff --git a/examples/300-Gen-OwnGenerator.cpp b/examples/300-Gen-OwnGenerator.cpp
index bff62907..09643d6f 100644
--- a/examples/300-Gen-OwnGenerator.cpp
+++ b/examples/300-Gen-OwnGenerator.cpp
@@ -43,7 +43,9 @@ int const& RandomIntGenerator::get() const {
 // is a value-wrapper around std::unique_ptr<IGenerator<int>>.
 Catch::Generators::GeneratorWrapper<int> random(int low, int high) {
     return Catch::Generators::GeneratorWrapper<int>(
-        std::make_unique<RandomIntGenerator>(low, high)
+        new RandomIntGenerator(low, high)
+        // Another possibility:
+        // Catch::Detail::make_unique<RandomIntGenerator>(low, high)
     );
 }
 
@@ -58,7 +60,7 @@ TEST_CASE("Generating random ints", "[example][generator]") {
         REQUIRE(i <= 100);
     }
     SECTION("Creating the random generator directly") {
-        auto i = GENERATE(take(100, GeneratorWrapper<int>(std::unique_ptr<IGenerator<int>>(new RandomIntGenerator(-100, 100)))));
+        auto i = GENERATE(take(100, GeneratorWrapper<int>(Catch::Detail::make_unique<RandomIntGenerator>(-100, 100))));
         REQUIRE(i >= -100);
         REQUIRE(i <= 100);
     }
diff --git a/examples/301-Gen-MapTypeConversion.cpp b/examples/301-Gen-MapTypeConversion.cpp
index 15b90fdd..6d81ce6d 100644
--- a/examples/301-Gen-MapTypeConversion.cpp
+++ b/examples/301-Gen-MapTypeConversion.cpp
@@ -40,7 +40,7 @@ std::string const& LineGenerator::get() const {
 // is a value-wrapper around std::unique_ptr<IGenerator<std::string>>.
 Catch::Generators::GeneratorWrapper<std::string> lines(std::string /* ignored for example */) {
     return Catch::Generators::GeneratorWrapper<std::string>(
-        std::make_unique<LineGenerator>()
+        new LineGenerator()
     );
 }
 
diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
index 03ef22a7..ebeb7fa0 100644
--- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp
+++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
@@ -14,11 +14,11 @@
 #include <catch2/benchmark/catch_chronometer.hpp>
 #include <catch2/benchmark/detail/catch_complete_invoke.hpp>
 #include <catch2/internal/catch_meta.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <cassert>
 #include <type_traits>
 #include <utility>
-#include <memory>
 
 namespace Catch {
     namespace Benchmark {
@@ -100,7 +100,7 @@ namespace Catch {
                 void operator()(Chronometer meter) const { f->call(meter); }
 
             private:
-                std::unique_ptr<callable> f;
+                Catch::Detail::unique_ptr<callable> f;
             };
         } // namespace Detail
     } // namespace Benchmark
diff --git a/src/catch2/catch_config.hpp b/src/catch2/catch_config.hpp
index 55cff0ee..dd8767dc 100644
--- a/src/catch2/catch_config.hpp
+++ b/src/catch2/catch_config.hpp
@@ -10,8 +10,8 @@
 
 #include <catch2/catch_test_spec.hpp>
 #include <catch2/interfaces/catch_interfaces_config.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
-#include <memory>
 #include <vector>
 #include <string>
 
@@ -116,7 +116,7 @@ namespace Catch {
         IStream const* openStream();
         ConfigData m_data;
 
-        std::unique_ptr<IStream const> m_stream;
+        Detail::unique_ptr<IStream const> m_stream;
         TestSpec m_testSpec;
         bool m_hasTestFilters = false;
     };
diff --git a/src/catch2/catch_registry_hub.cpp b/src/catch2/catch_registry_hub.cpp
index c6a19f09..ed2d068a 100644
--- a/src/catch2/catch_registry_hub.cpp
+++ b/src/catch2/catch_registry_hub.cpp
@@ -49,7 +49,7 @@ namespace Catch {
             void registerListener( IReporterFactoryPtr factory ) override {
                 m_reporterRegistry.registerListener( std::move(factory) );
             }
-            void registerTest( std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker ) override {
+            void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override {
                 m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) );
             }
             void registerTranslator( const IExceptionTranslator* translator ) override {
diff --git a/src/catch2/catch_reporter_registrars.hpp b/src/catch2/catch_reporter_registrars.hpp
index 0b4c19f2..8ad600ea 100644
--- a/src/catch2/catch_reporter_registrars.hpp
+++ b/src/catch2/catch_reporter_registrars.hpp
@@ -10,6 +10,7 @@
 #define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
 
 #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 namespace Catch {
 
@@ -17,7 +18,7 @@ namespace Catch {
     class ReporterFactory : public IReporterFactory {
 
         IStreamingReporterPtr create( ReporterConfig const& config ) const override {
-            return std::make_unique<T>( config );
+            return Detail::make_unique<T>( config );
         }
 
         std::string getDescription() const override {
@@ -30,7 +31,7 @@ namespace Catch {
     class ReporterRegistrar {
     public:
         explicit ReporterRegistrar( std::string const& name ) {
-            getMutableRegistryHub().registerReporter( name, std::make_unique<ReporterFactory<T>>() );
+            getMutableRegistryHub().registerReporter( name, Detail::make_unique<ReporterFactory<T>>() );
         }
     };
 
@@ -40,7 +41,7 @@ namespace Catch {
         class ListenerFactory : public IReporterFactory {
 
             IStreamingReporterPtr create( ReporterConfig const& config ) const override {
-                return std::make_unique<T>(config);
+                return Detail::make_unique<T>(config);
             }
             std::string getDescription() const override {
                 return std::string();
@@ -50,7 +51,7 @@ namespace Catch {
     public:
 
         ListenerRegistrar() {
-            getMutableRegistryHub().registerListener( std::make_unique<ListenerFactory>() );
+            getMutableRegistryHub().registerListener( Detail::make_unique<ListenerFactory>() );
         }
     };
 }
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp
index 351deb8d..3abd8410 100644
--- a/src/catch2/catch_session.cpp
+++ b/src/catch2/catch_session.cpp
@@ -44,12 +44,12 @@ namespace Catch {
                 return createReporter(config->getReporterName(), config);
             }
 
-            // On older platforms, returning std::unique_ptr<ListeningReporter>
-            // when the return type is std::unique_ptr<IStreamingReporter>
+            // On older platforms, returning unique_ptr<ListeningReporter>
+            // when the return type is unique_ptr<IStreamingReporter>
             // doesn't compile without a std::move call. However, this causes
             // a warning on newer platforms. Thus, we have to work around
             // it a bit and downcast the pointer manually.
-            auto ret = std::unique_ptr<IStreamingReporter>(new ListeningReporter);
+            auto ret = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter);
             auto& multi = static_cast<ListeningReporter&>(*ret);
             auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
             for (auto const& listener : listeners) {
@@ -252,7 +252,7 @@ namespace Catch {
     }
     Config& Session::config() {
         if( !m_config )
-            m_config = std::make_unique<Config>( m_configData );
+            m_config = Detail::make_unique<Config>( m_configData );
         return *m_config;
     }
 
diff --git a/src/catch2/catch_session.hpp b/src/catch2/catch_session.hpp
index 54fe37dd..52bf9f34 100644
--- a/src/catch2/catch_session.hpp
+++ b/src/catch2/catch_session.hpp
@@ -11,8 +11,7 @@
 #include <catch2/internal/catch_commandline.hpp>
 #include <catch2/catch_config.hpp>
 #include <catch2/internal/catch_text.hpp>
-
-#include <memory>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 namespace Catch {
 
@@ -53,7 +52,7 @@ namespace Catch {
 
         clara::Parser m_cli;
         ConfigData m_configData;
-        std::unique_ptr<Config> m_config;
+        Detail::unique_ptr<Config> m_config;
         bool m_startupExceptions = false;
     };
 
diff --git a/src/catch2/catch_test_case_info.cpp b/src/catch2/catch_test_case_info.cpp
index 7be5b861..a4bcb11c 100644
--- a/src/catch2/catch_test_case_info.cpp
+++ b/src/catch2/catch_test_case_info.cpp
@@ -105,11 +105,11 @@ namespace Catch {
         }
     }
 
-    std::unique_ptr<TestCaseInfo>
+    Detail::unique_ptr<TestCaseInfo>
         makeTestCaseInfo(std::string const& _className,
                          NameAndTags const& nameAndTags,
                          SourceLineInfo const& _lineInfo ) {
-        return std::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
+        return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo));
     }
 
     TestCaseInfo::TestCaseInfo(std::string const& _className,
diff --git a/src/catch2/catch_test_case_info.hpp b/src/catch2/catch_test_case_info.hpp
index f586ce92..991cca61 100644
--- a/src/catch2/catch_test_case_info.hpp
+++ b/src/catch2/catch_test_case_info.hpp
@@ -11,10 +11,11 @@
 #include <catch2/internal/catch_common.hpp>
 #include <catch2/internal/catch_stringref.hpp>
 #include <catch2/internal/catch_test_registry.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
+
 
 #include <string>
 #include <vector>
-#include <memory>
 
 #ifdef __clang__
 #pragma clang diagnostic push
@@ -90,7 +91,7 @@ namespace Catch {
         bool operator < ( TestCaseHandle const& rhs ) const;
     };
 
-    std::unique_ptr<TestCaseInfo> makeTestCaseInfo(  std::string const& className,
+    Detail::unique_ptr<TestCaseInfo> makeTestCaseInfo(  std::string const& className,
                             NameAndTags const& nameAndTags,
                             SourceLineInfo const& lineInfo );
 }
diff --git a/src/catch2/catch_test_spec.cpp b/src/catch2/catch_test_spec.cpp
index 87cf8cae..88966ec1 100644
--- a/src/catch2/catch_test_spec.cpp
+++ b/src/catch2/catch_test_spec.cpp
@@ -13,7 +13,6 @@
 #include <algorithm>
 #include <string>
 #include <vector>
-#include <memory>
 
 namespace Catch {
 
diff --git a/src/catch2/catch_test_spec.hpp b/src/catch2/catch_test_spec.hpp
index 3a767c74..7bb86512 100644
--- a/src/catch2/catch_test_spec.hpp
+++ b/src/catch2/catch_test_spec.hpp
@@ -13,11 +13,11 @@
 #pragma clang diagnostic ignored "-Wpadded"
 #endif
 
+#include <catch2/internal/catch_unique_ptr.hpp>
 #include <catch2/internal/catch_wildcard_pattern.hpp>
 
 #include <string>
 #include <vector>
-#include <memory>
 
 namespace Catch {
 
@@ -54,8 +54,8 @@ namespace Catch {
         };
 
         struct Filter {
-            std::vector<std::unique_ptr<Pattern>> m_required;
-            std::vector<std::unique_ptr<Pattern>> m_forbidden;
+            std::vector<Detail::unique_ptr<Pattern>> m_required;
+            std::vector<Detail::unique_ptr<Pattern>> m_forbidden;
 
             bool matches( TestCaseInfo const& testCase ) const;
             std::string name() const;
diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp
index e8c2a8fd..2e8fad14 100644
--- a/src/catch2/generators/catch_generators.hpp
+++ b/src/catch2/generators/catch_generators.hpp
@@ -10,7 +10,6 @@
 #include <catch2/interfaces/catch_interfaces_generatortracker.hpp>
 #include <catch2/internal/catch_common.hpp>
 
-#include <memory>
 #include <vector>
 #include <tuple>
 #include <utility>
@@ -43,11 +42,35 @@ namespace Detail {
         using type = T;
     };
 
+    template <typename T>
+    using GeneratorPtr = Catch::Detail::unique_ptr<IGenerator<T>>;
+
+    template <typename T>
+    class GeneratorWrapper final {
+        GeneratorPtr<T> m_generator;
+    public:
+        //! Takes ownership of the passed pointer.
+        GeneratorWrapper(IGenerator<T>* generator):
+            m_generator(generator) {}
+        GeneratorWrapper(GeneratorPtr<T> generator):
+            m_generator(std::move(generator)) {}
+
+        T const& get() const {
+            return m_generator->get();
+        }
+        bool next() {
+            return m_generator->next();
+        }
+    };
+
+
     template<typename T>
     class SingleValueGenerator final : public IGenerator<T> {
         T m_value;
     public:
-        SingleValueGenerator(T&& value) : m_value(std::move(value)) {}
+        SingleValueGenerator(T&& value):
+            m_value(std::forward<T>(value))
+        {}
 
         T const& get() const override {
             return m_value;
@@ -76,28 +99,13 @@ namespace Detail {
         }
     };
 
-    template <typename T>
-    class GeneratorWrapper final {
-        std::unique_ptr<IGenerator<T>> m_generator;
-    public:
-        GeneratorWrapper(std::unique_ptr<IGenerator<T>> generator):
-            m_generator(std::move(generator))
-        {}
-        T const& get() const {
-            return m_generator->get();
-        }
-        bool next() {
-            return m_generator->next();
-        }
-    };
-
     template <typename T>
     GeneratorWrapper<T> value(T&& value) {
-        return GeneratorWrapper<T>(std::make_unique<SingleValueGenerator<T>>(std::forward<T>(value)));
+        return GeneratorWrapper<T>(Catch::Detail::make_unique<SingleValueGenerator<T>>(std::forward<T>(value)));
     }
     template <typename T>
     GeneratorWrapper<T> values(std::initializer_list<T> values) {
-        return GeneratorWrapper<T>(std::make_unique<FixedValuesGenerator<T>>(values));
+        return GeneratorWrapper<T>(Catch::Detail::make_unique<FixedValuesGenerator<T>>(values));
     }
 
     template<typename T>
@@ -182,7 +190,7 @@ namespace Detail {
 
         IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
         if (!tracker.hasGenerator()) {
-            tracker.setGenerator(std::make_unique<Generators<UnderlyingType>>(generatorExpression()));
+            tracker.setGenerator(Catch::Detail::make_unique<Generators<UnderlyingType>>(generatorExpression()));
         }
 
         auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() );
diff --git a/src/catch2/generators/catch_generators_adapters.hpp b/src/catch2/generators/catch_generators_adapters.hpp
index 774df819..d4ea46e3 100644
--- a/src/catch2/generators/catch_generators_adapters.hpp
+++ b/src/catch2/generators/catch_generators_adapters.hpp
@@ -46,7 +46,7 @@ namespace Generators {
 
     template <typename T>
     GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) {
-        return GeneratorWrapper<T>(std::make_unique<TakeGenerator<T>>(target, std::move(generator)));
+        return GeneratorWrapper<T>(Catch::Detail::make_unique<TakeGenerator<T>>(target, std::move(generator)));
     }
 
 
@@ -87,7 +87,7 @@ namespace Generators {
 
     template <typename T, typename Predicate>
     GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) {
-        return GeneratorWrapper<T>(std::unique_ptr<IGenerator<T>>(std::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))));
+        return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator)));
     }
 
     template <typename T>
@@ -143,7 +143,7 @@ namespace Generators {
 
     template <typename T>
     GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) {
-        return GeneratorWrapper<T>(std::make_unique<RepeatGenerator<T>>(repeats, std::move(generator)));
+        return GeneratorWrapper<T>(Catch::Detail::make_unique<RepeatGenerator<T>>(repeats, std::move(generator)));
     }
 
     template <typename T, typename U, typename Func>
@@ -176,14 +176,14 @@ namespace Generators {
     template <typename Func, typename U, typename T = FunctionReturnType<Func, U>>
     GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {
         return GeneratorWrapper<T>(
-            std::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
+            Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
         );
     }
 
     template <typename T, typename U, typename Func>
     GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {
         return GeneratorWrapper<T>(
-            std::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
+            Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
         );
     }
 
@@ -226,7 +226,7 @@ namespace Generators {
     template <typename T>
     GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) {
         return GeneratorWrapper<std::vector<T>>(
-            std::make_unique<ChunkGenerator<T>>(size, std::move(generator))
+            Catch::Detail::make_unique<ChunkGenerator<T>>(size, std::move(generator))
         );
     }
 
diff --git a/src/catch2/generators/catch_generators_random.hpp b/src/catch2/generators/catch_generators_random.hpp
index 03cb57c1..eb6de023 100644
--- a/src/catch2/generators/catch_generators_random.hpp
+++ b/src/catch2/generators/catch_generators_random.hpp
@@ -67,7 +67,7 @@ std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value,
 GeneratorWrapper<T>>
 random(T a, T b) {
     return GeneratorWrapper<T>(
-        std::make_unique<RandomIntegerGenerator<T>>(a, b)
+        Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b)
     );
 }
 
@@ -76,7 +76,7 @@ std::enable_if_t<std::is_floating_point<T>::value,
 GeneratorWrapper<T>>
 random(T a, T b) {
     return GeneratorWrapper<T>(
-        std::make_unique<RandomFloatingGenerator<T>>(a, b)
+        Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b)
     );
 }
 
diff --git a/src/catch2/generators/catch_generators_range.hpp b/src/catch2/generators/catch_generators_range.hpp
index e2c5c522..ffb80377 100644
--- a/src/catch2/generators/catch_generators_range.hpp
+++ b/src/catch2/generators/catch_generators_range.hpp
@@ -52,13 +52,13 @@ public:
 template <typename T>
 GeneratorWrapper<T> range(T const& start, T const& end, T const& step) {
     static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, "Type must be numeric");
-    return GeneratorWrapper<T>(std::make_unique<RangeGenerator<T>>(start, end, step));
+    return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end, step));
 }
 
 template <typename T>
 GeneratorWrapper<T> range(T const& start, T const& end) {
     static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer");
-    return GeneratorWrapper<T>(std::make_unique<RangeGenerator<T>>(start, end));
+    return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end));
 }
 
 
@@ -92,13 +92,13 @@ template <typename InputIterator,
           typename InputSentinel,
           typename ResultType = typename std::iterator_traits<InputIterator>::value_type>
 GeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) {
-    return GeneratorWrapper<ResultType>(std::make_unique<IteratorGenerator<ResultType>>(from, to));
+    return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to));
 }
 
 template <typename Container,
           typename ResultType = typename Container::value_type>
 GeneratorWrapper<ResultType> from_range(Container const& cnt) {
-    return GeneratorWrapper<ResultType>(std::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end()));
+    return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end()));
 }
 
 
diff --git a/src/catch2/interfaces/catch_interfaces_exception.hpp b/src/catch2/interfaces/catch_interfaces_exception.hpp
index e9fb9ef7..31b6dc20 100644
--- a/src/catch2/interfaces/catch_interfaces_exception.hpp
+++ b/src/catch2/interfaces/catch_interfaces_exception.hpp
@@ -10,6 +10,7 @@
 
 #include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
 #include <catch2/internal/catch_compiler_capabilities.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <string>
 #include <vector>
@@ -18,7 +19,7 @@ namespace Catch {
     using exceptionTranslateFunction = std::string(*)();
 
     struct IExceptionTranslator;
-    using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
+    using ExceptionTranslators = std::vector<Detail::unique_ptr<IExceptionTranslator const>>;
 
     struct IExceptionTranslator {
         virtual ~IExceptionTranslator();
diff --git a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
index fa08be0c..88615ef5 100644
--- a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
+++ b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
@@ -8,7 +8,7 @@
 #ifndef TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
 #define TWOBLUECUBES_CATCH_INTERFACES_GENERATORTRACKER_INCLUDED
 
-#include <memory>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 namespace Catch {
 
@@ -29,7 +29,7 @@ namespace Catch {
             // can be retrieved).
             virtual bool next() = 0;
         };
-        using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
+        using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;
 
     } // namespace Generators
 
diff --git a/src/catch2/interfaces/catch_interfaces_registry_hub.hpp b/src/catch2/interfaces/catch_interfaces_registry_hub.hpp
index e292763d..3e99d215 100644
--- a/src/catch2/interfaces/catch_interfaces_registry_hub.hpp
+++ b/src/catch2/interfaces/catch_interfaces_registry_hub.hpp
@@ -9,9 +9,9 @@
 #define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
 
 #include <catch2/internal/catch_common.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <string>
-#include <memory>
 
 namespace Catch {
 
@@ -28,7 +28,7 @@ namespace Catch {
 
     class StartupExceptionRegistry;
 
-    using IReporterFactoryPtr = std::unique_ptr<IReporterFactory>;
+    using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
 
     struct IRegistryHub {
         virtual ~IRegistryHub();
@@ -46,7 +46,7 @@ namespace Catch {
         virtual ~IMutableRegistryHub();
         virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0;
         virtual void registerListener( IReporterFactoryPtr factory ) = 0;
-        virtual void registerTest(std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker) = 0;
+        virtual void registerTest(Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker) = 0;
         virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
         virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
         virtual void registerStartupException() noexcept = 0;
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp
index 408db425..5f0bcfc6 100644
--- a/src/catch2/interfaces/catch_interfaces_reporter.hpp
+++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp
@@ -17,6 +17,7 @@
 #include <catch2/internal/catch_message_info.hpp>
 #include <catch2/internal/catch_option.hpp>
 #include <catch2/internal/catch_stringref.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <catch2/benchmark/catch_estimate.hpp>
 #include <catch2/benchmark/catch_outlier_classification.hpp>
@@ -25,7 +26,6 @@
 #include <string>
 #include <iosfwd>
 #include <map>
-#include <memory>
 #include <algorithm>
 
 namespace Catch {
@@ -222,14 +222,14 @@ namespace Catch {
         virtual void listTags(std::vector<TagInfo> const& tags, Config const& config);
 
     };
-    using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
+    using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>;
 
     struct IReporterFactory {
         virtual ~IReporterFactory();
         virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
         virtual std::string getDescription() const = 0;
     };
-    using IReporterFactoryPtr = std::unique_ptr<IReporterFactory>;
+    using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;
 
     struct IReporterRegistry {
         using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
diff --git a/src/catch2/interfaces/catch_interfaces_testcase.hpp b/src/catch2/interfaces/catch_interfaces_testcase.hpp
index d176b490..aecc0871 100644
--- a/src/catch2/interfaces/catch_interfaces_testcase.hpp
+++ b/src/catch2/interfaces/catch_interfaces_testcase.hpp
@@ -9,7 +9,6 @@
 #define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
 
 #include <vector>
-#include <memory>
 
 namespace Catch {
 
@@ -26,7 +25,8 @@ namespace Catch {
 
     struct ITestCaseRegistry {
         virtual ~ITestCaseRegistry();
-        virtual std::vector<std::unique_ptr<TestCaseInfo>> const& getAllInfos() const = 0;
+        // TODO: this exists only for adding filenames to test cases -- let's expose this in a saner way later
+        virtual std::vector<TestCaseInfo* > const& getAllInfos() const = 0;
         virtual std::vector<TestCaseHandle> const& getAllTests() const = 0;
         virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0;
     };
diff --git a/src/catch2/internal/catch_enum_values_registry.cpp b/src/catch2/internal/catch_enum_values_registry.cpp
index 0ab07b57..7e7deb87 100644
--- a/src/catch2/internal/catch_enum_values_registry.cpp
+++ b/src/catch2/internal/catch_enum_values_registry.cpp
@@ -51,8 +51,8 @@ namespace Catch {
             return "{** unexpected enum value **}"_sr;
         }
 
-        std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
-            auto enumInfo = std::make_unique<EnumInfo>();
+        Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
+            auto enumInfo = Catch::Detail::make_unique<EnumInfo>();
             enumInfo->m_name = enumName;
             enumInfo->m_values.reserve( values.size() );
 
diff --git a/src/catch2/internal/catch_enum_values_registry.hpp b/src/catch2/internal/catch_enum_values_registry.hpp
index 87494b07..080af01e 100644
--- a/src/catch2/internal/catch_enum_values_registry.hpp
+++ b/src/catch2/internal/catch_enum_values_registry.hpp
@@ -9,19 +9,19 @@
 #define TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED
 
 #include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <vector>
-#include <memory>
 
 namespace Catch {
 
     namespace Detail {
 
-        std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );
+        Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );
 
         class EnumValuesRegistry : public IMutableEnumValuesRegistry {
 
-            std::vector<std::unique_ptr<EnumInfo>> m_enumInfos;
+            std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos;
 
             EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override;
         };
diff --git a/src/catch2/internal/catch_exception_translator_registry.cpp b/src/catch2/internal/catch_exception_translator_registry.cpp
index d99ec839..36640309 100644
--- a/src/catch2/internal/catch_exception_translator_registry.cpp
+++ b/src/catch2/internal/catch_exception_translator_registry.cpp
@@ -17,7 +17,7 @@ namespace Catch {
     }
 
     void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {
-        m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );
+        m_translators.push_back( Detail::unique_ptr<const IExceptionTranslator>( translator ) );
     }
 
 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
diff --git a/src/catch2/internal/catch_exception_translator_registry.hpp b/src/catch2/internal/catch_exception_translator_registry.hpp
index 48c385ab..7c170c08 100644
--- a/src/catch2/internal/catch_exception_translator_registry.hpp
+++ b/src/catch2/internal/catch_exception_translator_registry.hpp
@@ -11,7 +11,6 @@
 #include <catch2/interfaces/catch_interfaces_exception.hpp>
 #include <vector>
 #include <string>
-#include <memory>
 
 namespace Catch {
 
@@ -23,7 +22,7 @@ namespace Catch {
         std::string tryTranslators() const;
 
     private:
-        std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;
+        ExceptionTranslators m_translators;
     };
 }
 
diff --git a/src/catch2/internal/catch_reporter_registry.cpp b/src/catch2/internal/catch_reporter_registry.cpp
index 9c37b7b2..4919e5df 100644
--- a/src/catch2/internal/catch_reporter_registry.cpp
+++ b/src/catch2/internal/catch_reporter_registry.cpp
@@ -21,14 +21,14 @@ namespace Catch {
     ReporterRegistry::ReporterRegistry() {
         // Because it is impossible to move out of initializer list,
         // we have to add the elements manually
-        m_factories["automake"] = std::make_unique<ReporterFactory<AutomakeReporter>>();
-        m_factories["compact"] = std::make_unique<ReporterFactory<CompactReporter>>();
-        m_factories["console"] = std::make_unique<ReporterFactory<ConsoleReporter>>();
-        m_factories["junit"] = std::make_unique<ReporterFactory<JunitReporter>>();
-        m_factories["sonarqube"] = std::make_unique<ReporterFactory<SonarQubeReporter>>();
-        m_factories["tap"] = std::make_unique<ReporterFactory<TAPReporter>>();
-        m_factories["teamcity"] = std::make_unique<ReporterFactory<TeamCityReporter>>();
-        m_factories["xml"] = std::make_unique<ReporterFactory<XmlReporter>>();
+        m_factories["automake"] = Detail::make_unique<ReporterFactory<AutomakeReporter>>();
+        m_factories["compact"] = Detail::make_unique<ReporterFactory<CompactReporter>>();
+        m_factories["console"] = Detail::make_unique<ReporterFactory<ConsoleReporter>>();
+        m_factories["junit"] = Detail::make_unique<ReporterFactory<JunitReporter>>();
+        m_factories["sonarqube"] = Detail::make_unique<ReporterFactory<SonarQubeReporter>>();
+        m_factories["tap"] = Detail::make_unique<ReporterFactory<TAPReporter>>();
+        m_factories["teamcity"] = Detail::make_unique<ReporterFactory<TeamCityReporter>>();
+        m_factories["xml"] = Detail::make_unique<ReporterFactory<XmlReporter>>();
     }
 
     ReporterRegistry::~ReporterRegistry() = default;
diff --git a/src/catch2/internal/catch_stream.cpp b/src/catch2/internal/catch_stream.cpp
index 809acc0b..ec1179d3 100644
--- a/src/catch2/internal/catch_stream.cpp
+++ b/src/catch2/internal/catch_stream.cpp
@@ -13,19 +13,20 @@
 #include <catch2/internal/catch_debug_console.hpp>
 #include <catch2/internal/catch_stringref.hpp>
 #include <catch2/internal/catch_singletons.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #include <cstdio>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <vector>
-#include <memory>
 
 namespace Catch {
 
     Catch::IStream::~IStream() = default;
 
-    namespace Detail { namespace {
+namespace Detail {
+    namespace {
         template<typename WriterF, std::size_t bufferSize=256>
         class StreamBufImpl : public std::streambuf {
             char data[bufferSize];
@@ -104,11 +105,11 @@ namespace Catch {
         ///////////////////////////////////////////////////////////////////////////
 
         class DebugOutStream : public IStream {
-            std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;
+            Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;
             mutable std::ostream m_os;
         public:
             DebugOutStream()
-            :   m_streamBuf( std::make_unique<StreamBufImpl<OutputDebugWriter>>() ),
+            :   m_streamBuf( Detail::make_unique<StreamBufImpl<OutputDebugWriter>>() ),
                 m_os( m_streamBuf.get() )
             {}
 
@@ -118,7 +119,8 @@ namespace Catch {
             std::ostream& stream() const override { return m_os; }
         };
 
-    }} // namespace anon::detail
+    } // unnamed namespace
+} // namespace Detail
 
     ///////////////////////////////////////////////////////////////////////////
 
@@ -138,13 +140,13 @@ namespace Catch {
 
     // This class encapsulates the idea of a pool of ostringstreams that can be reused.
     struct StringStreams {
-        std::vector<std::unique_ptr<std::ostringstream>> m_streams;
+        std::vector<Detail::unique_ptr<std::ostringstream>> m_streams;
         std::vector<std::size_t> m_unused;
         std::ostringstream m_referenceStream; // Used for copy state/ flags from
 
         auto add() -> std::size_t {
             if( m_unused.empty() ) {
-                m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );
+                m_streams.push_back( Detail::unique_ptr<std::ostringstream>( new std::ostringstream ) );
                 return m_streams.size()-1;
             }
             else {
diff --git a/src/catch2/internal/catch_template_test_registry.hpp b/src/catch2/internal/catch_template_test_registry.hpp
index 0873e884..b716c5f7 100644
--- a/src/catch2/internal/catch_template_test_registry.hpp
+++ b/src/catch2/internal/catch_template_test_registry.hpp
@@ -10,8 +10,6 @@
 #include <catch2/internal/catch_preprocessor.hpp>
 #include <catch2/internal/catch_meta.hpp>
 
-#include <memory>
-
 // GCC 5 and older do not properly handle disabling unused-variable warning
 // with a _Pragma. This means that we have to leak the suppression to the
 // user code as well :-(
diff --git a/src/catch2/internal/catch_test_case_registry_impl.cpp b/src/catch2/internal/catch_test_case_registry_impl.cpp
index 7d16fb50..b7ebe977 100644
--- a/src/catch2/internal/catch_test_case_registry_impl.cpp
+++ b/src/catch2/internal/catch_test_case_registry_impl.cpp
@@ -116,14 +116,15 @@ namespace {
         return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
     }
 
-    void TestRegistry::registerTest(std::unique_ptr<TestCaseInfo> testInfo, std::unique_ptr<ITestInvoker> testInvoker) {
+    void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) {
         m_handles.emplace_back(testInfo.get(), testInvoker.get());
-        m_infos.push_back(std::move(testInfo));
+        m_viewed_test_infos.push_back(testInfo.get());
+        m_owned_test_infos.push_back(std::move(testInfo));
         m_invokers.push_back(std::move(testInvoker));
     }
 
-    std::vector<std::unique_ptr<TestCaseInfo>> const& TestRegistry::getAllInfos() const {
-        return m_infos;
+    std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const {
+        return m_viewed_test_infos;
     }
 
     std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {
diff --git a/src/catch2/internal/catch_test_case_registry_impl.hpp b/src/catch2/internal/catch_test_case_registry_impl.hpp
index 3d00896f..b7f49523 100644
--- a/src/catch2/internal/catch_test_case_registry_impl.hpp
+++ b/src/catch2/internal/catch_test_case_registry_impl.hpp
@@ -35,15 +35,19 @@ namespace Catch {
     public:
         ~TestRegistry() override = default;
 
-        virtual void registerTest( std::unique_ptr<TestCaseInfo> testInfo, std::unique_ptr<ITestInvoker> testInvoker );
+        virtual void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );
 
-        std::vector<std::unique_ptr<TestCaseInfo>> const& getAllInfos() const override;
+        std::vector<TestCaseInfo*> const& getAllInfos() const override;
         std::vector<TestCaseHandle> const& getAllTests() const override;
         std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override;
 
     private:
-        std::vector<std::unique_ptr<TestCaseInfo>> m_infos;
-        std::vector<std::unique_ptr<ITestInvoker>> m_invokers;
+        std::vector<Detail::unique_ptr<TestCaseInfo>> m_owned_test_infos;
+        // Keeps a materialized vector for `getAllInfos`.
+        // We should get rid of that eventually (see interface note)
+        std::vector<TestCaseInfo*> m_viewed_test_infos;
+
+        std::vector<Detail::unique_ptr<ITestInvoker>> m_invokers;
         std::vector<TestCaseHandle> m_handles;
         mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
         mutable std::vector<TestCaseHandle> m_sortedFunctions;
diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp
index 070fde0d..583754e2 100644
--- a/src/catch2/internal/catch_test_registry.cpp
+++ b/src/catch2/internal/catch_test_registry.cpp
@@ -13,11 +13,11 @@
 
 namespace Catch {
 
-    std::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
-        return std::make_unique<TestInvokerAsFunction>( testAsFunction );
+    Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
+        return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsFunction( testAsFunction ));
     }
 
-    AutoReg::AutoReg( std::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
+    AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
         CATCH_TRY {
             getMutableRegistryHub()
                     .registerTest(
@@ -25,7 +25,8 @@ namespace Catch {
                             extractClassName( classOrMethod ),
                             nameAndTags,
                             lineInfo),
-                        std::move(invoker));
+                        std::move(invoker)
+                    );
         } CATCH_CATCH_ALL {
             // Do not throw when constructing global objects, instead register the exception to be processed later
             getMutableRegistryHub().registerStartupException();
diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp
index 8a027bd9..fd6d7d21 100644
--- a/src/catch2/internal/catch_test_registry.hpp
+++ b/src/catch2/internal/catch_test_registry.hpp
@@ -12,8 +12,7 @@
 #include <catch2/interfaces/catch_interfaces_testcase.hpp>
 #include <catch2/internal/catch_compiler_capabilities.hpp>
 #include <catch2/internal/catch_stringref.hpp>
-
-#include <memory>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 // GCC 5 and older do not properly handle disabling unused-variable warning
 // with a _Pragma. This means that we have to leak the suppression to the
@@ -38,11 +37,11 @@ public:
     }
 };
 
-std::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() );
+Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() );
 
 template<typename C>
-std::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) {
-    return std::make_unique<TestInvokerAsMethod<C>>( testAsMethod );
+Detail::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) {
+    return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsMethod<C>(testAsMethod) );
 }
 
 struct NameAndTags {
@@ -54,7 +53,7 @@ struct NameAndTags {
 };
 
 struct AutoReg : NonCopyable {
-    AutoReg( std::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
+    AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
 };
 
 } // end namespace Catch
diff --git a/src/catch2/internal/catch_test_spec_parser.cpp b/src/catch2/internal/catch_test_spec_parser.cpp
index db8812b9..d82cb5e0 100644
--- a/src/catch2/internal/catch_test_spec_parser.cpp
+++ b/src/catch2/internal/catch_test_spec_parser.cpp
@@ -199,9 +199,9 @@ namespace Catch {
 
         if (!token.empty()) {
             if (m_exclusion) {
-                m_currentFilter.m_forbidden.emplace_back(std::make_unique<TestSpec::NamePattern>(token, m_substring));
+                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));
             } else {
-                m_currentFilter.m_required.emplace_back(std::make_unique<TestSpec::NamePattern>(token, m_substring));
+                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));
             }
         }
         m_substring.clear();
@@ -218,17 +218,17 @@ namespace Catch {
             if (token.size() > 1 && token[0] == '.') {
                 token.erase(token.begin());
                 if (m_exclusion) {
-                    m_currentFilter.m_forbidden.emplace_back(std::make_unique<TestSpec::TagPattern>(".", m_substring));
-                    m_currentFilter.m_forbidden.emplace_back(std::make_unique<TestSpec::TagPattern>(token, m_substring));
+                    m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring));
+                    m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
                 } else {
-                    m_currentFilter.m_required.emplace_back(std::make_unique<TestSpec::TagPattern>(".", m_substring));
-                    m_currentFilter.m_required.emplace_back(std::make_unique<TestSpec::TagPattern>(token, m_substring));
+                    m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring));
+                    m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
                 }
             }
             if (m_exclusion) {
-                m_currentFilter.m_forbidden.emplace_back(std::make_unique<TestSpec::TagPattern>(token, m_substring));
+                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
             } else {
-                m_currentFilter.m_required.emplace_back(std::make_unique<TestSpec::TagPattern>(token, m_substring));
+                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
             }
         }
         m_substring.clear();
diff --git a/src/catch2/reporters/catch_reporter_bases.cpp b/src/catch2/reporters/catch_reporter_bases.cpp
index abb47e68..3534ce4d 100644
--- a/src/catch2/reporters/catch_reporter_bases.cpp
+++ b/src/catch2/reporters/catch_reporter_bases.cpp
@@ -17,7 +17,6 @@
 #include <cstdio>
 #include <ostream>
 #include <cassert>
-#include <memory>
 
 namespace Catch {
     void prepareExpandedExpression(AssertionResult& result) {
diff --git a/src/catch2/reporters/catch_reporter_console.hpp b/src/catch2/reporters/catch_reporter_console.hpp
index 5ee9663c..56c7231a 100644
--- a/src/catch2/reporters/catch_reporter_console.hpp
+++ b/src/catch2/reporters/catch_reporter_console.hpp
@@ -9,6 +9,7 @@
 #define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED
 
 #include <catch2/reporters/catch_reporter_bases.hpp>
+#include <catch2/internal/catch_unique_ptr.hpp>
 
 #if defined(_MSC_VER)
 #pragma warning(push)
@@ -24,7 +25,7 @@ namespace Catch {
     class TablePrinter;
 
     struct ConsoleReporter : StreamingReporterBase {
-        std::unique_ptr<TablePrinter> m_tablePrinter;
+        Detail::unique_ptr<TablePrinter> m_tablePrinter;
 
         ConsoleReporter(ReporterConfig const& config);
         ~ConsoleReporter() override;
diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
index 81f5a811..169cac82 100644
--- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp
@@ -313,7 +313,7 @@ TEST_CASE("GENERATE capture macros", "[generators][internals][approvals]") {
 
     non_copyable nc; nc.value = value;
     // neither `GENERATE_COPY` nor plain `GENERATE` would compile here
-    auto value2 = GENERATE_REF(Catch::Generators::GeneratorWrapper<int>(std::unique_ptr<Catch::Generators::IGenerator<int>>(new TestGen(nc))));
+    auto value2 = GENERATE_REF(Catch::Generators::GeneratorWrapper<int>(Catch::Detail::make_unique<TestGen>(nc)));
     REQUIRE(value == value2);
 }
 
diff --git a/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp b/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
index 966bebed..b50a4012 100644
--- a/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp
@@ -34,7 +34,7 @@ TEST_CASE( "parseEnums", "[Strings][enums]" ) {
 TEST_CASE( "Directly creating an EnumInfo" ) {
 
     using namespace Catch::Detail;
-    std::unique_ptr<EnumInfo> enumInfo = makeEnumInfo( "EnumName", "EnumName::Value1, EnumName::Value2", {0, 1} );
+    auto enumInfo = makeEnumInfo( "EnumName", "EnumName::Value1, EnumName::Value2", {0, 1} );
 
     CHECK( enumInfo->lookup(0) == "Value1" );
     CHECK( enumInfo->lookup(1) == "Value2" );
diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp
index 8203f730..c3e39161 100644
--- a/tests/SelfTest/UsageTests/Misc.tests.cpp
+++ b/tests/SelfTest/UsageTests/Misc.tests.cpp
@@ -16,6 +16,7 @@
 #include <cerrno>
 #include <limits>
 #include <array>
+#include <tuple>
 
 namespace { namespace MiscTests {