From 18e3d6dbca1250cdc36119c3da8328338fe9f1f6 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Fri, 30 Nov 2018 13:34:44 +0100 Subject: liblangutil: small refactors wrt. API cleanups Especially also remove SourceLocation ctor's that the compiler can default-implement. --- liblangutil/CharStream.h | 2 +- liblangutil/Scanner.h | 2 +- liblangutil/SourceLocation.h | 14 -------------- 3 files changed, 2 insertions(+), 16 deletions(-) (limited to 'liblangutil') diff --git a/liblangutil/CharStream.h b/liblangutil/CharStream.h index 6f2da3bb..f92beb30 100644 --- a/liblangutil/CharStream.h +++ b/liblangutil/CharStream.h @@ -80,7 +80,7 @@ public: void reset() { m_position = 0; } - std::string const& source() const { return m_source; } + std::string const& source() const noexcept { return m_source; } std::string const& name() const noexcept { return m_name; } ///@{ diff --git a/liblangutil/Scanner.h b/liblangutil/Scanner.h index a1185369..72d0072f 100644 --- a/liblangutil/Scanner.h +++ b/liblangutil/Scanner.h @@ -93,7 +93,7 @@ public: explicit Scanner(std::shared_ptr _source) { reset(std::move(_source)); } explicit Scanner(CharStream _source = CharStream()) { reset(std::move(_source)); } - std::string source() const { return m_source->source(); } + std::string const& source() const noexcept { return m_source->source(); } std::shared_ptr charStream() noexcept { return m_source; } diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 2dfd7123..732a32e1 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -41,20 +41,6 @@ struct SourceLocation SourceLocation(): start(-1), end(-1), source{nullptr} { } SourceLocation(int _start, int _end, std::shared_ptr _source): start(_start), end(_end), source{std::move(_source)} { } - SourceLocation(SourceLocation&& _other) noexcept: - start(_other.start), - end(_other.end), - source{std::move(_other.source)} - {} - SourceLocation(SourceLocation const&) = default; - SourceLocation& operator=(SourceLocation const&) = default; - SourceLocation& operator=(SourceLocation&& _other) noexcept - { - start = _other.start; - end = _other.end; - source = std::move(_other.source); - return *this; - } bool operator==(SourceLocation const& _other) const { -- cgit