Eliminate some unnecessary header inclusions in headers in SourceLocation.h

This commit is contained in:
Christian Parpart 2021-08-03 14:50:01 +02:00
parent 81e9225304
commit ac0c749a32
2 changed files with 19 additions and 17 deletions

View File

@ -21,6 +21,8 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string.hpp>
#include <iostream>
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<size_t>(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;
}

View File

@ -23,16 +23,14 @@
#pragma once
#include <libsolutil/Assertions.h>
#include <libsolutil/Exceptions.h>
#include <limits>
#include <iosfwd>
#include <memory>
#include <string>
#include <tuple>
#include <vector>
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);
}