Commit Graph

4130 Commits

Author SHA1 Message Date
Martin Hořeňovský
1d1ccf8f3c
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.
2020-05-31 15:20:24 +02:00
Martin Hořeňovský
41bbaa6d57
Implement a simplified variant of std::unique_ptr<T>
This simplified variant supports only a subset of the functionality
in `std::unique_ptr<T>`. `Catch::Detail::unique_ptr<T>` only supports
single element pointer (no array support) with default deleter.

By removing the support for custom deleters, we also avoid requiring
significant machinery to support EBO, speeding up instantiations of
`unique_ptr<T>` significantly. Catch2 also currently does not need
to support `unique_ptr<T[]>`, so that is not supported either.
2020-05-31 15:08:47 +02:00
Martin Hořeňovský
66ab942903
Refactor StreamEndStop slightly 2020-05-30 15:44:46 +02:00
Valentin Tolmer
d05a8e2e24 Add Bazel support for the v3 branch 2020-05-26 14:49:49 +02:00
Martin Hořeňovský
1356788ea8
Avoid using std::result_of when std::invoke_result is available 2020-05-21 22:58:33 +02:00
Martin Hořeňovský
21d284df34
Session now holds Config in unique_ptr instead of shared_ptr 2020-05-20 20:25:51 +02:00
Martin Hořeňovský
668454b36b
Do not share ownership of Config in RunContext 2020-05-20 20:25:49 +02:00
Martin Hořeňovský
458241cc90
Do not use shared_ptr<Config> when listing things 2020-05-20 20:25:48 +02:00
Martin Hořeňovský
fa160cf3f2
Keep reporter pointer around in TestGroup 2020-05-20 20:25:45 +02:00
Martin Hořeňovský
a17b9f754a
Remove unused function 2020-05-20 20:25:43 +02:00
Martin Hořeňovský
c2852c9944
Remove some uses of std::shared_ptr 2020-05-20 20:25:40 +02:00
Martin Hořeňovský
4394d3ae65
Translate exceptions by const reference instead of plain ref 2020-05-20 08:15:27 +02:00
Martin Hořeňovský
4b2f1da02a
Split CATCH_TRANSLATE_EXCEPTION into its own header
As far as I know, only a few users actually use it, but these changes
allow us to avoid including a surprising amount of code in the main
compilation path.
2020-05-20 08:15:11 +02:00
Martin Hořeňovský
0c6fda6e7d
Cleanup benchmark headers a tiny bit 2020-05-20 08:00:24 +02:00
Martin Hořeňovský
bad8b7c866
Fix make_shared used instead of make_unique 2020-05-20 07:15:21 +02:00
Martin Hořeňovský
964303706a
Fixup catch_discover_tests
Fixed its use of removed `--list-test-names-only` switch, and also
updated the return code check to reflect changes in v3.

