summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-07-09 12:46:57 -0700
committerJosh Stone <jistone@redhat.com>2009-07-09 16:17:14 -0700
commit2203b03262e340b25fc26996cc2786c1c02041e3 (patch)
treead6f6a37153f502d7fcdcee0842c8ec5ac460c83 /elaborate.cxx
parent66c7d4c1a4147bc05abd1e69f41ec9d59685c433 (diff)
downloadsystemtap-steved-2203b03262e340b25fc26996cc2786c1c02041e3.tar.gz
systemtap-steved-2203b03262e340b25fc26996cc2786c1c02041e3.tar.xz
systemtap-steved-2203b03262e340b25fc26996cc2786c1c02041e3.zip
Remove the filename copy from token->location
The location already has a pointer to a stapfile with the filename, so there's no need to keep an extra copy.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 30e9a775..fafc5e63 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1491,9 +1491,9 @@ systemtap_session::print_token (ostream& o, const token* tok)
tmpo << *tok;
string ts = tmpo.str();
// search & replace the file name with nothing
- size_t idx = ts.find (tok->location.file);
+ size_t idx = ts.find (tok->location.file->name);
if (idx != string::npos)
- ts.replace (idx, tok->location.file.size(), "");
+ ts.replace (idx, tok->location.file->name.size(), "");
o << ts;
}
@@ -1560,16 +1560,16 @@ systemtap_session::print_error_source (std::ostream& message,
std::string& align, const token* tok)
{
unsigned i = 0;
- unsigned line = tok->location.line;
- unsigned col = tok->location.column;
- string file_contents;
assert (tok);
- if (tok->location.stap_file)
- file_contents = tok->location.stap_file->file_contents;
- else
+ if (!tok->location.file)
//No source to print, silently exit
return;
+
+ unsigned line = tok->location.line;
+ unsigned col = tok->location.column;
+ const string &file_contents = tok->location.file->file_contents;
+
size_t start_pos = 0, end_pos = 0;
//Navigate to the appropriate line
while (i != line && end_pos != std::string::npos)
@@ -1937,7 +1937,7 @@ void semantic_pass_opt1 (systemtap_session& s, bool& relaxed_p)
functiondecl* fd = it->second;
if (ftv.traversed.find(fd) == ftv.traversed.end())
{
- if (fd->tok->location.file == s.user_file->name && // !tapset
+ if (fd->tok->location.file->name == s.user_file->name && // !tapset
! s.suppress_warnings)
s.print_warning ("eliding unused function '" + fd->name + "'", fd->tok);
else if (s.verbose>2)
@@ -1993,7 +1993,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
if (vut.read.find (l) == vut.read.end() &&
vut.written.find (l) == vut.written.end())
{
- if (l->tok->location.file == s.user_file->name && // !tapset
+ if (l->tok->location.file->name == s.user_file->name && // !tapset
! s.suppress_warnings)
s.print_warning ("eliding unused variable '" + l->name + "'", l->tok);
else if (s.verbose>2)
@@ -2037,7 +2037,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
if (vut.read.find (l) == vut.read.end() &&
vut.written.find (l) == vut.written.end())
{
- if (l->tok->location.file == s.user_file->name && // !tapset
+ if (l->tok->location.file->name == s.user_file->name && // !tapset
! s.suppress_warnings)
s.print_warning ("eliding unused variable '" + l->name + "'", l->tok);
else if (s.verbose>2)
@@ -2083,7 +2083,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
if (vut.read.find (l) == vut.read.end() &&
vut.written.find (l) == vut.written.end())
{
- if (l->tok->location.file == s.user_file->name && // !tapset
+ if (l->tok->location.file->name == s.user_file->name && // !tapset
! s.suppress_warnings)
s.print_warning ("eliding unused variable '" + l->name + "'", l->tok);
else if (s.verbose>2)