Limit number of secondary source locations.

This commit is contained in:
chriseth
2017-12-12 10:27:28 +01:00
parent eebeb52aed
commit 2d171c25e5
2 changed files with 17 additions and 14 deletions
+12
View File
@@ -109,6 +109,18 @@ public:
infos.push_back(std::make_pair(_errMsg, _sourceLocation));
return *this;
}
/// Limits the number of secondary source locations to 32 and appends a notice to the
/// error message.
void limitSize(std::string& _message)
{
size_t occurrences = infos.size();
if (occurrences > 32)
{
infos.resize(32);
_message += " Truncated from " + boost::lexical_cast<std::string>(occurrences) + " to the first 32 occurrences.";
}
}
std::vector<errorSourceLocationInfo> infos;
};