[Prev][Next][Index]
class symbols
- From: dfj@cc.gatech.edu (Dean Jerding)
- Subject: class symbols
- To: sage-bugs@cica.indiana.edu
- Date: Fri, 20 Jan 1995 18:03:39 -0500 (EST)
- Cc: dfj@cc.gatech.edu (Dean F. Jerding)
Hey
I am having a problem finding the filename of SgClassSymb's in sage++
files. What I'm doing is reading through the symbols, checking if
they are class symbols, and then retrieving their name and the file
they are declared in. To do this, I use the declaredInStmt() method,
and then the fileName() method. The problem is that some of the class
symbols' declaredInStmt() are returning NULL. If I use the scope()
method, then I get a temp file that I am using instead of the actual
file that the "class" declaration is in.
Here's an excerpt of my code:
---------------
else if(isSgClassSymb(curr_symbol) &&
(curr_symbol->variant() == CLASS_NAME)) {
// class
SgStatement *class_stmt = curr_symbol->declaredInStmt();
char *class_name = curr_symbol->identifier();
char *file_name = NULL;
if(class_stmt) {
file_name = class_stmt->fileName();
}
// check if class should be recorded (file_name == NULL is a
// hack for now til bug found)
if(file_name && isValidClass(file_name, class_name)) {
if(verbose)
cout << " Recording " << class_name << endl;
class_define_event.event_id = CLASS_DEFINE;
class_define_event.class_name = class_name;
WriteClassDefineEvent();
}
}
----------------
I inserted the 'if(class_stmt)' to keep me from core-dumping. I need
the correct file_name as a parameter to the isValidClass() routine.
Thanks for any help,
Dean
---------------------------------------------------------------------------
Dean Jerding e-mail: dfj@cc.gatech.edu
Graphics, Visualization, and Usability Center phone: (404)894-9761
Georgia Institute of Technology