From 5959fbb5524bbeb05a96eb15aba59e961a3efcb7 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 15 Feb 2026 04:10:38 +0100 Subject: Initial commit --- frontend/result.cc | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 frontend/result.cc (limited to 'frontend/result.cc') diff --git a/frontend/result.cc b/frontend/result.cc new file mode 100644 index 0000000..aca9c5e --- /dev/null +++ b/frontend/result.cc @@ -0,0 +1,67 @@ +/* Miscellaneous types used across stage boundaries. + Copyright (C) 2025 Free Software Foundation, Inc. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#include "elna/frontend/result.h" + +namespace elna::frontend +{ + error::error(const char *path, const struct position position) + : position(position), path(path) + { + } + + std::size_t error::line() const noexcept + { + return this->position.line; + } + + std::size_t error::column() const noexcept + { + return this->position.column; + } + + error_container::error_container(const char *input_file) + : input_file(input_file) + { + } + + std::deque>& error_container::errors() + { + return m_errors; + } + + bool error_container::has_errors() const + { + return !m_errors.empty(); + } + + bool identifier_definition::operator==(const identifier_definition& that) const + { + return *this == that.name; + } + + bool identifier_definition::operator==(const std::string& that) const + { + return this->name == that; + } +} + +std::size_t std::hash::operator()( + const elna::frontend::identifier_definition& key) const +{ + return std::hash{}(key.name); +} -- cgit v1.2.3