Skip to content

Commit ac0c749

Browse files
Eliminate some unnecessary header inclusions in headers in SourceLocation.h
1 parent 81e9225 commit ac0c749

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

liblangutil/SourceLocation.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <boost/algorithm/string/split.hpp>
2222
#include <boost/algorithm/string.hpp>
2323

24+
#include <iostream>
25+
2426
using namespace solidity;
2527
using namespace solidity::langutil;
2628
using namespace std;
@@ -50,3 +52,16 @@ SourceLocation solidity::langutil::parseSourceLocation(string const& _input, vec
5052
result.sourceName = _sourceNames.at(static_cast<size_t>(sourceIndex));
5153
return result;
5254
}
55+
56+
std::ostream& solidity::langutil::operator<<(std::ostream& _out, SourceLocation const& _location)
57+
{
58+
if (!_location.isValid())
59+
return _out << "NO_LOCATION_SPECIFIED";
60+
61+
if (_location.sourceName)
62+
_out << *_location.sourceName;
63+
64+
_out << "[" << _location.start << "," << _location.end << "]";
65+
66+
return _out;
67+
}

liblangutil/SourceLocation.h

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@
2323

2424
#pragma once
2525

26-
#include <libsolutil/Assertions.h>
27-
#include <libsolutil/Exceptions.h>
28-
29-
#include <limits>
26+
#include <iosfwd>
3027
#include <memory>
3128
#include <string>
29+
#include <tuple>
30+
#include <vector>
3231

3332
namespace solidity::langutil
3433
{
35-
struct SourceLocationError: virtual util::Exception {};
3634

3735
/**
3836
* Representation of an interval of source positions.
@@ -112,17 +110,6 @@ SourceLocation parseSourceLocation(
112110
);
113111

114112
/// Stream output for Location (used e.g. in boost exceptions).
115-
inline std::ostream& operator<<(std::ostream& _out, SourceLocation const& _location)
116-
{
117-
if (!_location.isValid())
118-
return _out << "NO_LOCATION_SPECIFIED";
119-
120-
if (_location.sourceName)
121-
_out << *_location.sourceName;
122-
123-
_out << "[" << _location.start << "," << _location.end << "]";
124-
125-
return _out;
126-
}
113+
std::ostream& operator<<(std::ostream& _out, SourceLocation const& _location);
127114

128115
}

0 commit comments

Comments
 (0)