Closes #1933
2020-05-20 07:14:06 +02:00
Martin Hořeňovský
54882dbb11
Don't include <tuple> everywhere in benchmarks 2020-05-20 07:09:15 +02:00
Martin Hořeňovský
b4a61cfd29
Remove superfluous overload of operator== 2020-05-18 21:32:08 +02:00
Martin Hořeňovský
d86834e5b5
Push down #include <ostream> to .cpp files 2020-05-18 21:31:41 +02:00
Martin Hořeňovský
39e093021c
Remove some superfluous includes 2020-05-18 20:55:21 +02:00
Martin Hořeňovský
e867ce7769
Fix missing backticks on release notes
Closes #1932
2020-05-15 10:54:20 +02:00
Martin Hořeňovský
f7fbbac601
Update release notes for v3 2020-05-14 14:57:22 +02:00
Martin Hořeňovský
ddde2f5e33
Remove obsolete configuration macros from the documentation 2020-05-14 14:52:33 +02:00
Martin Hořeňovský
d5e87eabbb
Add provided generic matchers to the documentation 2020-05-14 14:48:48 +02:00
Martin Hořeňovský
29d4b3768c
Add Wsuggest-override to warning flags 2020-05-13 16:09:34 +02:00
Martin Hořeňovský
ae0ba81423
Use more warnings for develoment builds 2020-05-12 23:56:51 +02:00
Martin Hořeňovský
03ef6b9f9a
Explicitly default smfs when relevant to avoid Wdeprecated-copy-dtor 2020-05-12 23:56:34 +02:00
Martin Hořeňovský
579dcd1a76
Ignore Wdeprecated for Clara 2020-05-12 23:56:24 +02:00
Martin Hořeňovský
eb267b424b
Tap reporter changes 2020-05-12 23:56:23 +02:00
Martin Hořeňovský
2528247351
Delete Capturer's smf
As part of `-Wdeprecated-copy-dtor` sweep, I noticed that Capturer's
copies are defaulted. Given that the class would likely break horribly
in the event of actual copy happening, they are now deleted.
2020-05-12 23:56:08 +02:00
Martin Hořeňovský
f56832d3ea
Add Catch2::Catch2 alias for Catch2 CMake target 2020-05-11 20:05:10 +02:00
Martin Hořeňovský
601ca1c670
Refactor some uses of virtual -> override 2020-05-11 16:34:55 +02:00
Martin Hořeňovský
a39154e115
Do not explicitly default smfs if all of them are defaulted 2020-05-11 00:00:55 +02:00
Martin Hořeňovský
7c622a79d4
Unvirtual bunch off destructors of simple data classes 2020-05-10 23:57:05 +02:00
Martin Hořeňovský
04cbbb8a4b
Replace getLineOfChars with non-templated, runtime version 2020-05-10 23:52:38 +02:00
Martin Hořeňovský
f64487bf70
Move LazyExpr's and MessageInfo's implementation to the combined TU
Some of the implementations were inlined instead.
2020-05-10 20:21:04 +02:00
Martin Hořeňovský
27f1756d8e
Split out LazyExpr into its own header
This enables us to avoid `catch_reporter_bases.hpp` being indirectly
dependent on `catch_tostring.hpp`, cutting apart quite a bit indirect
inclusions.
2020-05-10 20:21:02 +02:00
Martin Hořeňovský
824ffe6525
Inline and default LazyExpression's constructor 2020-05-10 20:20:59 +02:00
Martin Hořeňovský
d5e08a4beb
Rename catch_assertionhandler -> catch_assertion_handler 2020-05-10 20:20:56 +02:00
Martin Hořeňovský
ed967fd7fc
Split MessageInfo into its own header
This is first step towards splitting apart reporter implementation
and `catch_string.hpp`.
2020-05-10 20:20:52 +02:00
Martin Hořeňovský
7030d7740d
Remove some superfluous includes from reporters 2020-05-10 20:20:47 +02:00
Martin Hořeňovský
7efbc83ae0
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.
2020-05-10 15:37:29 +02:00
Martin Hořeňovský
9e498278be
Move StringRef header to internals 2020-05-10 10:09:01 +02:00
Martin Hořeňovský
14533f5bb6
Make Colour's op<< hidden friend 2020-05-10 07:32:40 +02:00
Martin Hořeňovský
895d0a0696
Small improvements for StringRef
* `operator[]` is constexpr
* `operator<<` and `operator+=` are hidden friends
2020-05-10 07:22:11 +02:00
Martin Hořeňovský
094d840efe
Cleanup SourceLineInfo implementation
Special member functions are now implicit, which should make them
both noexcept and constexpr. The `operator<<` has been made into
hidden friend as per best practices.
2020-05-10 06:57:02 +02:00
Martin Hořeňovský
a595066ff9
Use internal linkage for float stringification helper 2020-05-10 06:54:23 +02:00
Martin Hořeňovský
cb25c4a8a3
Reinline some StringMaker impls 2020-05-09 21:26:42 +02:00
Martin Hořeňovský
b93cf932fb
Use UDLs to construct StringRefs for decomposed operators directly 2020-05-09 21:07:55 +02:00
Martin Hořeňovský
eef6c9b79b
Microopt: stream single char instead of single char string 2020-05-09 21:02:12 +02:00