00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <lestes/lang/cplus/sem/ss_misc.g.hh>
00029 #include <lestes/lang/cplus/sem/ss_statement.g.hh>
00030 #include <lestes/lang/cplus/sem/ss_type_builtin.g.hh>
00031 #include <lestes/lang/cplus/sem/ss_declaration.g.hh>
00032 #include <lestes/lang/cplus/sem/ss_decl_name.g.hh>
00033 #include <lestes/lang/cplus/sem/ss_decl_name_matcher.g.hh>
00034 #include <lestes/std/source_location.hh>
00035
00036 package(lestes);
00037 package(lang);
00038 package(cplus);
00039 package(sem);
00040
00041
00042
00043
00044
00045
00046
00047 bool ss_declaration_time::is_before(ptr<ss_declaration_time> other)
00048 {
00049 lassert( other );
00050 return time < other->time;
00051 }
00052
00053
00054
00055
00056 ptr < ss_declaration_time > ss_declaration_time::infinity()
00057 {
00058 if (!infinity_instance)
00059 infinity_instance = ss_declaration_time::create(static_cast < ulint > (-1));
00060 return infinity_instance;
00061 }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 ptr<ss_decl_seq> ss_decl_seq::root_instance()
00077 {
00078 if (!the_root_instance) {
00079
00080 ptr < source_location > loc = source_location::create(file_info::create("",NULL),1,1);
00081 the_root_instance = new ss_decl_seq(loc,
00082 list< srp<ss_declaration> >::create(),
00083 NULL, NULL, list< srp<ss_using_directive> >::create(), NULL );
00084
00085 the_root_instance->parent = the_root_instance;
00086
00087
00088
00089 ptr<ss_declaration> gl_decl = ss_namespace_definition::create(
00090 loc, ss_declaration_time::infinity(), ss_declaration_time::create(0),
00091 ss_dummy_name::create(loc), the_root_instance,
00092 ss_void::instance(), ss_linkage::create("C++", ss_linkage::LINKAGE_NO),
00093 the_root_instance );
00094 the_root_instance->declared_by_set( gl_decl );
00095 the_root_instance->contents_get()->push_back( gl_decl );
00096
00097 the_root_instance->compound_stmt = ss_compound_stmt::root_instance();
00098 }
00099 return the_root_instance;
00100 }
00101
00102
00103
00104
00105
00106
00107
00108
00109 bool ss_function_declaration::is_entry_point()
00110 {
00111 if (contained_in_get() != ss_decl_seq::root_instance())
00112 return false;
00113 ptr<ss_decl_name> main_name = ss_ordinary_name::create( name_get()->location_get(), "main" );
00114 if (main_name->matches(name_get()))
00115 return true;
00116
00117 return false;
00118 }
00119
00120
00121 end_package(sem);
00122 end_package(cplus);
00123 end_package(lang);
00124 end_package(lestes);