| Polaris: DefLocMap.cc Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
DefLocMap.ccGo to the documentation of this file.00001 /// 00002 /// 00003 /// \file DefLocMap.cc 00004 /// 00005 #ifdef POLARIS_GNU_PRAGMAS 00006 #pragma implementation 00007 #endif 00008 /// 00009 #include <stdio.h> 00010 00011 #include "DefLocMap.h" 00012 #include "ProgramUnit.h" 00013 00014 #include "debug.h" 00015 00016 ostream & 00017 operator << (ostream & o, DefLocMap & map) 00018 { 00019 map.print(o); 00020 return o; 00021 } 00022 00023 void 00024 DefLocMap::print(ostream & o) const 00025 { 00026 o << "{\n"; 00027 00028 KeyIterator<Symbol,DefLoc> iter(_map); 00029 00030 while (iter.valid()) { 00031 o << "Symbol: " << iter.current_key().name_ref() 00032 << endl << iter.current_data() << endl; 00033 ++iter; 00034 } 00035 00036 o << "}\n"; 00037 } 00038 00039 DefLocMap::DefLocMap(const DefLocMap & map, const ProgramUnit & new_main_pgm) 00040 { 00041 #ifdef CLASS_INSTANCE_REGISTRY 00042 register_instance(DEFLOC_MAP, sizeof(DefLocMap), this); 00043 #endif 00044 00045 for (KeyIterator<Symbol,DefLoc> map_iter = map._map; 00046 map_iter.valid(); ++map_iter) { 00047 Symbol & curr_sym = map_iter.current_key(); 00048 Symbol * new_sym_ref = 00049 CASTAWAY(Symbol *) new_main_pgm.symtab().find_ref(curr_sym.name_ref()); 00050 p_assert(new_sym_ref, 00051 "Attempt to relink invalid DefLoc in DefLocMap clone constructor"); 00052 00053 DefLoc & curr_data = map_iter.current_data(); 00054 DefLoc * new_defloc = new DefLoc(); 00055 00056 /// ... The following is a PRIVATE member access 00057 if (curr_data._st.valid()) { 00058 /// ... The following is a PRIVATE member access 00059 Statement * new_stmt_ref = 00060 CASTAWAY(Statement *) 00061 new_main_pgm.stmts().find_ref(curr_data._st->tag()); 00062 if (new_stmt_ref==0){ 00063 cerr<<"\nStatement in orig: "<<curr_data._st<<*curr_data._st; 00064 } 00065 p_assert(new_stmt_ref, 00066 "Attempt to relink invalid DefLoc in DefLocMap clone constructor"); 00067 /// ... The following is a PRIVATE member access 00068 new_defloc->_st = *new_stmt_ref; 00069 } 00070 _map.ins(*new_sym_ref, new_defloc); 00071 } 00072 } 00073 00074 int 00075 DefLocMap::structures_OK() const 00076 { 00077 return 1; 00078 } 00079 00080 DefLocMap * 00081 DefLocMap::clone() const 00082 { 00083 return new DefLocMap(*this); 00084 } 00085 00086 Listable * 00087 DefLocMap::listable_clone() const 00088 { 00089 return new DefLocMap(*this); 00090 } 00091 |
||
|