li_func_by_name.cc

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 #include <lestes/lang/cplus/sem/lu_filter.g.hh>
00029 #include <lestes/lang/cplus/sem/li_func_by_name.g.hh>
00030 #include <lestes/lang/cplus/sem/lu_lu.g.hh>
00031 #include <lestes/lang/cplus/sem/ss_decl_name.g.hh>
00032 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00033 #include <lestes/lang/cplus/sem/ss_misc.g.hh>
00034 #include <lestes/std/source_location.hh>
00035 #include <lestes/std/set.hh>
00036 #include <lestes/msg/logger.hh>
00037 #include <lestes/msg/logger_util.hh>
00038 
00039 /*! \file
00040   \brief Lookup for function decl in a given scope and parents
00041   \todo UDIR_, UDECL_ to be adjusted
00042   \author jikos
00043  */
00044 
00045 package(lestes);
00046 package(lang);
00047 package(cplus);
00048 package(sem);
00049 
00050 /*!
00051  */
00052 ptr < ::lestes::std::set< srp< ss_function_declaration > > > li_func_by_name::process(ptr < ss_decl_name > name, ptr < ss_decl_seq > scope)
00053 {
00054         ptr < lu_name_filter > nf = lu_name_filter::create(name);
00055         ptr < lu_func_cont_filter > ff = lu_func_cont_filter::instance();
00056         ptr < lu_multi_filter > mf = lu_multi_filter::create();
00057         mf->add_filter(ff);
00058         mf->add_filter(nf);
00059         ptr < lu_params > params = lu_params::create(lu_params::UDIR_IGNORE, lu_params::UDECL_IGNORE, lu_params::SEARCH_PARENTS,
00060                         ss_declaration_time::create(name->location_get()->order_get()), mf);
00061         ptr< ::lestes::std::set< srp< ss_declaration > > > res = lu_lookup::instance()->main(scope, params);
00062         ptr< ::lestes::std::set< srp< ss_function_declaration > > > res_f = ::lestes::std::set< srp< ss_function_declaration > >::create();
00063         ::lestes::std::set< srp< ss_declaration > >::iterator it;
00064         
00065         for(it = res->begin(); it != res->end(); it++) {
00066                 res_f->insert((*it).dncast<ss_function_declaration>());
00067         }
00068         return res_f;
00069 }
00070 
00071 end_package(sem);
00072 end_package(cplus);
00073 end_package(lang);
00074 end_package(lestes);
00075 

Generated on Mon Feb 12 18:22:37 2007 for lestes by doxygen 1.5.1-20070107