From ac0c749a32a6660bb6e9134723b547538455ac63 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Tue, 3 Aug 2021 14:50:01 +0200 Subject: [PATCH] Eliminate some unnecessary header inclusions in headers in SourceLocation.h --- liblangutil/SourceLocation.cpp | 15 +++++++++++++++ liblangutil/SourceLocation.h | 21 ++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/liblangutil/SourceLocation.cpp b/liblangutil/SourceLocation.cpp index 058cc6b57..72f2506e8 100644 --- a/liblangutil/SourceLocation.cpp +++ b/liblangutil/SourceLocation.cpp @@ -21,6 +21,8 @@ #include #include +#include + using namespace solidity; using namespace solidity::langutil; using namespace std; @@ -50,3 +52,16 @@ SourceLocation solidity::langutil::parseSourceLocation(string const& _input, vec result.sourceName = _sourceNames.at(static_cast(sourceIndex)); return result; } + +std::ostream& solidity::langutil::operator<<(std::ostream& _out, SourceLocation const& _location) +{ + if (!_location.isValid()) + return _out << "NO_LOCATION_SPECIFIED"; + + if (_location.sourceName) + _out << *_location.sourceName; + + _out << "[" << _location.start << "," << _location.end << "]"; + + return _out; +} diff --git a/liblangutil/SourceLocation.h b/liblangutil/SourceLocation.h index 845b269ca..66cef52fb 100644 --- a/liblangutil/SourceLocation.h +++ b/liblangutil/SourceLocation.h @@ -23,16 +23,14 @@ #pragma once -#include -#include - -#include +#include #include #include +#include +#include namespace solidity::langutil { -struct SourceLocationError: virtual util::Exception {}; /** * Representation of an interval of source positions. @@ -112,17 +110,6 @@ SourceLocation parseSourceLocation( ); /// Stream output for Location (used e.g. in boost exceptions). -inline std::ostream& operator<<(std::ostream& _out, SourceLocation const& _location) -{ - if (!_location.isValid()) - return _out << "NO_LOCATION_SPECIFIED"; - - if (_location.sourceName) - _out << *_location.sourceName; - - _out << "[" << _location.start << "," << _location.end << "]"; - - return _out; -} +std::ostream& operator<<(std::ostream& _out, SourceLocation const& _location); }