summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-06-04 02:35:18 +0000
committerfche <fche>2005-06-04 02:35:18 +0000
commit8846477c222cdae649b02117cc96999b0be6ad40 (patch)
treef4f046be797d869b6377597c9d941d051fc9a102 /elaborate.cxx
parent553d27a587615e4b242a89bf1a7af93b71f050f0 (diff)
downloadsystemtap-steved-8846477c222cdae649b02117cc96999b0be6ad40.tar.gz
systemtap-steved-8846477c222cdae649b02117cc96999b0be6ad40.tar.xz
systemtap-steved-8846477c222cdae649b02117cc96999b0be6ad40.zip
2005-06-03 Frank Ch. Eigler <fche@elastic.org>
* elaborate.cxx (find_*): Remove arity checks from here ... * staptree.cxx (set_arity): Put arity match assertion here. * testsuite/semko/{six,nine}.stp: Confirm logic. * testsuite/transko/one.stp: First translation-time ko test.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx52
1 files changed, 24 insertions, 28 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index e733132f..c6596da6 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -292,43 +292,48 @@ symresolution_info::find_scalar (const string& name)
current_probe->locals);
for (unsigned i=0; i<locals.size(); i++)
if (locals[i]->name == name)
- // NB: no need to check arity here: locals always scalar
- return locals[i];
+ {
+ // NB: no need to check arity here: formal args always scalar
+ locals[i]->set_arity (0);
+ return locals[i];
+ }
// search function formal parameters (if any)
if (current_function)
for (unsigned i=0; i<current_function->formal_args.size(); i++)
if (current_function->formal_args[i]->name == name)
- // NB: no need to check arity here: formal args always scalar
- return current_function->formal_args[i];
+ {
+ // NB: no need to check arity here: formal args always scalar
+ current_function->formal_args[i]->set_arity (0);
+ return current_function->formal_args[i];
+ }
// search globals
for (unsigned i=0; i<session.globals.size(); i++)
if (session.globals[i]->name == name)
- if (session.globals[i]->arity <= 0)
- {
- session.globals[i]->set_arity (0);
- return session.globals[i];
- }
+ {
+ session.globals[i]->set_arity (0);
+ return session.globals[i];
+ }
// search library globals
for (unsigned i=0; i<session.library_files.size(); i++)
{
stapfile* f = session.library_files[i];
for (unsigned j=0; j<f->globals.size(); j++)
- if (f->globals[j]->name == name &&
- f->globals[j]->index_types.size() == 0)
+ if (f->globals[j]->name == name)
{
// put library into the queue if not already there
if (0) // (session.verbose_resolution)
cerr << " scalar " << name << " "
<< "is defined from " << f->name << endl;
-
+
if (find (session.files.begin(), session.files.end(), f)
== session.files.end())
session.files.push_back (f);
// else .. print different message?
+ f->globals[j]->set_arity (0);
return f->globals[j];
}
}
@@ -353,7 +358,6 @@ symresolution_info::find_scalar (const string& name)
}
return 0;
- // XXX: add checking for conflicting array or function
}
@@ -363,13 +367,10 @@ symresolution_info::find_array (const string& name, unsigned arity)
// search processed globals
for (unsigned i=0; i<session.globals.size(); i++)
if (session.globals[i]->name == name)
- if ((arity > 0 && (session.globals[i]->arity == (int) arity)) ||
- session.globals[i]->arity < 0)
- {
- if (arity > 0)
- session.globals[i]->set_arity (arity);
- return session.globals[i];
- }
+ {
+ session.globals[i]->set_arity (arity);
+ return session.globals[i];
+ }
// search library globals
for (unsigned i=0; i<session.library_files.size(); i++)
@@ -377,28 +378,24 @@ symresolution_info::find_array (const string& name, unsigned arity)
stapfile* f = session.library_files[i];
for (unsigned j=0; j<f->globals.size(); j++)
if (f->globals[j]->name == name)
- if ((arity > 0 && (f->globals[j]->arity == (int) arity)) ||
- f->globals[j]->arity < 0)
{
- if (arity > 0)
- f->globals[j]->set_arity (arity);
+ f->globals[j]->set_arity (arity);
// put library into the queue if not already there
if (0) // (session.verbose_resolution)
cerr << " array " << name << " "
<< "is defined from " << f->name << endl;
-
+
if (find (session.files.begin(), session.files.end(), f)
== session.files.end())
session.files.push_back (f);
// else .. print different message?
-
+
return f->globals[j];
}
}
return 0;
- // XXX: add checking for conflicting scalar or function
}
@@ -436,7 +433,6 @@ symresolution_info::find_function (const string& name, unsigned arity)
}
return 0;
- // XXX: add checking for conflicting variables
}