diff options
| author | Martin Hořeňovský | 2025-10-04 16:38:07 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-10-04 16:38:07 +0200 |
| commit | 363ca5af1816f2a03cf0815f916fe70fed19ba27 (patch) | |
| tree | 7eb2b8111a7d1c86670ae7bda54937d186db45be /src/catch2 | |
| parent | cb6d713774d66e2f63c5378fd1b7faaa7eddf956 (diff) | |
| download | catch3-363ca5af1816f2a03cf0815f916fe70fed19ba27.tar.gz | |
Add lifetime annotations to more places using StringRef
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/internal/catch_string_manip.hpp | 7 | ||||
| -rw-r--r-- | src/catch2/internal/catch_test_case_tracker.hpp | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/catch2/internal/catch_string_manip.hpp b/src/catch2/internal/catch_string_manip.hpp index dc0c552c..4251f83d 100644 --- a/src/catch2/internal/catch_string_manip.hpp +++ b/src/catch2/internal/catch_string_manip.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_STRING_MANIP_HPP_INCLUDED #define CATCH_STRING_MANIP_HPP_INCLUDED +#include <catch2/internal/catch_lifetimebound.hpp> #include <catch2/internal/catch_stringref.hpp> #include <cstdint> @@ -28,10 +29,10 @@ namespace Catch { //! Returns a new string without whitespace at the start/end std::string trim( std::string const& str ); //! Returns a substring of the original ref without whitespace. Beware lifetimes! - StringRef trim(StringRef ref); + StringRef trim( StringRef ref CATCH_ATTR_LIFETIMEBOUND ); // !!! Be aware, returns refs into original string - make sure original string outlives them - std::vector<StringRef> splitStringRef( StringRef str, char delimiter ); + std::vector<StringRef> splitStringRef( StringRef str CATCH_ATTR_LIFETIMEBOUND, char delimiter ); bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); /** @@ -49,7 +50,7 @@ namespace Catch { StringRef m_label; public: - constexpr pluralise(std::uint64_t count, StringRef label): + constexpr pluralise(std::uint64_t count, StringRef label CATCH_ATTR_LIFETIMEBOUND): m_count(count), m_label(label) {} diff --git a/src/catch2/internal/catch_test_case_tracker.hpp b/src/catch2/internal/catch_test_case_tracker.hpp index 50278c91..6bd749ff 100644 --- a/src/catch2/internal/catch_test_case_tracker.hpp +++ b/src/catch2/internal/catch_test_case_tracker.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_TEST_CASE_TRACKER_HPP_INCLUDED #define CATCH_TEST_CASE_TRACKER_HPP_INCLUDED +#include <catch2/internal/catch_lifetimebound.hpp> #include <catch2/internal/catch_source_line_info.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_stringref.hpp> @@ -48,7 +49,7 @@ namespace TestCaseTracking { StringRef name; SourceLineInfo location; - constexpr NameAndLocationRef( StringRef name_, + constexpr NameAndLocationRef( StringRef name_ CATCH_ATTR_LIFETIMEBOUND, SourceLineInfo location_ ): name( name_ ), location( location_ ) {} |