isolate Location specifics to private class variables to enforce correct line number ordering

This commit is contained in:
Vern Paxson 2025-07-03 16:41:14 -07:00 committed by Arne Welzel
parent eb6b4a0c46
commit 5c63133226
30 changed files with 172 additions and 136 deletions

View file

@ -686,17 +686,17 @@ private:
// Return the key used to associate a Location object with its full
// descriptiion.
std::string LocKey(const Location* loc) const {
return std::string(loc->filename) + ":" + std::to_string(loc->first_line) + "-" +
std::to_string(loc->last_line);
return std::string(loc->FileName()) + ":" + std::to_string(loc->FirstLine()) + "-" +
std::to_string(loc->LastLine());
}
// Return the description of a location including its the function
// in which it's embedded.
std::string LocWithFunc(const Location* loc) const {
auto res = func_name_prefix + std::to_string(loc->first_line);
auto res = func_name_prefix + std::to_string(loc->FirstLine());
if ( loc->first_line != loc->last_line )
res += "-" + std::to_string(loc->last_line);
if ( loc->FirstLine() != loc->LastLine() )
res += "-" + std::to_string(loc->LastLine());
return res;
}