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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-05-14 23:45:59 +0200
committerMartin Hořeňovský2021-05-14 23:45:59 +0200
commit61e16416a99fe4ba48c1adfc46082276433be6c0 (patch)
tree57e892cc11a0d80b0fa9fd90237fdc0d0a186d34 /src/catch2/internal
parent074017f5ad759328826a93dbea8ea41cc4d6808d (diff)
downloadcatch3-61e16416a99fe4ba48c1adfc46082276433be6c0.tar.gz
Pass other StringRef arguments by value instead of by-ref
Apart from being clearer, it also improves the overall codesize of the implementation library, and should improve the performance as well, by removing one level of indirection.
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_assertion_handler.cpp6
-rw-r--r--src/catch2/internal/catch_assertion_handler.hpp6
-rw-r--r--src/catch2/internal/catch_run_context.cpp2
-rw-r--r--src/catch2/internal/catch_run_context.hpp2
-rw-r--r--src/catch2/internal/catch_test_case_registry_impl.cpp2
-rw-r--r--src/catch2/internal/catch_test_case_registry_impl.hpp2
-rw-r--r--src/catch2/internal/catch_test_registry.cpp2
-rw-r--r--src/catch2/internal/catch_test_registry.hpp6
8 files changed, 14 insertions, 14 deletions
diff --git a/src/catch2/internal/catch_assertion_handler.cpp b/src/catch2/internal/catch_assertion_handler.cpp
index 7774ca68..828aa7cd 100644
--- a/src/catch2/internal/catch_assertion_handler.cpp
+++ b/src/catch2/internal/catch_assertion_handler.cpp
@@ -18,7 +18,7 @@
namespace Catch {
AssertionHandler::AssertionHandler
- ( StringRef const& macroName,
+ ( StringRef macroName,
SourceLineInfo const& lineInfo,
StringRef capturedExpression,
ResultDisposition::Flags resultDisposition )
@@ -29,7 +29,7 @@ namespace Catch {
void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
}
- void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {
+ void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) {
m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
}
@@ -80,7 +80,7 @@ namespace Catch {
// This is the overload that takes a string and infers the Equals matcher from it
// The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
- void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) {
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) {
handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
}
diff --git a/src/catch2/internal/catch_assertion_handler.hpp b/src/catch2/internal/catch_assertion_handler.hpp
index 8e266ade..b7c7613e 100644
--- a/src/catch2/internal/catch_assertion_handler.hpp
+++ b/src/catch2/internal/catch_assertion_handler.hpp
@@ -32,7 +32,7 @@ namespace Catch {
public:
AssertionHandler
- ( StringRef const& macroName,
+ ( StringRef macroName,
SourceLineInfo const& lineInfo,
StringRef capturedExpression,
ResultDisposition::Flags resultDisposition );
@@ -49,7 +49,7 @@ namespace Catch {
}
void handleExpr( ITransientExpression const& expr );
- void handleMessage(ResultWas::OfType resultType, StringRef const& message);
+ void handleMessage(ResultWas::OfType resultType, StringRef message);
void handleExceptionThrownAsExpected();
void handleUnexpectedExceptionNotThrown();
@@ -64,7 +64,7 @@ namespace Catch {
auto allowThrows() const -> bool;
};
- void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString );
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString );
} // namespace Catch
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 127fc538..82235c4e 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -519,7 +519,7 @@ namespace Catch {
void RunContext::handleMessage(
AssertionInfo const& info,
ResultWas::OfType resultType,
- StringRef const& message,
+ StringRef message,
AssertionReaction& reaction
) {
m_reporter->assertionStarting( info );
diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp
index 8819aa17..5f91ddda 100644
--- a/src/catch2/internal/catch_run_context.hpp
+++ b/src/catch2/internal/catch_run_context.hpp
@@ -54,7 +54,7 @@ namespace Catch {
void handleMessage
( AssertionInfo const& info,
ResultWas::OfType resultType,
- StringRef const& message,
+ StringRef message,
AssertionReaction& reaction ) override;
void handleUnexpectedExceptionNotThrown
( AssertionInfo const& info,
diff --git a/src/catch2/internal/catch_test_case_registry_impl.cpp b/src/catch2/internal/catch_test_case_registry_impl.cpp
index d142f045..f6808e4a 100644
--- a/src/catch2/internal/catch_test_case_registry_impl.cpp
+++ b/src/catch2/internal/catch_test_case_registry_impl.cpp
@@ -149,7 +149,7 @@ namespace {
m_testAsFunction();
}
- std::string extractClassName( StringRef const& classOrQualifiedMethodName ) {
+ std::string extractClassName( StringRef classOrQualifiedMethodName ) {
std::string className(classOrQualifiedMethodName);
if( startsWith( className, '&' ) )
{
diff --git a/src/catch2/internal/catch_test_case_registry_impl.hpp b/src/catch2/internal/catch_test_case_registry_impl.hpp
index f7fc37ef..383512af 100644
--- a/src/catch2/internal/catch_test_case_registry_impl.hpp
+++ b/src/catch2/internal/catch_test_case_registry_impl.hpp
@@ -64,7 +64,7 @@ namespace Catch {
};
- std::string extractClassName( StringRef const& classOrQualifiedMethodName );
+ std::string extractClassName( StringRef classOrQualifiedMethodName );
///////////////////////////////////////////////////////////////////////////
diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp
index c4f26181..bb5d7810 100644
--- a/src/catch2/internal/catch_test_registry.cpp
+++ b/src/catch2/internal/catch_test_registry.cpp
@@ -17,7 +17,7 @@ namespace Catch {
return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsFunction( testAsFunction ));
}
- AutoReg::AutoReg( Detail::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 classOrMethod, NameAndTags const& nameAndTags ) noexcept {
CATCH_TRY {
getMutableRegistryHub()
.registerTest(
diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp
index 9e8b5b6e..0a7b7474 100644
--- a/src/catch2/internal/catch_test_registry.hpp
+++ b/src/catch2/internal/catch_test_registry.hpp
@@ -46,15 +46,15 @@ Detail::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) {
}
struct NameAndTags {
- NameAndTags(StringRef const& name_ = StringRef(),
- StringRef const& tags_ = StringRef()) noexcept:
+ NameAndTags(StringRef name_ = StringRef(),
+ StringRef tags_ = StringRef()) noexcept:
name(name_), tags(tags_) {}
StringRef name;
StringRef tags;
};
struct AutoReg : Detail::NonCopyable {
- AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
+ AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
};
} // end namespace Catch