00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef FUNCTIONCALL_H_
00010 #define FUNCTIONCALL_H_
00011
00012 #include "SaveInstruction.h"
00013 #include <string>
00014 #include <vector>
00015 #include <set>
00016 #include "type.h"
00017 #include "call_id.h"
00018 using namespace std;
00019 namespace il{class type;}
00020
00021 namespace sail {
00022 class Variable;
00023 class Symbol;
00024
00033 class FunctionCall: public SaveInstruction {
00034 friend class boost::serialization::access;
00035
00036 template<class Archive>
00037 void save(Archive & ar, const unsigned int version) const
00038 {
00039 ar & boost::serialization::base_object<sail::SaveInstruction>(*this);
00040 ar & ret;
00041 ar & fn_name;
00042 ar & fn_signature;
00043 ar & args;
00044 ar & virtual_dispatch;
00045 }
00046
00047 template<class Archive>
00048 void load(Archive & ar, const unsigned int version)
00049 {
00050 ar & boost::serialization::base_object<sail::SaveInstruction>(*this);
00051 ar & ret;
00052 ar & fn_name;
00053 ar & fn_signature;
00054 il::type::register_loaded_typeref(&fn_signature);
00055 ar & args;
00056 ar & virtual_dispatch;
00057
00058 }
00059
00060 BOOST_SERIALIZATION_SPLIT_MEMBER()
00061
00062 private:
00063 Variable* ret;
00064
00065
00066 string fn_name;
00067
00072 il::type* fn_signature;
00073 vector<Symbol*>* args;
00074
00075 bool virtual_dispatch;
00076
00077
00078
00079 public:
00080 FunctionCall(Variable* ret, string fn_name, il::type* fn_signature,
00081 vector<Symbol*>* args, il::node* original, int line);
00082 FunctionCall(){args = NULL;};
00083 virtual string to_string() const;
00084 virtual string to_string(bool pretty_print) const;
00085
00089 string get_function_name();
00090
00094 il::namespace_context get_namespace() const;
00095
00099 il::type* get_signature();
00100
00104 vector<Symbol*>* get_arguments();
00105
00109 bool has_return();
00110
00114 Variable* get_return_variable();
00115
00116
00120 bool is_virtual_call();
00121
00122
00123
00128 void get_virtual_call_targets(set<call_id>& targets);
00129
00130 virtual Variable* get_lhs();
00131 virtual void set_lhs(Variable* v);
00132 virtual bool is_removable();
00133
00138 bool is_exit_function() const;
00139
00143 bool is_allocator() const;
00144
00148 bool is_operator_new() const;
00149
00150
00154 bool is_deallocator() const;
00155
00156
00160 bool is_constructor();
00161
00162
00166 bool is_destructor();
00167
00168 virtual ~FunctionCall();
00169
00170 private:
00171
00172
00173
00174
00175
00176
00177 il::function_declaration* find_matching_method(il::record_type* t,
00178 const string& name, il::type* signature);
00179 };
00180
00181 }
00182
00183 #endif