Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/generators
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-05-10 10:20:48 +0200
committerMartin Hořeňovský2020-05-10 15:37:29 +0200
commit7efbc83ae0393500692851525b89cfa890f3cee0 (patch)
treeb00e6d57b2753d675fc9201a341c49cb6788cfaf /src/catch2/generators
parent9e498278be92ff209687a09b989f27d51aab7809 (diff)
downloadcatch3-7efbc83ae0393500692851525b89cfa890f3cee0.tar.gz
Introduce combined TUs for compiling small TUs
This should improve the compilation times by decreasing the number of TUs compiled, without making overly big TUs that would cause problems with heavy-tailed compilation times. There is one "combined TU" for the top level part, and each subpart, except for Reporters, which currently do not have any trivial TUs.
Diffstat (limited to 'src/catch2/generators')
-rw-r--r--src/catch2/generators/catch_generator_exception.cpp14
-rw-r--r--src/catch2/generators/catch_generators.cpp37
-rw-r--r--src/catch2/generators/catch_generators.hpp1
-rw-r--r--src/catch2/generators/internal/catch_generators_combined_tu.cpp58
4 files changed, 58 insertions, 52 deletions
diff --git a/src/catch2/generators/catch_generator_exception.cpp b/src/catch2/generators/catch_generator_exception.cpp
deleted file mode 100644
index 446c732a..00000000
--- a/src/catch2/generators/catch_generator_exception.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-
-#include <catch2/generators/catch_generator_exception.hpp>
-
-namespace Catch {
-
- const char* GeneratorException::what() const noexcept {
- return m_msg;
- }
-
-} // end namespace Catch
diff --git a/src/catch2/generators/catch_generators.cpp b/src/catch2/generators/catch_generators.cpp
deleted file mode 100644
index d0c759c4..00000000
--- a/src/catch2/generators/catch_generators.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Created by Phil Nash on 15/6/2018.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-
-#include <catch2/generators/catch_generators.hpp>
-#include <catch2/internal/catch_enforce.hpp>
-#include <catch2/generators/catch_generator_exception.hpp>
-#include <catch2/interfaces/catch_interfaces_capture.hpp>
-
-#include <limits>
-#include <set>
-
-namespace Catch {
-
-IGeneratorTracker::~IGeneratorTracker() {}
-
-namespace Generators {
-
-namespace Detail {
-
- [[noreturn]]
- void throw_generator_exception(char const* msg) {
- Catch::throw_exception(GeneratorException{ msg });
- }
-} // end namespace Detail
-
- GeneratorUntypedBase::~GeneratorUntypedBase() {}
-
- auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
- return getResultCapture().acquireGeneratorTracker( lineInfo );
- }
-
-} // namespace Generators
-} // namespace Catch
diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp
index 60ab4b4f..b1eacd50 100644
--- a/src/catch2/generators/catch_generators.hpp
+++ b/src/catch2/generators/catch_generators.hpp
@@ -12,7 +12,6 @@
#include <memory>
#include <vector>
-#include <cassert>
#include <tuple>
#include <utility>
diff --git a/src/catch2/generators/internal/catch_generators_combined_tu.cpp b/src/catch2/generators/internal/catch_generators_combined_tu.cpp
new file mode 100644
index 00000000..84cf3707
--- /dev/null
+++ b/src/catch2/generators/internal/catch_generators_combined_tu.cpp
@@ -0,0 +1,58 @@
+/** \file
+ * This is a special TU that combines what would otherwise be a very
+ * small generator-related TUs into one bigger TU.
+ *
+ * The reason for this is compilation performance improvements by
+ * avoiding reparsing headers for many small TUs, instead having this
+ * one TU include bit more, but having it all parsed only once.
+ *
+ * To avoid heavy-tail problem with compilation times, each "subpart"
+ * of Catch2 has its own combined TU like this.
+ */
+
+////////////////////////////////////////////////////
+// vvv formerly catch_generator_exception.cpp vvv //
+////////////////////////////////////////////////////
+
+#include <catch2/generators/catch_generator_exception.hpp>
+
+namespace Catch {
+
+ const char* GeneratorException::what() const noexcept {
+ return m_msg;
+ }
+
+} // end namespace Catch
+
+
+///////////////////////////////////////////
+// vvv formerly catch_generators.cpp vvv //
+///////////////////////////////////////////
+
+#include <catch2/generators/catch_generators.hpp>
+#include <catch2/internal/catch_enforce.hpp>
+#include <catch2/generators/catch_generator_exception.hpp>
+#include <catch2/interfaces/catch_interfaces_capture.hpp>
+
+namespace Catch {
+
+IGeneratorTracker::~IGeneratorTracker() {}
+
+namespace Generators {
+
+namespace Detail {
+
+ [[noreturn]]
+ void throw_generator_exception(char const* msg) {
+ Catch::throw_exception(GeneratorException{ msg });
+ }
+} // end namespace Detail
+
+ GeneratorUntypedBase::~GeneratorUntypedBase() {}
+
+ auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
+ return getResultCapture().acquireGeneratorTracker( lineInfo );
+ }
+
+} // namespace Generators
+} // namespace Catch